diff options
Diffstat (limited to 'eclipse/plugins/com.android.ide.eclipse.adt/src')
14 files changed, 285 insertions, 31 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/EditTextRule.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/EditTextRule.java new file mode 100644 index 0000000..dfe9d6f --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/EditTextRule.java @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Eclipse Public License, Version 1.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.eclipse.org/org/documents/epl-v10.php + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.ide.common.layout; + +import static com.android.ide.eclipse.adt.internal.editors.layout.descriptors.LayoutDescriptors.REQUEST_FOCUS; + +import com.android.ide.common.api.IMenuCallback; +import com.android.ide.common.api.INode; +import com.android.ide.common.api.INodeHandler; +import com.android.ide.common.api.IViewRule; +import com.android.ide.common.api.InsertType; +import com.android.ide.common.api.MenuAction; + +import java.util.List; + +/** + * An {@link IViewRule} for android.widget.EditText. + */ +public class EditTextRule extends BaseViewRule { + + @Override + public void onCreate(INode node, INode parent, InsertType insertType) { + super.onCreate(node, parent, insertType); + + if (parent != null) { + INode focus = findFocus(findRoot(parent)); + if (focus == null) { + // Add <requestFocus> + node.appendChild(REQUEST_FOCUS); + } + } + } + + /** + * {@inheritDoc} + * <p> + * Adds a "Request Focus" menu item. + */ + @Override + public List<MenuAction> getContextMenu(final INode selectedNode) { + final boolean hasFocus = hasFocus(selectedNode); + final String label = hasFocus ? "Clear Focus" : "Request Focus"; + + IMenuCallback onChange = new IMenuCallback() { + public void action(MenuAction menuAction, String valueId, Boolean newValue) { + selectedNode.editXml(label, new INodeHandler() { + public void handle(INode node) { + INode focus = findFocus(findRoot(node)); + if (focus != null && focus.getParent() != null) { + focus.getParent().removeChild(focus); + } + if (!hasFocus) { + node.appendChild(REQUEST_FOCUS); + } + } + }); + } + }; + + return concatenate(super.getContextMenu(selectedNode), + new MenuAction.Action("_setfocus", label, null, onChange)); //$NON-NLS-1$ + } + + /** Returns true if the given node currently has focus */ + private static boolean hasFocus(INode node) { + INode focus = findFocus(node); + if (focus != null) { + return focus.getParent() == node; + } + + return false; + } + + /** Returns the root/top level node in the view hierarchy that contains the given node */ + private static INode findRoot(INode node) { + // First find the parent + INode root = node; + while (root != null) { + INode parent = root.getParent(); + if (parent == null) { + break; + } else { + root = parent; + } + } + + return root; + } + + /** Finds the focus node (not the node containing focus, but the actual request focus node + * under a given node */ + private static INode findFocus(INode node) { + if (node.getFqcn().equals(REQUEST_FOCUS)) { + return node; + } + + for (INode child : node.getChildren()) { + INode focus = findFocus(child); + if (focus != null) { + return focus; + } + } + return null; + } + +} diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/LayoutConstants.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/LayoutConstants.java index f88e7ab..bb04498 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/LayoutConstants.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/LayoutConstants.java @@ -29,10 +29,10 @@ import com.android.sdklib.SdkConstants; * </ul> */ public class LayoutConstants { - /** The element name in a <code><view class="..."></code> element. */ + /** The element name in a {@code <view class="...">} element. */ public static final String VIEW = "view"; //$NON-NLS-1$ - /** The attribute name in a <code><view class="..."></code> element. */ + /** The attribute name in a {@code <view class="...">} element. */ public static final String ATTR_CLASS = "class"; //$NON-NLS-1$ public static final String ATTR_ON_CLICK = "onClick"; //$NON-NLS-1$ diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/descriptors/DescriptorsUtils.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/descriptors/DescriptorsUtils.java index 0384ad5..c7bc5a1 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/descriptors/DescriptorsUtils.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/descriptors/DescriptorsUtils.java @@ -32,6 +32,7 @@ import static com.android.ide.common.layout.LayoutConstants.NEW_ID_PREFIX; import static com.android.ide.common.layout.LayoutConstants.RELATIVE_LAYOUT; import static com.android.ide.common.layout.LayoutConstants.VALUE_FILL_PARENT; import static com.android.ide.common.layout.LayoutConstants.VALUE_WRAP_CONTENT; +import static com.android.ide.eclipse.adt.internal.editors.layout.descriptors.LayoutDescriptors.REQUEST_FOCUS; import com.android.ide.common.api.IAttributeInfo.Format; import com.android.ide.common.resources.platform.AttributeInfo; @@ -699,6 +700,12 @@ public final class DescriptorsUtils { // if this ui_node is a layout and we're adding it to a document, use match_parent for // both W/H. Otherwise default to wrap_layout. ElementDescriptor descriptor = node.getDescriptor(); + + if (descriptor.getXmlLocalName().equals(REQUEST_FOCUS)) { + // Don't add ids etc to <requestFocus> + return; + } + boolean fill = descriptor.hasChildren() && node.getUiParent() instanceof UiDocumentNode; node.setAttributeValue( diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/descriptors/LayoutDescriptors.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/descriptors/LayoutDescriptors.java index b61c069..4613492 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/descriptors/LayoutDescriptors.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/descriptors/LayoutDescriptors.java @@ -42,20 +42,27 @@ import java.util.Map.Entry; public final class LayoutDescriptors implements IDescriptorProvider { /** - * The XML name of the special <include> layout tag. + * The XML name of the special {@code <include>} layout tag. * A synthetic element with that name is created as part of the view descriptors list * returned by {@link #getViewDescriptors()}. */ public static final String VIEW_INCLUDE = "include"; //$NON-NLS-1$ /** - * The XML name of the special <merge> layout tag. + * The XML name of the special {@code <merge>} layout tag. * A synthetic element with that name is created as part of the view descriptors list * returned by {@link #getViewDescriptors()}. */ public static final String VIEW_MERGE = "merge"; //$NON-NLS-1$ /** + * The XML name of the special {@code <requestFocus>} layout tag. + * A synthetic element with that name is created as part of the view descriptors list + * returned by {@link #getViewDescriptors()}. + */ + public static final String REQUEST_FOCUS = "requestFocus";//$NON-NLS-1$ + + /** * The attribute name of the include tag's url naming the resource to be inserted * <p> * <b>NOTE</b>: The layout attribute is NOT in the Android namespace! @@ -174,6 +181,10 @@ public final class LayoutDescriptors implements IDescriptorProvider { fixSuperClasses(infoDescMap); + ViewElementDescriptor requestFocus = createRequestFocus(); + newViews.add(requestFocus); + newDescriptors.add(requestFocus); + // The <merge> tag can only be a root tag, so it is added at the end. // It gets everything else as children but it is not made a child itself. ViewElementDescriptor mergeTag = createMerge(newLayouts); @@ -342,7 +353,7 @@ public final class LayoutDescriptors implements IDescriptorProvider { } /** - * Creates and return a new <merge> descriptor. + * Creates and return a new {@code <merge>} descriptor. * @param knownLayouts A list of all known layout view descriptors, used to find the * FrameLayout descriptor and extract its layout attributes. */ @@ -368,6 +379,27 @@ public final class LayoutDescriptors implements IDescriptorProvider { } /** + * Creates and return a new {@code <requestFocus>} descriptor. + * @param knownLayouts A list of all known layout view descriptors, used to find the + * FrameLayout descriptor and extract its layout attributes. + */ + private ViewElementDescriptor createRequestFocus() { + String xml_name = REQUEST_FOCUS; + + // Create the include descriptor + return new ViewElementDescriptor( + xml_name, // xml_name + xml_name, // ui_name + xml_name, // "class name"; the GLE only treats this as an element tag + "Requests focus for the parent element or one of its descendants", // tooltip + null, // sdk_url + null, // attributes + null, // layout attributes + null, // children + false /* mandatory */); + } + + /** * Finds the descriptor and retrieves all its layout attributes. */ private AttributeDescriptor[] findViewLayoutAttributes( diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/CustomViewFinder.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/CustomViewFinder.java index 02a674c..3226a02 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/CustomViewFinder.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/CustomViewFinder.java @@ -36,7 +36,7 @@ import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jdt.core.Flags; import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IMember; +import org.eclipse.jdt.core.IMethod; import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.JavaModelException; @@ -189,6 +189,11 @@ public class CustomViewFinder { SearchRequestor requestor = new SearchRequestor() { @Override public void acceptSearchMatch(SearchMatch match) throws CoreException { + // Ignore matches in comments + if (match.isInsideDocComment()) { + return; + } + Object element = match.getElement(); if (element instanceof ResolvedBinaryType) { // Third party view @@ -228,15 +233,16 @@ public class CustomViewFinder { IJavaProject javaProject = BaseProjectHelper.getJavaProject(mProject); if (javaProject != null) { String className = layoutsOnly ? CLASS_VIEWGROUP : CLASS_VIEW; - IType activityType = javaProject.findType(className); - if (activityType != null) { - IJavaSearchScope scope = SearchEngine.createHierarchyScope(activityType); + IType viewType = javaProject.findType(className); + if (viewType != null) { + IJavaSearchScope scope = SearchEngine.createHierarchyScope(viewType); SearchParticipant[] participants = new SearchParticipant[] { SearchEngine.getDefaultSearchParticipant() }; int matchRule = SearchPattern.R_PATTERN_MATCH | SearchPattern.R_CASE_SENSITIVE; + SearchPattern pattern = SearchPattern.createPattern("*", - IJavaSearchConstants.CLASS, IJavaSearchConstants.DECLARATIONS, + IJavaSearchConstants.CLASS, IJavaSearchConstants.IMPLEMENTORS, matchRule); SearchEngine engine = new SearchEngine(); engine.search(pattern, participants, scope, requestor, @@ -261,16 +267,68 @@ public class CustomViewFinder { * list of custom views or third party views. It checks that the view is public and * not abstract for example. */ - private static boolean isValidView(IMember member, boolean layoutsOnly) + private static boolean isValidView(IType type, boolean layoutsOnly) throws JavaModelException { - int flags = member.getFlags(); + // Skip anonymous classes + if (type.isAnonymous()) { + return false; + } + int flags = type.getFlags(); if (Flags.isAbstract(flags) || !Flags.isPublic(flags)) { return false; } // TODO: if (layoutsOnly) perhaps try to filter out AdapterViews and other ViewGroups // not willing to accept children via XML - return true; + + // See if the class has one of the acceptable constructors + // needed for XML instantiation: + // View(Context context) + // View(Context context, AttributeSet attrs) + // View(Context context, AttributeSet attrs, int defStyle) + // We don't simply do three direct checks via type.getMethod() because the types + // are not resolved, so we don't know for each parameter if we will get the + // fully qualified or the unqualified class names. + // Instead, iterate over the methods and look for a match. + String typeName = type.getElementName(); + for (IMethod method : type.getMethods()) { + // Only care about constructors + if (!method.getElementName().equals(typeName)) { + continue; + } + + String[] parameterTypes = method.getParameterTypes(); + if (parameterTypes == null || parameterTypes.length < 1 || parameterTypes.length > 3) { + continue; + } + + String first = parameterTypes[0]; + // Look for the parameter type signatures -- produced by + // JDT's Signature.createTypeSignature("Context", false /*isResolved*/);. + // This is not a typo; they were copy/pasted from the actual parameter names + // observed in the debugger examining these data structures. + if (first.equals("QContext;") //$NON-NLS-1$ + || first.equals("Qandroid.content.Context;")) { //$NON-NLS-1$ + if (parameterTypes.length == 1) { + return true; + } + String second = parameterTypes[1]; + if (second.equals("QAttributeSet;") //$NON-NLS-1$ + || second.equals("Qandroid.util.AttributeSet;")) { //$NON-NLS-1$ + if (parameterTypes.length == 2) { + return true; + } + String third = parameterTypes[2]; + if (third.equals("I")) { //$NON-NLS-1$ + if (parameterTypes.length == 3) { + return true; + } + } + } + } + } + + return false; } /** diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutCanvas.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutCanvas.java index e7f8b84..c87b669 100755 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutCanvas.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutCanvas.java @@ -886,10 +886,23 @@ public class LayoutCanvas extends Canvas { private void showInclude(String url) { GraphicalEditorPart graphicalEditor = mLayoutEditor.getGraphicalEditor(); IPath filePath = graphicalEditor.findResourceFile(url); + if (filePath == null) { + // Should not be possible - if the URL had been bad, then we wouldn't + // have been able to render the scene and you wouldn't have been able + // to click on it + return; + } + + // Save the including file, if necessary: without it, the "Show Included In" + // facility which is invoked automatically will not work properly if the <include> + // tag is not in the saved version of the file, since the outer file is read from + // disk rather than from memory. + IEditorSite editorSite = graphicalEditor.getEditorSite(); + IWorkbenchPage page = editorSite.getPage(); + page.saveEditor(mLayoutEditor, false); IWorkspaceRoot workspace = ResourcesPlugin.getWorkspace().getRoot(); IPath workspacePath = workspace.getLocation(); - IEditorSite editorSite = graphicalEditor.getEditorSite(); if (workspacePath.isPrefixOf(filePath)) { IPath relativePath = filePath.makeRelativeTo(workspacePath); IResource xmlFile = workspace.findMember(relativePath); @@ -944,7 +957,6 @@ public class LayoutCanvas extends Canvas { IFileStore fileStore = EFS.getLocalFileSystem().getStore(filePath); // fileStore = fileStore.getChild(names[i]); if (!fileStore.fetchInfo().isDirectory() && fileStore.fetchInfo().exists()) { - IWorkbenchPage page = editorSite.getWorkbenchWindow().getActivePage(); try { IDE.openEditorOnFileStore(page, fileStore); return; diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutMetadata.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutMetadata.java index 07e11e6..2bfa841 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutMetadata.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutMetadata.java @@ -86,11 +86,6 @@ public class LayoutMetadata { try { IModelManager modelManager = StructuredModelManager.getModelManager(); model = modelManager.getExistingModelForRead(document); - if (model instanceof IDOMModel) { - IDOMModel domModel = (IDOMModel) model; - Document domDocument = domModel.getDocument(); - assert domDocument == node.getOwnerDocument(); - } Node comment = findComment(node); if (comment != null) { diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PaletteControl.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PaletteControl.java index e4b1890..2227531 100755 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PaletteControl.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PaletteControl.java @@ -23,14 +23,14 @@ import static com.android.ide.common.layout.LayoutConstants.ATTR_TEXT; import static com.android.ide.common.layout.LayoutConstants.VALUE_WRAP_CONTENT; import com.android.ide.common.api.InsertType; -import com.android.ide.common.api.Rect; import com.android.ide.common.api.MenuAction.Toggle; +import com.android.ide.common.api.Rect; import com.android.ide.common.rendering.LayoutLibrary; import com.android.ide.common.rendering.api.Capability; import com.android.ide.common.rendering.api.LayoutLog; import com.android.ide.common.rendering.api.RenderSession; -import com.android.ide.common.rendering.api.ViewInfo; import com.android.ide.common.rendering.api.SessionParams.RenderingMode; +import com.android.ide.common.rendering.api.ViewInfo; import com.android.ide.eclipse.adt.AdtPlugin; import com.android.ide.eclipse.adt.internal.editors.IconFactory; import com.android.ide.eclipse.adt.internal.editors.descriptors.DescriptorsUtils; @@ -562,6 +562,13 @@ public class PaletteControl extends Composite { for (final String fqcn : allViews) { CustomViewDescriptorService service = CustomViewDescriptorService.getInstance(); ViewElementDescriptor desc = service.getDescriptor(mEditor.getProject(), fqcn); + if (desc == null) { + // The descriptor lookup performs validation steps of the class, and may + // in some cases determine that this is not a view and will return null; + // guard against that. + continue; + } + Control item = createItem(parent, desc); // Add control-click listener on custom view items to you can warp to @@ -1118,9 +1125,11 @@ public class PaletteControl extends Composite { final static int TOGGLE_ALPHABETICAL = 2; final static int TOGGLE_AUTO_CLOSE = 3; final static int REFRESH = 4; + final static int RESET = 5; ToggleViewOptionAction(String title, int action, boolean checked) { - super(title, action == REFRESH ? IAction.AS_PUSH_BUTTON : IAction.AS_CHECK_BOX); + super(title, (action == REFRESH || action == RESET) ? IAction.AS_PUSH_BUTTON + : IAction.AS_CHECK_BOX); mAction = action; if (checked) { setChecked(checked); @@ -1146,6 +1155,13 @@ public class PaletteControl extends Composite { mPreviewIconFactory.refresh(); refreshPalette(); break; + case RESET: + mAlphabetical = false; + mCategories = true; + mAutoClose = true; + mPaletteMode = PaletteMode.SMALL_PREVIEW; + refreshPalette(); + break; } savePaletteMode(); } @@ -1190,6 +1206,11 @@ public class PaletteControl extends Composite { manager.add(new ToggleViewOptionAction("Auto Close Previous", ToggleViewOptionAction.TOGGLE_AUTO_CLOSE, mAutoClose)); + manager.add(new Separator()); + manager.add(new ToggleViewOptionAction("Reset", + ToggleViewOptionAction.RESET, + false)); + Menu menu = manager.createContextMenu(PaletteControl.this); menu.setLocation(x, y); menu.setVisible(true); diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/SelectionManager.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/SelectionManager.java index 3fdbe5a..c5a840b 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/SelectionManager.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/SelectionManager.java @@ -594,10 +594,11 @@ public class SelectionManager implements ISelectionProvider { public void selectSameType() { // Find all if (mSelections.size() == 1) { + CanvasViewInfo viewInfo = mSelections.get(0).getViewInfo(); + ElementDescriptor descriptor = viewInfo.getUiViewNode().getDescriptor(); mSelections.clear(); mAltSelection = null; - addSameType(mCanvas.getViewHierarchy().getRoot(), - mSelections.get(0).getViewInfo().getUiViewNode().getDescriptor()); + addSameType(mCanvas.getViewHierarchy().getRoot(), descriptor); fireSelectionChanged(); redraw(); } diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gre/extra-view-metadata.xml b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gre/extra-view-metadata.xml index 0870f69..442b76c 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gre/extra-view-metadata.xml +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gre/extra-view-metadata.xml @@ -298,6 +298,9 @@ <category name="Advanced"> <view + class="requestFocus" + render="skip" /> + <view class="android.view.View" render="skip" /> <view diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/ExtractStyleRefactoring.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/ExtractStyleRefactoring.java index 9e8114a..d8dfe86 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/ExtractStyleRefactoring.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/ExtractStyleRefactoring.java @@ -21,7 +21,9 @@ import static com.android.ide.common.layout.LayoutConstants.ANDROID_NS_NAME_PREF import static com.android.ide.common.layout.LayoutConstants.ANDROID_URI; import static com.android.ide.common.layout.LayoutConstants.ATTR_HINT; import static com.android.ide.common.layout.LayoutConstants.ATTR_ID; +import static com.android.ide.common.layout.LayoutConstants.ATTR_LAYOUT_MARGIN; import static com.android.ide.common.layout.LayoutConstants.ATTR_LAYOUT_PREFIX; +import static com.android.ide.common.layout.LayoutConstants.ATTR_ON_CLICK; import static com.android.ide.common.layout.LayoutConstants.ATTR_SRC; import static com.android.ide.common.layout.LayoutConstants.ATTR_STYLE; import static com.android.ide.common.layout.LayoutConstants.ATTR_TEXT; @@ -247,8 +249,12 @@ public class ExtractStyleRefactoring extends VisualRefactoring { String name = attribute.getLocalName(); if (name == null || name.equals(ATTR_ID) || name.startsWith(ATTR_STYLE) - || name.startsWith(ATTR_LAYOUT_PREFIX) || name.equals(ATTR_TEXT) - || name.equals(ATTR_HINT) || name.equals(ATTR_SRC)) { + || (name.startsWith(ATTR_LAYOUT_PREFIX) && + !name.startsWith(ATTR_LAYOUT_MARGIN)) + || name.equals(ATTR_TEXT) + || name.equals(ATTR_HINT) + || name.equals(ATTR_SRC) + || name.equals(ATTR_ON_CLICK)) { // Don't offer to extract attributes that don't make sense in // styles (like "id" or "style"), or attributes that the user // probably does not want to define in styles (like layout diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchController.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchController.java index 930e8de..4db603e 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchController.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchController.java @@ -44,9 +44,8 @@ import com.android.prefs.AndroidLocation.AndroidLocationException; import com.android.sdklib.AndroidVersion; import com.android.sdklib.IAndroidTarget; import com.android.sdklib.NullSdkLog; -import com.android.sdklib.SdkConstants; +import com.android.sdklib.internal.avd.AvdInfo; import com.android.sdklib.internal.avd.AvdManager; -import com.android.sdklib.internal.avd.AvdManager.AvdInfo; import com.android.sdklib.xml.ManifestData; import org.eclipse.core.resources.IFile; diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/DeviceChooserDialog.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/DeviceChooserDialog.java index a9c8af8..b0dfea3 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/DeviceChooserDialog.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/DeviceChooserDialog.java @@ -29,7 +29,7 @@ import com.android.ide.eclipse.adt.internal.sdk.Sdk; import com.android.ide.eclipse.ddms.DdmsPlugin; import com.android.sdklib.AndroidVersion; import com.android.sdklib.IAndroidTarget; -import com.android.sdklib.internal.avd.AvdManager.AvdInfo; +import com.android.sdklib.internal.avd.AvdInfo; import com.android.sdkuilib.internal.widgets.AvdSelector; import com.android.sdkuilib.internal.widgets.AvdSelector.DisplayMode; import com.android.sdkuilib.internal.widgets.AvdSelector.IAvdFilter; diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/EmulatorConfigTab.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/EmulatorConfigTab.java index 3705cc2..1fc72fb 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/EmulatorConfigTab.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/EmulatorConfigTab.java @@ -26,8 +26,8 @@ import com.android.ide.eclipse.adt.internal.sdk.Sdk; import com.android.prefs.AndroidLocation.AndroidLocationException; import com.android.sdklib.IAndroidTarget; import com.android.sdklib.NullSdkLog; +import com.android.sdklib.internal.avd.AvdInfo; import com.android.sdklib.internal.avd.AvdManager; -import com.android.sdklib.internal.avd.AvdManager.AvdInfo; import com.android.sdkuilib.internal.widgets.AvdSelector; import com.android.sdkuilib.internal.widgets.AvdSelector.DisplayMode; |