Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1718)

Unified Diff: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/libraryview/LibraryExplorerPart.java

Issue 9008070: fix for issue 391: File not highlighted in Libraries view sometimes (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/StandardDartElementContentProvider.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/libraryview/LibraryExplorerPart.java
===================================================================
--- editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/libraryview/LibraryExplorerPart.java (revision 2950)
+++ editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/libraryview/LibraryExplorerPart.java (working copy)
@@ -989,16 +989,23 @@
viewer.reveal(element);
} else {
viewer.setSelection(newSelection, true);
-
+ List<ISelection> selectionList = new ArrayList<ISelection>();
while (element != null && viewer.getSelection().isEmpty()) {
// Try to select parent in case element is filtered
+ selectionList.add(newSelection);
element = getParent(element);
if (element != null) {
newSelection = new StructuredSelection(element);
viewer.setSelection(newSelection, true);
}
}
+ for (int i = selectionList.size() - 1; i >= 0; i--) {
+ newSelection = selectionList.get(i);
+ viewer.setSelection(newSelection, true);
+ viewer.reveal(newSelection);
+ }
}
+
return true;
}
return false;
@@ -1131,12 +1138,7 @@
* @return the parent or <code>null</code> if there's no parent
*/
private Object getParent(Object element) {
- if (element instanceof DartElement) {
- return ((DartElement) element).getParent();
- } else if (element instanceof IResource) {
- return ((IResource) element).getParent();
- }
- return null;
+ return contentProvider.getParent(element);
}
private ISelection getSelection() {
« no previous file with comments | « editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/StandardDartElementContentProvider.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698