Author: scabanovich
Date: 2008-10-02 11:17:29 -0400 (Thu, 02 Oct 2008)
New Revision: 10630
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/.classpath
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties
Log:
JBIDE-1497.
Refactoring
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/.classpath
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/.classpath 2008-10-02 15:16:16 UTC (rev
10629)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/.classpath 2008-10-02 15:17:29 UTC (rev
10630)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src"/>
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java 2008-10-02
15:16:16 UTC (rev 10629)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java 2008-10-02
15:17:29 UTC (rev 10630)
@@ -74,27 +74,8 @@
/**
* Create the array of suggestions.
- *
* @param project Seam project
* @param file File
- * @param document
- * @param prefix the prefix to search for
- * @param position Offset of the prefix
- * @param vars - 'var' attributes which can be used in this EL
- * @param start start of relevant region in document
- * @param end end of relevant region in document
- * @return the list of all possible suggestions
- * @throws BadLocationException if accessing the current document fails
- */
- public List<String> getCompletions(IFile file, IDocument document, CharSequence
prefix,
- int position, List<Var> vars, int start, int end) throws BadLocationException,
StringIndexOutOfBoundsException {
- return getCompletions(file, document, prefix, position, false, vars, start, end);
- }
-
- /**
- * Create the array of suggestions.
- * @param project Seam project
- * @param file File
* @param documentContent
* @param prefix the prefix to search for
* @param position Offset of the prefix
@@ -119,9 +100,7 @@
int position, boolean returnEqualedVariablesOnly, List<Var> vars, int start, int
end) throws BadLocationException, StringIndexOutOfBoundsException {
List<String> completions = new ArrayList<String>();
- String prefix2 = getPrefix(document, position + prefix.length(), start, end);
-
- ELOperandResolveStatus status = resolveELOperand(file, parseOperand(prefix2),
returnEqualedVariablesOnly, vars, new ElVarSearcher(file, this));
+ ELOperandResolveStatus status = resolveELOperand(file, parseOperand("" +
prefix), returnEqualedVariablesOnly, vars, new ElVarSearcher(file, this));
if (status.isOK()) {
completions.addAll(status.getProposals());
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java 2008-10-02
15:16:16 UTC (rev 10629)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java 2008-10-02
15:17:29 UTC (rev 10630)
@@ -264,7 +264,7 @@
for (SyntaxError error: errors) {
//TODO 1) make message more informative
// 2) create other preference
- addError(SYNTAX_ERROR_MESSAGE_ID, SeamPreferences.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
new String[]{}, 1, offset + error.getPosition(), file);
+ addError(SYNTAX_ERROR_MESSAGE_ID, SeamPreferences.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
new String[]{"" + error.getProblem()}, 1, offset + error.getPosition(), file);
}
}
@@ -335,21 +335,14 @@
ELInvocationExpression ts = status.getUnresolvedTokens();
varName = ts.getMemberName();
+ if(varName == null) {
+ //This is syntax error case. Reported by parser.
+ return;
+ }
offsetOfVarName = documnetOffset + ts.getInvocationStartPosition();
- lengthOfVarName = varName.length();
- unresolvedTokenIsVariable = true; //TODO
+ lengthOfVarName = varName == null ? 0 : varName.length();
+ unresolvedTokenIsVariable = true;
-// List<ELOperandToken> tokens = status.getUnresolvedTokens();
-//
-// for (ELOperandToken token : tokens) {
-// if((token.getType()==ELOperandToken.EL_VARIABLE_NAME_TOKEN) ||
(token.getType()==ELOperandToken.EL_PROPERTY_NAME_TOKEN) ||
(token.getType()==ELOperandToken.EL_METHOD_TOKEN)) {
-// varName = token.getText();
-// offsetOfVarName = documnetOffset + operandToken.getFirstToken().getStart() +
token.getStart();
-// lengthOfVarName = varName.length();
-// unresolvedTokenIsVariable =
(token.getType()==ELOperandToken.EL_VARIABLE_NAME_TOKEN);
-// break;
-// }
-// }
}
}
} catch (BadLocationException e) {
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties 2008-10-02
15:16:16 UTC (rev 10629)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties 2008-10-02
15:17:29 UTC (rev 10630)
@@ -44,7 +44,7 @@
UNKNOWN_EL_VARIABLE_NAME="{0}" cannot be resolved
UNKNOWN_EL_VARIABLE_PROPERTY_NAME="{0}" cannot be resolved
UNPAIRED_GETTER_OR_SETTER=Property "{0}" has only {1}. {2} is missing.
-SYNTAX_ERROR=EL syntax error.
+SYNTAX_ERROR=EL syntax error: {0}.
#Invalid seam project settings
INVALID_PARENT_PROJECT=Main Seam project "{0}" specified for Seam project
"{1}" does not exist.