diff options
author | Christian W. Damus | 2013-03-21 15:52:08 +0000 |
---|---|---|
committer | Christian W. Damus | 2013-03-21 15:52:08 +0000 |
commit | 46b306b8a644667a838b270834a58164b6cfb9b8 (patch) | |
tree | 355f5ee81be7603c2571f9a73e13bb8fef9983c5 | |
parent | 79309747c39c47a16b2108ce7a0e22414a13ecfe (diff) | |
download | cdo-46b306b8a644667a838b270834a58164b6cfb9b8.tar.gz cdo-46b306b8a644667a838b270834a58164b6cfb9b8.tar.xz cdo-46b306b8a644667a838b270834a58164b6cfb9b8.zip |
[404043] Dawn Explorer does not show resources in the view
https://bugs.eclipse.org/bugs/show_bug.cgi?id=404043
-rw-r--r-- | plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/views/DawnItemProvider.java | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/views/DawnItemProvider.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/views/DawnItemProvider.java index 846425bf2b..2a3ee1b5bf 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/views/DawnItemProvider.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/views/DawnItemProvider.java @@ -7,14 +7,14 @@ * * Contributors: * Martin Fluegge - initial API and implementation + * Christian W. Damus (CEA) - bug 404043: contents of views not shown in Dawn Explorer */ package org.eclipse.emf.cdo.dawn.ui.views; import org.eclipse.emf.cdo.dawn.ui.helper.EditorDescriptionHelper; import org.eclipse.emf.cdo.eresource.CDOResource; -import org.eclipse.emf.cdo.eresource.CDOResourceFolder; -import org.eclipse.emf.cdo.session.CDOSession; import org.eclipse.emf.cdo.ui.CDOItemProvider; +import org.eclipse.emf.cdo.view.CDOView; import org.eclipse.net4j.util.ui.views.IElementFilter; @@ -37,25 +37,30 @@ public class DawnItemProvider extends CDOItemProvider @Override public Object[] getChildren(Object element) { - // if (element instanceof CDOView) - // { - // return ((CDOView)element).getRootResource().getContents().toArray(); - // } + Object[] result = super.getChildren(element); - if (element instanceof CDOResourceFolder) + if (result.length > 0 && result[0] instanceof CDOView) { - return ((CDOResourceFolder)element).getNodes().toArray(); - } + // filter the views to show only our view + CDOView ourView = null; + for (int i = 0; i < result.length; i++) + { + if (result[i] == dawnExplorer.getView()) + { + ourView = (CDOView)result[i]; + break; + } + } - if (element instanceof CDOSession) - { - CDOSession session = (CDOSession)element; - Object[] child = new Object[1]; - child[0] = session.getView(dawnExplorer.getView().getViewID()); - return child; + if (ourView != null) + { + result = new Object[] { ourView }; + } // otherwise, we're showing something totally else, so don't worry about it + + return result; } - return super.getChildren(element); + return result; } @Override |