Author: scabanovich
Date: 2007-09-24 11:16:53 -0400 (Mon, 24 Sep 2007)
New Revision: 3771
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamReferencedFilter.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
Log:
JBIDE-935
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2007-09-24 15:01:26 UTC (rev
3770)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2007-09-24 15:16:53 UTC (rev
3771)
@@ -144,6 +144,7 @@
<includes>
<contentExtension pattern="org.jboss.tools.seam.ui.views.rootContent"
/>
<contentExtension
pattern="org.jboss.tools.seam.ui.views.SeamJarFilter"/>
+ <contentExtension
pattern="org.jboss.tools.seam.ui.views.SeamReferencedFilter"/>
<contentExtension
pattern="org.jboss.tools.seam.ui.views.SeamLinkHelper"/>
</includes>
</viewerContentBinding>
@@ -193,6 +194,13 @@
id="org.jboss.tools.seam.ui.views.SeamJarFilter"
name="Seam Components from Libraries"
activeByDefault="true"/>
+
+ <commonFilter
+ class="org.jboss.tools.seam.ui.views.SeamReferencedFilter"
+ description="Hide Seam Components loaded from referenced projects and
not overriden in project"
+ id="org.jboss.tools.seam.ui.views.SeamReferencedFilter"
+ name="Seam Components from Referenced Projects"
+ activeByDefault="true"/>
</extension>
<extension point="org.eclipse.ui.navigator.viewer">
@@ -200,6 +208,7 @@
<includes>
<contentExtension pattern="org.jboss.tools.seam.ui.views.projectContent"
/>
<contentExtension
pattern="org.jboss.tools.seam.ui.views.SeamJarFilter"/>
+ <contentExtension
pattern="org.jboss.tools.seam.ui.views.SeamReferencedFilter"/>
</includes>
</viewerContentBinding>
</extension>
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamReferencedFilter.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamReferencedFilter.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamReferencedFilter.java 2007-09-24
15:16:53 UTC (rev 3771)
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.ui.views;
+
+import java.util.Set;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.jboss.tools.seam.core.ISeamComponent;
+import org.jboss.tools.seam.core.ISeamComponentDeclaration;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class SeamReferencedFilter extends ViewerFilter {
+
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if(element instanceof ISeamComponent) {
+ ISeamComponent component = (ISeamComponent)element;
+ Set<ISeamComponentDeclaration> ds = component.getAllDeclarations();
+ for (ISeamComponentDeclaration d : ds) {
+ IResource r = d.getResource();
+ if(r == null || !r.exists()) {
+ //do not filter out the component if we cannot be sure that
+ //its source is another project
+ return true;
+ }
+ if(r != null && r.getProject() == d.getSeamProject().getProject()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ return true;
+ }
+
+}