aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/LayoutEditorMatchingStrategy.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/LayoutEditorMatchingStrategy.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/LayoutEditorMatchingStrategy.java
index 6a6b99c..4ea49f9 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/LayoutEditorMatchingStrategy.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/LayoutEditorMatchingStrategy.java
@@ -42,7 +42,8 @@ public class LayoutEditorMatchingStrategy implements IEditorMatchingStrategy {
// get the IFile object and check it's in one of the layout folders.
IFile iFile = fileInput.getFile();
- ResourceFolder resFolder = ResourceManager.getInstance().getResourceFolder(iFile);
+ ResourceManager manager = ResourceManager.getInstance();
+ ResourceFolder resFolder = manager.getResourceFolder(iFile);
// Per the IEditorMatchingStrategy documentation, editorRef.getEditorInput()
// is expensive so try exclude files that definitely don't match, such
@@ -61,6 +62,12 @@ public class LayoutEditorMatchingStrategy implements IEditorMatchingStrategy {
FileEditorInput editorFileInput = (FileEditorInput)editorInput;
IFile editorIFile = editorFileInput.getFile();
+ ResourceFolder editorFolder = manager.getResourceFolder(editorIFile);
+ if (editorFolder == null
+ || editorFolder.getType() != ResourceFolderType.LAYOUT) {
+ return false;
+ }
+
return editorIFile.getProject().equals(iFile.getProject())
&& editorIFile.getName().equals(iFile.getName());
}