Author: dazarov
Date: 2009-03-23 11:31:42 -0400 (Mon, 23 Mar 2009)
New Revision: 14293
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamProjectsSet.java
trunk/seam/plugins/org.jboss.tools.seam.text.ext/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/ComponentsHyperlink.java
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/ComponentsHyperlinkPartitioner.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4002
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamProjectsSet.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamProjectsSet.java 2009-03-23
15:04:39 UTC (rev 14292)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamProjectsSet.java 2009-03-23
15:31:42 UTC (rev 14293)
@@ -208,6 +208,21 @@
}
return getWarProject();
}
+
+ /**
+ * Returns default ear contents folder.
+ * @return
+ */
+ public IContainer getDefaultEarViewsFolder() {
+ IVirtualComponent com = ComponentCore.createComponent(ear);
+ if(com!=null) {
+ IVirtualFolder webRootFolder = com.getRootFolder().getFolder(new Path("/"));
//$NON-NLS-1$
+ if(webRootFolder!=null) {
+ return (IFolder)webRootFolder.getUnderlyingFolder();
+ }
+ }
+ return getWarProject();
+ }
/**
* Returns web contents folder.
Modified: trunk/seam/plugins/org.jboss.tools.seam.text.ext/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.text.ext/plugin.xml 2009-03-23 15:04:39 UTC
(rev 14292)
+++ trunk/seam/plugins/org.jboss.tools.seam.text.ext/plugin.xml 2009-03-23 15:31:42 UTC
(rev 14293)
@@ -214,6 +214,7 @@
<axis path="*/bpm:process-definitions/value/" />
<!-- TODO replace bpm with [
http://jboss.com/products/seam/bpm] -->
<axis path="*/bpm:pageflow-definitions/value/" />
+ <axis path="*/component/property/value/" />
<!-- TODO replace drools with [
http://http://jboss.com/products/seam/drools]
-->
<axis path="*/drools:rule-files/value/" />
</partitionType>
Modified:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/ComponentsHyperlink.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/ComponentsHyperlink.java 2009-03-23
15:04:39 UTC (rev 14292)
+++
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/ComponentsHyperlink.java 2009-03-23
15:31:42 UTC (rev 14293)
@@ -11,9 +11,11 @@
package org.jboss.tools.seam.text.ext.hyperlink;
+import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.Path;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
@@ -27,7 +29,6 @@
public class ComponentsHyperlink extends AbstractHyperlink {
private String hyperlinkText = "";
- private static final String folder = "EarContent/";
private String partitionType = null;
@@ -84,19 +85,40 @@
}
private void doBpmDefinitionHyperlink(IRegion region) {
- IProject earProject = getEarProject();
- if (earProject == null)
- return;
-
- IFile file = earProject.getFile(folder + hyperlinkText);
+ IFile file = findDefinitionFile();
if (file != null)
openFileInEditor(file);
}
-
- private IProject getEarProject() {
+
+ private IFile findDefinitionFile(){
+ IFile file;
SeamProjectsSet projectsSet = SeamProjectsSet.create(getProject());
- return projectsSet.getEarProject();
+ IContainer webContent = projectsSet.getDefaultViewsFolder();
+
+ if(webContent != null){
+ file = webContent.getFile(new Path(hyperlinkText));
+ if(file != null && file.exists())
+ return file;
+ }
+
+ IContainer earContent = projectsSet.getDefaultEarViewsFolder();
+
+ if(earContent != null){
+ file = earContent.getFile(new Path(hyperlinkText));
+ if(file != null && file.exists())
+ return file;
+ }
+
+ IContainer ejbSource = projectsSet.getDefaultEjbSourceFolder();
+
+ if(ejbSource != null){
+ file = ejbSource.getFile(new Path(hyperlinkText));
+ if(file != null && file.exists())
+ return file;
+ }
+
+ return null;
}
private IProject getProject() {
Modified:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/ComponentsHyperlinkPartitioner.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/ComponentsHyperlinkPartitioner.java 2009-03-23
15:04:39 UTC (rev 14292)
+++
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/ComponentsHyperlinkPartitioner.java 2009-03-23
15:31:42 UTC (rev 14293)
@@ -32,6 +32,12 @@
static final String processDefinitionsNodeName = "bpm:process-definitions";
static final String pageflowDefinitionsNodeName = "bpm:pageflow-definitions";
+
+ static final String propertyNodeName = "property";
+ static final String propertyAttributeName = "name";
+
+ static final String propertyAtt1 = "processDefinitions";
+ static final String propertyAtt2 = "pageflowDefinitions";
static final String droolsRuleFileNodeName = "drools:rule-files";
@@ -43,8 +49,7 @@
if (xmlDocument == null)
return null;
- Node node = Utils.findNodeForOffset(xmlDocument, superOffset); // #
- // text
+ Node node = Utils.findNodeForOffset(xmlDocument, superOffset); // #text
return node;
} finally {
@@ -71,6 +76,15 @@
} else if (parentNode.getNodeName().equalsIgnoreCase(
droolsRuleFileNodeName)) {
return DROOLS_RULE_PARTITION;
+ } else if(parentNode.getNodeName().equalsIgnoreCase(
+ propertyNodeName)) {
+ Node attribute = parentNode.getAttributes().getNamedItem(propertyAttributeName);
+ if(attribute != null){
+ if(attribute.getNodeValue().equalsIgnoreCase(propertyAtt1)
+ || attribute.getNodeValue().equalsIgnoreCase(propertyAtt2)){
+ return BPM_DEFINITION_PARTITION;
+ }
+ }
}
}