aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2011-05-04 13:13:42 -0700
committerAndroid Code Review <code-review@android.com>2011-05-04 13:13:42 -0700
commit38cfa124805799bb1ade1cc2b7e49abed3191021 (patch)
tree7ccd36a2a732de0447ef5addbb0fdd9395866857
parent06ded0386ee2dbb9a5ff2b9cf5b44fa7166904b8 (diff)
parent77dfbea08c32e7ff9639230b6660def0620844cf (diff)
downloadsdk-38cfa124805799bb1ade1cc2b7e49abed3191021.zip
sdk-38cfa124805799bb1ade1cc2b7e49abed3191021.tar.gz
sdk-38cfa124805799bb1ade1cc2b7e49abed3191021.tar.bz2
Merge "Merge "Misc fixes"" into tools_r11
-rwxr-xr-xeclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutCanvas.java16
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/SelectionManager.java5
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/ExtractStyleRefactoring.java10
3 files changed, 25 insertions, 6 deletions
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/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/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