Author: scabanovich
Date: 2007-07-12 07:42:40 -0400 (Thu, 12 Jul 2007)
New Revision: 2398
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions/
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions/SeamActionProvider.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions/SeamOpenAction.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/RootContentProvider.java
Log:
EXIN-218 Added action Open to component sources.
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2007-07-12 11:41:09 UTC (rev
2397)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2007-07-12 11:42:40 UTC (rev
2398)
@@ -89,17 +89,10 @@
</category>
<view
category="org.jboss.tools.seam.ui"
- class="org.jboss.tools.seam.ui.views.SeamComponentsView"
- icon="icons/sample.gif"
- id="org.jboss.tools.seam.ui.views.SeamComponentsView"
- name="Seam Components">
- </view>
- <view
- category="org.jboss.tools.seam.ui"
class="org.eclipse.ui.navigator.CommonNavigator"
icon="icons/sample.gif"
id="org.jboss.tools.seam.ui.views.SeamComponentsNavigator"
- name="Seam Components Navigator">
+ name="Seam Components">
</view>
</extension>
<extension
@@ -125,7 +118,7 @@
<extension point="org.eclipse.ui.navigator.navigatorContent">
<navigatorContent
- name="Seam Root Content Provider"
+ name="Seam Components"
priority="highest"
icon="icons/sample.gif"
activeByDefault="true"
@@ -145,6 +138,15 @@
<instanceof value="org.jboss.tools.seam.core.ISeamElement" />
</or>
</possibleChildren>
+ <actionProvider
+ class="org.jboss.tools.seam.ui.views.actions.SeamActionProvider"
+ id="org.jboss.tools.seam.ui.views.actions.SeamActionProvider">
+ <enablement>
+ <or>
+ <instanceof value="org.jboss.tools.seam.core.ISeamElement"/>
+ </or>
+ </enablement>
+ </actionProvider>
</navigatorContent>
</extension>
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/RootContentProvider.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/RootContentProvider.java 2007-07-12
11:41:09 UTC (rev 2397)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/RootContentProvider.java 2007-07-12
11:42:40 UTC (rev 2398)
@@ -33,7 +33,7 @@
IProject[] ps = root.getProjects();
List<ISeamProject> children = new ArrayList<ISeamProject>();
for (int i = 0; i < ps.length; i++) {
- ISeamProject p = SeamCorePlugin.getSeamProject(ps[i]);
+ ISeamProject p = SeamCorePlugin.getSeamProject(ps[i], false);
if(p != null) {
if(!processed.contains(p)) {
processed.add(p);
@@ -46,6 +46,7 @@
} else if(parentElement instanceof ISeamProject) {
return ((ISeamProject)parentElement).getScopes();
} else if(parentElement instanceof ISeamScope) {
+ ((ISeamScope)parentElement).getSeamProject().resolve();
return ((ISeamScope)parentElement).getComponents().toArray(new Object[0]);
} else if(parentElement instanceof ISeamComponent) {
return ((ISeamComponent)parentElement).getAllDeclarations().toArray(new Object[0]);
@@ -96,7 +97,7 @@
System.out.println("event without source");
}
}
-
+
void refresh(final Object o) {
if(viewer == null || viewer.getControl() == null || viewer.getControl().isDisposed())
return;
if(!(viewer instanceof StructuredViewer)) return;
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions/SeamActionProvider.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions/SeamActionProvider.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions/SeamActionProvider.java 2007-07-12
11:42:40 UTC (rev 2398)
@@ -0,0 +1,31 @@
+package org.jboss.tools.seam.ui.views.actions;
+
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.actions.ActionContext;
+import org.eclipse.ui.navigator.CommonActionProvider;
+import org.jboss.tools.seam.core.IOpenableElement;
+import org.jboss.tools.seam.core.ISeamElement;
+
+public class SeamActionProvider extends CommonActionProvider {
+
+ public SeamActionProvider() {}
+
+ public void fillContextMenu(IMenuManager menu) {
+ ActionContext c = getContext();
+ ISelection s = c.getSelection();
+ if(s == null || s.isEmpty() || !(s instanceof IStructuredSelection)) return;
+ Object e = ((IStructuredSelection)s).getFirstElement();
+ if(e instanceof ISeamElement) {
+ ISeamElement element = (ISeamElement)e;
+
+ if(element instanceof IOpenableElement) {
+ SeamOpenAction action = new SeamOpenAction((IOpenableElement)element);
+ menu.add(action);
+ }
+
+ }
+ }
+
+}
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions/SeamOpenAction.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions/SeamOpenAction.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions/SeamOpenAction.java 2007-07-12
11:42:40 UTC (rev 2398)
@@ -0,0 +1,20 @@
+package org.jboss.tools.seam.ui.views.actions;
+
+import org.eclipse.jface.action.Action;
+import org.jboss.tools.seam.core.IOpenableElement;
+
+public class SeamOpenAction extends Action {
+ IOpenableElement element;
+
+ public SeamOpenAction(IOpenableElement element) {
+ setText("Open");
+ this.element = element;
+ }
+
+ public void run() {
+ if(element != null) {
+ element.open();
+ }
+ }
+
+}
Show replies by date