Author: scabanovich
Date: 2008-10-01 11:34:53 -0400 (Wed, 01 Oct 2008)
New Revision: 10602
Modified:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlinkPartitioner.java
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamELInJavaStringHyperlinkDetector.java
Log:
JBIDE-1497.
Refactoring
Modified:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlinkPartitioner.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlinkPartitioner.java 2008-10-01
15:34:23 UTC (rev 10601)
+++
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlinkPartitioner.java 2008-10-01
15:34:53 UTC (rev 10602)
@@ -21,6 +21,8 @@
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.jboss.tools.common.el.core.model.ELExpression;
import org.jboss.tools.common.el.core.model.ELInvocationExpression;
+import org.jboss.tools.common.el.core.resolver.ElVarSearcher;
+import org.jboss.tools.common.el.core.resolver.Var;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperLinkPartitionPriority;
@@ -31,9 +33,7 @@
import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCorePlugin;
-import org.jboss.tools.seam.internal.core.el.ElVarSearcher;
import org.jboss.tools.seam.internal.core.el.SeamELCompletionEngine;
-import org.jboss.tools.seam.internal.core.el.Var;
import org.jboss.tools.seam.text.ext.SeamExtPlugin;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -202,8 +202,10 @@
start = ((IDOMNode)n).getStartOffset();
end = ((IDOMNode)n).getEndOffset();
}
-
- ELInvocationExpression tokens =
SeamELCompletionEngine.findExpressionAtOffset(document, offset, start, end);
+
+ //TODO do we have and need seam project here?
+ SeamELCompletionEngine engine = new SeamELCompletionEngine(null);
+ ELInvocationExpression tokens = engine.findExpressionAtOffset(document, offset, start,
end);
if (tokens == null /*|| tokens.size() == 0*/)
return null; // No EL Operand found
@@ -260,13 +262,14 @@
if (seamProject == null)
return null;
- SeamELCompletionEngine engine= new SeamELCompletionEngine();
+ SeamELCompletionEngine engine = new SeamELCompletionEngine(seamProject);
String prefix = propText;
- ELExpression expr = SeamELCompletionEngine.parseOperand(prefix);
+ ELExpression expr = engine.parseOperand(prefix);
if (expr == null)
return null; // No EL Operand found
-
+ expr.getModel().shift(r.getOffset() - expr.getFirstToken().getStart());
+
List<IJavaElement> javaElements = null;
try {
javaElements = engine.getJavaElementsForELOperandTokens(seamProject, file,
(ELInvocationExpression)expr);
@@ -278,9 +281,10 @@
return null;
}
+ //Do not need it, vars handled in getJavaElementsForELOperandTokens
if (javaElements == null || javaElements.size() == 0) {
// Try to find a local Var (a pair of variable-value attributes)
- ElVarSearcher varSearcher = new ElVarSearcher(seamProject, file, new
SeamELCompletionEngine());
+ ElVarSearcher varSearcher = new ElVarSearcher(file, engine);
// Find a Var in the EL
int start = expr.getStartPosition();
int end = expr.getEndPosition();
@@ -288,11 +292,11 @@
if (expr.getText().length() == 0)
return null;
- List<Var> allVars= ElVarSearcher.findAllVars(file, start);
+ List<Var> allVars= varSearcher.findAllVars(file, start);
Var var = varSearcher.findVarForEl(expr.getText(), allVars, true);
if (var == null) {
// Find a Var in the current offset assuming that it's a node with var/value
attribute pair
- var = ElVarSearcher.findVar(file, start);
+ var = varSearcher.findVar(file, start);
}
if (var == null)
return null;
Modified:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamELInJavaStringHyperlinkDetector.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamELInJavaStringHyperlinkDetector.java 2008-10-01
15:34:23 UTC (rev 10601)
+++
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamELInJavaStringHyperlinkDetector.java 2008-10-01
15:34:53 UTC (rev 10602)
@@ -101,7 +101,7 @@
if (seamProject == null)
return null;
- SeamELCompletionEngine engine= new SeamELCompletionEngine();
+ SeamELCompletionEngine engine = new SeamELCompletionEngine(seamProject);
String prefix= engine.getJavaElementExpression(document, region.getOffset(), region,
start, end);
prefix = (prefix == null ? "" : prefix);
Show replies by date