Author: vrubezhny
Date: 2009-05-04 10:02:48 -0400 (Mon, 04 May 2009)
New Revision: 15004
Modified:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/Messages.properties
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/SeamExtMessages.java
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamComponentHyperlink.java
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamComponentHyperlinkDetector.java
Log:
JBIDE-4068 Add option (Open On) to open the correspondent Seam component when we have a
@In annotation in a field and click on the field name.
The hyperlink description format and contents is changed.
Modified:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/Messages.properties
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/Messages.properties 2009-05-04
13:27:08 UTC (rev 15003)
+++
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/Messages.properties 2009-05-04
14:02:48 UTC (rev 15004)
@@ -1,5 +1,6 @@
-OpenSeamDeclarationAs=Open Declaration of Seam {1} for ''{0}''
-SeamComponent=Component
-SeamRole=Role
-SeamFactory=Factory
-SeamBijected=Bijected Attribute
+OpenSeamDeclarationAs=Open Declaration of {1} for ''{0}'' {2}
+InResource=in ''{0}''
+SeamComponent=Seam Component
+SeamRole=@Role/@Roles
+SeamFactory=Seam Factory
+SeamBijected=@Out/@DataModel
Modified:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/SeamExtMessages.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/SeamExtMessages.java 2009-05-04
13:27:08 UTC (rev 15003)
+++
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/SeamExtMessages.java 2009-05-04
14:02:48 UTC (rev 15004)
@@ -21,6 +21,7 @@
private static final String BUNDLE_NAME =
"org.jboss.tools.seam.text.ext.Messages"; //$NON-NLS-1$
public static String OpenSeamDeclarationAs;
+ public static String InResource;
public static String SeamComponent;
public static String SeamRole;
public static String SeamFactory;
Modified:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamComponentHyperlink.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamComponentHyperlink.java 2009-05-04
13:27:08 UTC (rev 15003)
+++
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamComponentHyperlink.java 2009-05-04
14:02:48 UTC (rev 15004)
@@ -26,6 +26,7 @@
import org.jboss.tools.seam.core.IRole;
import org.jboss.tools.seam.core.ISeamComponent;
import org.jboss.tools.seam.core.ISeamComponentDeclaration;
+import org.jboss.tools.seam.core.ISeamContextVariable;
import org.jboss.tools.seam.core.ISeamJavaComponentDeclaration;
import org.jboss.tools.seam.text.ext.SeamExtMessages;
import org.jboss.tools.seam.text.ext.SeamExtPlugin;
@@ -38,6 +39,7 @@
public class SeamComponentHyperlink implements IHyperlink {
private IRegion fRegion;
+ private ISeamContextVariable fVariable;
private IJavaElement fElement;
private IOpenableElement fOpenable;
private String fLabel;
@@ -46,12 +48,14 @@
/**
* Creates a new Seam Component hyperlink.
*/
- SeamComponentHyperlink(IRegion region, IJavaElement element, String name) {
+ SeamComponentHyperlink(IRegion region, ISeamContextVariable variable, IJavaElement
element, String name) {
Assert.isNotNull(region);
+ Assert.isNotNull(variable);
Assert.isNotNull(element);
Assert.isNotNull(name);
fRegion = region;
+ fVariable = variable;
fElement = element;
fOpenable = null;
fLabel = SeamExtMessages.SeamFactory;
@@ -61,12 +65,14 @@
/**
* Creates a new Seam Component hyperlink.
*/
- SeamComponentHyperlink(IRegion region, ISeamComponent element, String name) {
+ SeamComponentHyperlink(IRegion region, ISeamContextVariable variable, ISeamComponent
element, String name) {
Assert.isNotNull(region);
+ Assert.isNotNull(variable);
Assert.isNotNull(element);
Assert.isNotNull(name);
fRegion = region;
+ fVariable = variable;
fElement = null;
fLabel = SeamExtMessages.SeamComponent;
fName = name;
@@ -89,12 +95,14 @@
/**
* Creates a new Seam Component hyperlink.
*/
- SeamComponentHyperlink(IRegion region, IBijectedAttribute element, String name) {
+ SeamComponentHyperlink(IRegion region, ISeamContextVariable variable, IBijectedAttribute
element, String name) {
Assert.isNotNull(region);
+ Assert.isNotNull(variable);
Assert.isNotNull(element);
Assert.isNotNull(name);
fRegion = region;
+ fVariable = variable;
fElement = element.getSourceMember();
fLabel = SeamExtMessages.SeamBijected;
fName = name;
@@ -104,13 +112,15 @@
/**
* Creates a new Seam Component hyperlink.
*/
- SeamComponentHyperlink(IRegion region, IRole element, String name) {
+ SeamComponentHyperlink(IRegion region, ISeamContextVariable variable, IRole element,
String name) {
Assert.isNotNull(region);
+ Assert.isNotNull(variable);
Assert.isNotNull(element);
Assert.isTrue(element instanceof IOpenableElement);
Assert.isNotNull(name);
fRegion = region;
+ fVariable = variable;
fElement = null;
fOpenable = (IOpenableElement)element;
fLabel = SeamExtMessages.SeamRole;
@@ -165,7 +175,15 @@
* @see IHyperlink#getHyperlinkText()
*/
public String getHyperlinkText() {
- return MessageFormat.format(SeamExtMessages.OpenSeamDeclarationAs, fName, fLabel);
+ String formattedIn = "";
+ if (fVariable.getResource() != null) {
+ String resourceName = fVariable.getResource().getName();
+
+ if (resourceName != null && resourceName.trim().length() > 0) {
+ formattedIn = MessageFormat.format(SeamExtMessages.InResource, resourceName);
+ }
+ }
+ return MessageFormat.format(SeamExtMessages.OpenSeamDeclarationAs, fName, fLabel,
formattedIn);
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamComponentHyperlinkDetector.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamComponentHyperlinkDetector.java 2009-05-04
13:27:08 UTC (rev 15003)
+++
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamComponentHyperlinkDetector.java 2009-05-04
14:02:48 UTC (rev 15004)
@@ -170,17 +170,18 @@
}
if (javaElements != null) {
for (IJavaElement javaElement : javaElements) {
- hyperlinks.add(new SeamComponentHyperlink(wordRegion, javaElement,
nameToSearch));
+ hyperlinks.add(new SeamComponentHyperlink(wordRegion, var, javaElement,
nameToSearch));
}
}
} else if (var instanceof ISeamComponent) {
- hyperlinks.add(new SeamComponentHyperlink(wordRegion, (ISeamComponent)var,
nameToSearch));
+ var.getResource().getName();
+ hyperlinks.add(new SeamComponentHyperlink(wordRegion, var, (ISeamComponent)var,
nameToSearch));
} else if (var instanceof IRole) {
- hyperlinks.add(new SeamComponentHyperlink(wordRegion, (IRole)var,
nameToSearch));
+ hyperlinks.add(new SeamComponentHyperlink(wordRegion, var, (IRole)var,
nameToSearch));
} else if (var instanceof IBijectedAttribute) {
IBijectedAttribute attr = (IBijectedAttribute)var;
if (attr.getSourceMember() != null) {
- hyperlinks.add(new SeamComponentHyperlink(wordRegion, (IBijectedAttribute)var,
nameToSearch));
+ hyperlinks.add(new SeamComponentHyperlink(wordRegion, var,
(IBijectedAttribute)var, nameToSearch));
}
}
}