diff options
author | Tor Norbye <tnorbye@google.com> | 2012-05-29 17:30:18 -0700 |
---|---|---|
committer | android code review <noreply-gerritcodereview@google.com> | 2012-05-29 17:30:19 -0700 |
commit | 18bde5c3eac6a0605a94b306192d6643a3100bd5 (patch) | |
tree | 5d5e3a2c38250771ada3b2edd31be55618168d41 | |
parent | 522dfc0bcd494aab505b3ae605d9ddb39725f6b1 (diff) | |
parent | dcd506c6482e7476941a6d4c14b6dd5eb51c85f9 (diff) | |
download | sdk-18bde5c3eac6a0605a94b306192d6643a3100bd5.zip sdk-18bde5c3eac6a0605a94b306192d6643a3100bd5.tar.gz sdk-18bde5c3eac6a0605a94b306192d6643a3100bd5.tar.bz2 |
Merge "Fix LayoutEditorMatchingStrategy to handle non-layout files"
-rw-r--r-- | eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/LayoutEditorMatchingStrategy.java | 9 |
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()); } |