Author: scabanovich
Date: 2007-08-21 04:30:10 -0400 (Tue, 21 Aug 2007)
New Revision: 3246
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/SeamLinkHelper.java
Log:
JBIDE-669 Added link to class files.
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2007-08-21 08:16:01 UTC (rev
3245)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2007-08-21 08:30:10 UTC (rev
3246)
@@ -223,7 +223,10 @@
</or>
</selectionEnablement>
<editorInputEnablement>
+ <or>
<instanceof value="org.eclipse.ui.IFileEditorInput"/>
+ <instanceof
value="org.eclipse.jdt.internal.ui.javaeditor.IClassFileEditorInput"/>
+ </or>
</editorInputEnablement>
</linkHelper>
</extension>
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLinkHelper.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLinkHelper.java 2007-08-21
08:16:01 UTC (rev 3245)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLinkHelper.java 2007-08-21
08:30:10 UTC (rev 3246)
@@ -15,6 +15,11 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IClassFile;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.internal.ui.javaeditor.IClassFileEditorInput;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ui.IEditorInput;
@@ -27,6 +32,7 @@
import org.jboss.tools.seam.core.ISeamComponent;
import org.jboss.tools.seam.core.ISeamComponentDeclaration;
import org.jboss.tools.seam.core.ISeamElement;
+import org.jboss.tools.seam.core.ISeamJavaComponentDeclaration;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCorePlugin;
@@ -61,6 +67,21 @@
public IStructuredSelection findSelection(IEditorInput anInput) {
IFile file = ResourceUtil.getFile(anInput);
+ if(anInput instanceof IClassFileEditorInput) {
+ IClassFile cf = ((IClassFileEditorInput)anInput).getClassFile();
+ IJavaProject jp = cf.getJavaProject();
+ ISeamProject seamProject = SeamCorePlugin.getSeamProject(jp.getProject(), true);
+ if(seamProject == null) return null;
+ IType type = cf.getType();
+ Set<ISeamComponent> cs = seamProject.getComponents();
+ for (ISeamComponent c : cs) {
+ ISeamJavaComponentDeclaration d = c.getJavaDeclaration();
+ IMember m = d.getSourceMember();
+ if(m == type)
+ return new StructuredSelection(d);
+ }
+ return null;
+ }
ISeamProject seamProject = SeamCorePlugin.getSeamProject(file.getProject(), true);
if(seamProject == null) return null;
Set<ISeamComponent> set = seamProject.getComponentsByPath(file.getFullPath());
Show replies by date