JBoss Tools SVN: r10519 - documentation/trunk/movies/java_hql_editing_and_validation.
by jbosstools-commits@lists.jboss.org
Author: msorokin
Date: 2008-09-26 12:02:49 -0400 (Fri, 26 Sep 2008)
New Revision: 10519
Modified:
documentation/trunk/movies/java_hql_editing_and_validation/java_hql_editing_and_validation.wnk
Log:
Modified: documentation/trunk/movies/java_hql_editing_and_validation/java_hql_editing_and_validation.wnk
===================================================================
(Binary files differ)
16 years, 3 months
JBoss Tools SVN: r10518 - in trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core: validation and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-09-26 11:31:44 -0400 (Fri, 26 Sep 2008)
New Revision: 10518
Removed:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELOperandResolveStatus.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/ElVarSearcher.java
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
Log:
JBIDE-1497.
Methods in SeamELCompletionEngine refactored.
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/ElVarSearcher.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/ElVarSearcher.java 2008-09-26 15:31:32 UTC (rev 10517)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/ElVarSearcher.java 2008-09-26 15:31:44 UTC (rev 10518)
@@ -252,7 +252,7 @@
ELExpression token = var.getElToken();
if(token!=null && !token.getText().endsWith(".")) {
String varName = var.getName();
- if(el.equals(varName)) {
+ if(el.startsWith(varName)) { //TODO it was el.equals(varName) and did not work. Why?
if(var.getElToken()!=null && initializeNestedVars) {
Var parentVar = findVarForEl(var.getElToken().getText(), parentVars, true);
if(parentVar!=null) {
@@ -260,7 +260,7 @@
if(resolvedToken==null && parentVar.getElToken()!=null) {
try {
// Initialize parent vars.
- engine.resolveSeamELOperand(project, file, var.getElToken().getText(), true, parentVars, this);
+ engine.resolveSeamELOperand(project, file, var.getElToken(), true, parentVars, this);
resolvedToken = parentVar.getResolvedElToken();
} catch (StringIndexOutOfBoundsException e) {
SeamCorePlugin.getPluginLog().logError(e);
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-09-26 15:31:32 UTC (rev 10517)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java 2008-09-26 15:31:44 UTC (rev 10518)
@@ -12,11 +12,9 @@
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
@@ -30,6 +28,16 @@
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
+import org.jboss.tools.common.el.core.model.ELExpression;
+import org.jboss.tools.common.el.core.model.ELInstance;
+import org.jboss.tools.common.el.core.model.ELInvocationExpression;
+import org.jboss.tools.common.el.core.model.ELMethodInvocation;
+import org.jboss.tools.common.el.core.model.ELModel;
+import org.jboss.tools.common.el.core.model.ELObjectType;
+import org.jboss.tools.common.el.core.model.ELPropertyInvocation;
+import org.jboss.tools.common.el.core.parser.ELParser;
+import org.jboss.tools.common.el.core.parser.ELParserFactory;
+import org.jboss.tools.common.el.core.parser.LexicalToken;
import org.jboss.tools.common.model.util.TypeInfoCollector;
import org.jboss.tools.seam.core.ISeamComponent;
import org.jboss.tools.seam.core.ISeamContextVariable;
@@ -97,12 +105,15 @@
public List<String> getCompletions(ISeamProject project, IFile file, String documentContent, CharSequence prefix,
int position, boolean returnEqualedVariablesOnly, List<Var> vars) throws BadLocationException, StringIndexOutOfBoundsException {
List<String> completions = new ArrayList<String>();
+
+ //TODO change algorithm for finding operand.
String prefix2 = SeamELCompletionEngine.getPrefix(documentContent, position + prefix.length());
- SeamELOperandResolveStatus status = resolveSeamELOperand(project, file, prefix2, returnEqualedVariablesOnly, vars, new ElVarSearcher(project, file, this));
+ SeamELOperandResolveStatus status = resolveSeamELOperand(project, file, parseOperand(prefix2), returnEqualedVariablesOnly, vars, new ElVarSearcher(project, file, this));
if (status.isOK()) {
completions.addAll(status.getProposals());
}
+
return completions;
}
@@ -120,28 +131,18 @@
return proposals;
}
- /**
- * Resolve EL.
- * @param project Seam project.
- * @param file
- * @param operand
- * @param prefix Text between #{ and cursor position in document.
- * @param position Cursor position in document
- * @param returnEqualedVariablesOnly if "false" use prefix as mask.
- * @param vars All "var" attributes that can be used in the EL.
- * @param varSearcher
- * @return Status of resolving.
- * @throws BadLocationException
- * @throws StringIndexOutOfBoundsException
- */
- public SeamELOperandResolveStatus resolveSeamELOperand(ISeamProject project, IFile file, String operand,
+ public SeamELOperandResolveStatus resolveSeamELOperand(ISeamProject project, IFile file, ELExpression operand,
boolean returnEqualedVariablesOnly, List<Var> vars, ElVarSearcher varSearcher) throws BadLocationException, StringIndexOutOfBoundsException {
- String oldEl = operand;
+ if(operand == null) {
+ //TODO
+ return new SeamELOperandResolveStatus(null);
+ }
+ String oldEl = operand.getText();
Var var = varSearcher.findVarForEl(oldEl, vars, true);
String suffix = "";
String newEl = oldEl;
if(var!=null) {
- TypeInfoCollector.MemberInfo member = resolveSeamEL(project, file, var.getElToken().getText());
+ TypeInfoCollector.MemberInfo member = resolveSeamEL(project, file, var.getElToken());
if(member!=null && !member.getType().isArray()) {
IType type = member.getMemberType();
if(type!=null) {
@@ -156,36 +157,33 @@
}
}
}
- if(var.getElToken()!=null) {
- newEl = var.getElToken().getText() + suffix + oldEl.substring(var.getName().length());
+ if(var.getElToken() != null) {
+ newEl = var.getElToken().getText() + suffix + oldEl.substring(var.getName().length());
}
}
- String newOperand = operand;
- boolean prefixWasChanged = newEl!=oldEl;
- if(prefixWasChanged) {
- newOperand = newEl;
- }
+ boolean prefixWasChanged = newEl != oldEl;
+ ELExpression newOperand = (prefixWasChanged) ? parseOperand(newEl) : operand;
SeamELOperandResolveStatus status = resolveSeamELOperand(project, file, newOperand, returnEqualedVariablesOnly);
if(prefixWasChanged) {
- // Replace new EL by original one in result status.
- ELOperandToken newLastResolvedToken = status.getLastResolvedToken();
- SeamELOperandTokenizer tokenizer = new SeamELOperandTokenizer(operand, operand.length());
- List<ELOperandToken> oldTokens = tokenizer.getTokens();
- status.setTokens(oldTokens);
+ ELInvocationExpression newLastResolvedToken = status.getLastResolvedToken();
+ status.setTokens((ELInvocationExpression)operand);
if(newLastResolvedToken != null) {
- if(newLastResolvedToken.getStart() < var.getElToken().getLength() + suffix.length()) {
+ if(status.getUnresolvedTokens() != null
+ && status.getUnresolvedTokens().getInvocationStartPosition() - status.getUnresolvedTokens().getStartPosition() < var.getElToken().getLength() + suffix.length()) {
// Last resolved token is token from "var". Set first token of original EL as last resolved one.
status.setLastResolvedToken(null);
} else {
// Last resolved token is token outside "var" prefix. Correct last resolved token.
- int oldLastResolvedTokenStart = newLastResolvedToken.getStart() - var.getElToken().getText().length() - suffix.length() + var.getName().length();
- for (ELOperandToken oldToken : oldTokens) {
- if(oldToken.getStart() == oldLastResolvedTokenStart) {
- status.setLastResolvedToken(oldToken);
+ int oldLastResolvedTokenStart = newLastResolvedToken.getInvocationStartPosition() - var.getElToken().getText().length() - suffix.length() + var.getName().length();
+ ELInvocationExpression l = (ELInvocationExpression)operand;
+ while(l != null) {
+ if(l.getInvocationStartPosition() - l.getStartPosition() <= oldLastResolvedTokenStart) {
+ status.setLastResolvedToken(l);
break;
}
+ l = l.getLeft();
}
}
}
@@ -201,6 +199,15 @@
return status;
}
+ public static ELExpression parseOperand(String operand) {
+ if(operand == null) return null;
+ String el = (operand.indexOf("#{") < 0) ? "#{" + operand + "}" : operand;
+ ELParser p = ELParserFactory.createJbossParser();
+ ELModel model = p.parse(el);
+ List<ELInstance> is = model.getInstances();
+ if(is.size() == 0) return null;
+ return is.get(0).getExpression();
+ }
/**
* Returns MemberInfo for last segment of EL. Null if El is not resolved.
* @param project
@@ -210,8 +217,10 @@
* @throws BadLocationException
* @throws StringIndexOutOfBoundsException
*/
- public TypeInfoCollector.MemberInfo resolveSeamEL(ISeamProject project, IFile file, String operand) throws BadLocationException, StringIndexOutOfBoundsException {
+ public TypeInfoCollector.MemberInfo resolveSeamEL(ISeamProject project, IFile file, ELExpression operand) throws BadLocationException, StringIndexOutOfBoundsException {
+ if(!(operand instanceof ELInvocationExpression)) return null;
SeamELOperandResolveStatus status = resolveSeamELOperand(project, file, operand, true);
+
return status.getMemberOfResolvedOperand();
}
@@ -225,97 +234,104 @@
* @throws StringIndexOutOfBoundsException
*/
public List<ISeamContextVariable> resolveSeamVariableFromEL(ISeamProject project, IFile file, String el) throws BadLocationException, StringIndexOutOfBoundsException {
- SeamELOperandTokenizer tokenizer = new SeamELOperandTokenizer(el, el.length());
- List<ELOperandToken> tokens = tokenizer.getTokens();
+ List<ISeamContextVariable> resolvedVariables = new ArrayList<ISeamContextVariable>();
+
+ if(!el.startsWith("#{")) {
+ el = "#{" + el + "}";
+ }
+ ELParser parser = ELParserFactory.createJbossParser();
+ ELModel model = parser.parse(el);
+ List<ELInstance> is = model.getInstances();
+ if(is.size() < 1) return resolvedVariables;
+
+ ELExpression ex = is.get(0).getExpression();
+ if(!(ex instanceof ELInvocationExpression)) return resolvedVariables;
+
+ ELInvocationExpression expr = (ELInvocationExpression)ex;
+
+ boolean isIncomplete = expr.getType() == ELObjectType.EL_PROPERTY_INVOCATION
+ && ((ELPropertyInvocation) expr).getName() == null;
- SeamELOperandResolveStatus status = new SeamELOperandResolveStatus(tokenizer.getTokens());
- status.setTokens(tokens);
-
- List<ISeamContextVariable> resolvedVariables = new ArrayList<ISeamContextVariable>();
+ SeamELOperandResolveStatus status = new SeamELOperandResolveStatus(expr);
+ ELInvocationExpression left = expr;
+
ScopeType scope = getScope(project, file);
- List<List<ELOperandToken>> variations = getPossibleVarsFromPrefix(tokens);
- if (variations.isEmpty()) {
- resolvedVariables = resolveVariables(project, scope,
- tokens, tokens,
- true);
+ if (expr.getLeft() == null && isIncomplete) {
+ resolvedVariables = resolveVariables(project, scope, expr, true, true);
} else {
- for (List<ELOperandToken> variation : variations) {
- List<ISeamContextVariable> resolvedVars = resolveVariables(project, scope,
- variation, tokens,
- true);
+ while (left != null) {
+ List<ISeamContextVariable> resolvedVars = new ArrayList<ISeamContextVariable>();
+ resolvedVars = resolveVariables(project, scope, left,
+ left == expr, true);
if (resolvedVars != null && !resolvedVars.isEmpty()) {
resolvedVariables = resolvedVars;
- status.setLastResolvedToken(variation.get(variation.size() - 1));
+ status.setLastResolvedToken(left);
break;
}
+ left = (ELInvocationExpression) left.getLeft();
}
}
- if (!areEqualExpressions(status.getResolvedTokens(), status.getTokens())) {
+ if (left != expr) {
resolvedVariables.clear();
}
return resolvedVariables;
}
- /**
- * Resolves Seam EL
- * @param project
- * @param file
- * @param operand
- * @param prefix
- * @param position
- * @param returnEqualedVariablesOnly
- * @return
- * @throws BadLocationException
- * @throws StringIndexOutOfBoundsException
- */
- public SeamELOperandResolveStatus resolveSeamELOperand(ISeamProject project, IFile file, String operand,
+ public SeamELOperandResolveStatus resolveSeamELOperand(ISeamProject project, IFile file, ELExpression operand,
boolean returnEqualedVariablesOnly) throws BadLocationException, StringIndexOutOfBoundsException {
+ if(!(operand instanceof ELInvocationExpression)) {
+ return new SeamELOperandResolveStatus(null);
+ }
+
+ ELInvocationExpression expr = (ELInvocationExpression)operand;
+ boolean isIncomplete = expr.getType() == ELObjectType.EL_PROPERTY_INVOCATION
+ && ((ELPropertyInvocation)expr).getName() == null;
- SeamELOperandTokenizer tokenizer = new SeamELOperandTokenizer(operand, operand.length());
- SeamELOperandResolveStatus status = new SeamELOperandResolveStatus(tokenizer.getTokens());
+ SeamELOperandResolveStatus status = new SeamELOperandResolveStatus(expr);
+ ELInvocationExpression left = expr;
List<ISeamContextVariable> resolvedVariables = new ArrayList<ISeamContextVariable>();
ScopeType scope = getScope(project, file);
- List<List<ELOperandToken>> variations = getPossibleVarsFromPrefix(status.getTokens());
- if (variations.isEmpty()) {
+ if (expr.getLeft() == null && isIncomplete) {
resolvedVariables = resolveVariables(project, scope,
- status.getTokens(), status.getTokens(),
+ expr, true,
returnEqualedVariablesOnly);
} else {
- for (List<ELOperandToken> variation : variations) {
+ while(left != null) {
List<ISeamContextVariable>resolvedVars = new ArrayList<ISeamContextVariable>();
resolvedVars = resolveVariables(project, scope,
- variation, status.getTokens(),
+ left, left == expr,
returnEqualedVariablesOnly);
if (resolvedVars != null && !resolvedVars.isEmpty()) {
resolvedVariables = resolvedVars;
- status.setLastResolvedToken(variation.get(variation.size() - 1));
+ status.setLastResolvedToken(left);
break;
}
- }
+ left = (ELInvocationExpression)left.getLeft();
+ }
}
// Save all resolved variables. It's useful for incremental validation.
- if(resolvedVariables!=null && resolvedVariables.size()>0) {
+ if(resolvedVariables != null && resolvedVariables.size() > 0) {
status.setUsedVariables(resolvedVariables);
}
- if (status.getResolvedTokens().isEmpty() &&
+ if (status.getResolvedTokens() == null &&
!returnEqualedVariablesOnly &&
- status.getTokens().size() > 0 &&
- status.getTokens().get(status.getTokens().size() - 1).getType() == ELOperandToken.EL_SEPARATOR_TOKEN) {
+ expr != null &&
+ isIncomplete) {
// no vars are resolved
// the tokens are the part of var name ended with a separator (.)
- resolvedVariables = resolveVariables(project, scope, status.getTokens(), status.getTokens(), returnEqualedVariablesOnly);
+ resolvedVariables = resolveVariables(project, scope, expr, true, returnEqualedVariablesOnly);
Set<String> proposals = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
for (ISeamContextVariable var : resolvedVariables) {
String varName = var.getName();
- if(varName.startsWith(operand)) {
- proposals.add(varName.substring(operand.length()));
+ if(varName.startsWith(operand.getText())) {
+ proposals.add(varName.substring(operand.getLength()));
}
}
status.setProposals(proposals);
@@ -324,182 +340,206 @@
// Here we have a list of vars for some part of expression
// OK. we'll proceed with members of these vars
- if (areEqualExpressions(status.getResolvedTokens(), status.getTokens())) {
+ if (status.getResolvedTokens() == status.getTokens()) {
// First segment is the last one
Set<String> proposals = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
for (ISeamContextVariable var : resolvedVariables) {
String varName = var.getName();
- if(operand.length()<=varName.length()) {
- proposals.add(varName.substring(operand.length()));
+ if(operand.getLength()<=varName.length()) {
+ proposals.add(varName.substring(operand.getLength()));
} else if(returnEqualedVariablesOnly) {
proposals.add(varName);
}
status.setMemberOfResolvedOperand(SeamExpressionResolver.getMemberInfoByVariable(var, true));
}
- status.setLastResolvedToken(status.getTokens().isEmpty() ? null : status.getTokens().get(status.getTokens().size() - 1));
+ status.setLastResolvedToken(expr);
status.setProposals(proposals);
return status;
}
// First segment is found - proceed with next tokens
- int startTokenIndex = status.getResolvedTokens().size();
List<TypeInfoCollector.MemberInfo> members = new ArrayList<TypeInfoCollector.MemberInfo>();
for (ISeamContextVariable var : resolvedVariables) {
TypeInfoCollector.MemberInfo member = SeamExpressionResolver.getMemberInfoByVariable(var, returnEqualedVariablesOnly);
if (member != null && !members.contains(member))
members.add(member);
}
- for (int i = startTokenIndex; i < status.getTokens().size() && members.size() > 0; i++) {
- ELOperandToken token = status.getTokens().get(i);
- if (i < status.getTokens().size() - 1) { // inside expression
- if (token.getType() == ELOperandToken.EL_SEPARATOR_TOKEN) {
- // proceed with next token
- status.setLastResolvedToken(token);
- continue;
+ if(left != null) while(left != expr) {
+ left = (ELInvocationExpression)left.getParent();
+ if (left != expr) { // inside expression
+ members = resolveSegment(left, members, status, returnEqualedVariablesOnly);
+ } else { // Last segment
+ resolveLastSegment((ELInvocationExpression)operand, members, status, returnEqualedVariablesOnly);
+ break;
+ }
+ }
+
+ if(status.getProposals().isEmpty() && status.getUnpairedGettersOrSetters()!=null) {
+ status.clearUnpairedGettersOrSetters();
+ }
+ return status;
+ }
+
+ private List<TypeInfoCollector.MemberInfo> resolveSegment(ELInvocationExpression expr,
+ List<TypeInfoCollector.MemberInfo> members,
+ SeamELOperandResolveStatus status,
+ boolean returnEqualedVariablesOnly) {
+ LexicalToken lt = (expr instanceof ELPropertyInvocation)
+ ? ((ELPropertyInvocation)expr).getName()
+ : (expr instanceof ELMethodInvocation)
+ ? ((ELMethodInvocation)expr).getName()
+ : null;
+ String name = lt != null ? lt.getText() : ""; // token.getText();
+ if (expr.getType() == ELObjectType.EL_PROPERTY_INVOCATION) {
+ // Find properties for the token
+ List<TypeInfoCollector.MemberInfo> newMembers = new ArrayList<TypeInfoCollector.MemberInfo>();
+ for (TypeInfoCollector.MemberInfo mbr : members) {
+ if (mbr.getMemberType() == null) continue;
+ TypeInfoCollector infos = mbr.getTypeCollector();
+ if (TypeInfoCollector.isNotParameterizedCollection(mbr) || TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
+ status.setMapOrCollectionOrBundleAmoungTheTokens();
}
- if (token.isNameToken()) {
- // Find properties for the token
- String name = token.getText();
- List<TypeInfoCollector.MemberInfo> newMembers = new ArrayList<TypeInfoCollector.MemberInfo>();
- for (TypeInfoCollector.MemberInfo mbr : members) {
- if (mbr.getMemberType() == null) continue;
- TypeInfoCollector infos = mbr.getTypeCollector();
- if (TypeInfoCollector.isNotParameterizedCollection(mbr) || TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
- status.setMapOrCollectionOrBundleAmoungTheTokens();
- }
- List<TypeInfoCollector.MemberInfo> properties = infos.getProperties();
- for (TypeInfoCollector.MemberInfo property : properties) {
- StringBuffer propertyName = new StringBuffer(property.getName());
- if (property instanceof TypeInfoCollector.MethodInfo) { // Setter or getter
- propertyName.delete(0, (propertyName.charAt(0) == 'i' ? 2 : 3));
- propertyName.setCharAt(0, Character.toLowerCase(propertyName.charAt(0)));
- }
- if (name.equals(propertyName.toString())) {
- newMembers.add(property);
- }
- }
+ List<TypeInfoCollector.MemberInfo> properties = infos.getProperties();
+ for (TypeInfoCollector.MemberInfo property : properties) {
+ StringBuffer propertyName = new StringBuffer(property.getName());
+ if (property instanceof TypeInfoCollector.MethodInfo) { // Setter or getter
+ propertyName.delete(0, (propertyName.charAt(0) == 'i' ? 2 : 3));
+ propertyName.setCharAt(0, Character.toLowerCase(propertyName.charAt(0)));
}
- members = newMembers;
- if (members != null && members.size() > 0)
- status.setLastResolvedToken(token);
+ if (name.equals(propertyName.toString())) {
+ newMembers.add(property);
+ }
}
- if (token.getType() == ELOperandToken.EL_METHOD_TOKEN) {
- // Find methods for the token
- String name = token.getText();
- if (name.indexOf('(') != -1) {
- name = name.substring(0, name.indexOf('('));
+ }
+ members = newMembers;
+ if (members != null && members.size() > 0)
+ status.setLastResolvedToken(expr);
+ }
+ if (expr.getType() == ELObjectType.EL_METHOD_INVOCATION) {
+ // Find methods for the token
+ if (name.indexOf('(') != -1) {
+ name = name.substring(0, name.indexOf('('));
+ }
+ List<TypeInfoCollector.MemberInfo> newMembers = new ArrayList<TypeInfoCollector.MemberInfo>();
+ for (TypeInfoCollector.MemberInfo mbr : members) {
+ if (mbr.getMemberType() == null) continue;
+ TypeInfoCollector infos = mbr.getTypeCollector();
+ if (TypeInfoCollector.isNotParameterizedCollection(mbr) || TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
+ status.setMapOrCollectionOrBundleAmoungTheTokens();
+ }
+ List<TypeInfoCollector.MemberInfo> methods = infos.getMethods();
+ for (TypeInfoCollector.MemberInfo method : methods) {
+ if (name.equals(method.getName())) {
+ newMembers.add(method);
}
- List<TypeInfoCollector.MemberInfo> newMembers = new ArrayList<TypeInfoCollector.MemberInfo>();
- for (TypeInfoCollector.MemberInfo mbr : members) {
- if (mbr.getMemberType() == null) continue;
- TypeInfoCollector infos = mbr.getTypeCollector();
- if (TypeInfoCollector.isNotParameterizedCollection(mbr) || TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
- status.setMapOrCollectionOrBundleAmoungTheTokens();
- }
- List<TypeInfoCollector.MemberInfo> methods = infos.getMethods();
- for (TypeInfoCollector.MemberInfo method : methods) {
- if (name.equals(method.getName())) {
- newMembers.add(method);
- }
- }
- }
- members = newMembers;
- if (members != null && members.size() > 0)
- status.setLastResolvedToken(token);
}
- } else { // Last segment
- Set<String> proposals = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
- if (token.getType() == ELOperandToken.EL_SEPARATOR_TOKEN) {
- // return all the methods + properties
- for (TypeInfoCollector.MemberInfo mbr : members) {
- if (mbr instanceof MessagesInfo) {
- // Surround the "long" keys containing the dots with [' ']
- TreeSet<String> keys = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
- keys.addAll(((MessagesInfo)mbr).getKeys());
- Iterator<String> sortedKeys = keys.iterator();
- while(sortedKeys.hasNext()) {
- String key = sortedKeys.next();
- if (key == null || key.length() == 0)
- continue;
- if (key.indexOf('.') != -1) {
- proposals.add("['" + key + "']");
- } else {
- proposals.add(key);
- }
- }
+ }
+ members = newMembers;
+ if (members != null && members.size() > 0)
+ status.setLastResolvedToken(expr);
+ }
+ return members;
+ }
+
+ private void resolveLastSegment(ELInvocationExpression expr,
+ List<TypeInfoCollector.MemberInfo> members,
+ SeamELOperandResolveStatus status,
+ boolean returnEqualedVariablesOnly) {
+ Set<String> proposals = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+ if (expr.getType() == ELObjectType.EL_PROPERTY_INVOCATION && ((ELPropertyInvocation)expr).getName() == null) {
+// if (token.getType() == ELOperandToken.EL_SEPARATOR_TOKEN) {
+ // return all the methods + properties
+ for (TypeInfoCollector.MemberInfo mbr : members) {
+ if (mbr instanceof MessagesInfo) {
+ // Surround the "long" keys containing the dots with [' ']
+ TreeSet<String> keys = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+ keys.addAll(((MessagesInfo)mbr).getKeys());
+ Iterator<String> sortedKeys = keys.iterator();
+ while(sortedKeys.hasNext()) {
+ String key = sortedKeys.next();
+ if (key == null || key.length() == 0)
continue;
+ if (key.indexOf('.') != -1) {
+ proposals.add("['" + key + "']");
+ } else {
+ proposals.add(key);
}
- if (mbr.getMemberType() == null) {
- continue;
- }
- TypeInfoCollector infos = mbr.getTypeCollector();
- if (TypeInfoCollector.isNotParameterizedCollection(mbr) || TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
- status.setMapOrCollectionOrBundleAmoungTheTokens();
- }
- proposals.addAll(infos.getMethodPresentationStrings());
- proposals.addAll(infos.getPropertyPresentationStrings(status.getUnpairedGettersOrSetters()));
}
- } else if (token.getType() == ELOperandToken.EL_VARIABLE_NAME_TOKEN ||
- token.getType() == ELOperandToken.EL_PROPERTY_NAME_TOKEN ||
- token.getType() == ELOperandToken.EL_METHOD_TOKEN) {
- // return filtered methods + properties
- Set<TypeInfoCollector.MemberPresentation> proposalsToFilter = new TreeSet<TypeInfoCollector.MemberPresentation>(TypeInfoCollector.MEMBER_PRESENTATION_COMPARATOR);
- for (TypeInfoCollector.MemberInfo mbr : members) {
- if (mbr instanceof MessagesInfo) {
- Collection<String> keys = ((MessagesInfo)mbr).getKeys();
- for (String key : keys) {
- proposalsToFilter.add(new TypeInfoCollector.MemberPresentation(key, mbr));
- }
- continue;
- }
- if (mbr.getMemberType() == null) continue;
- TypeInfoCollector infos = mbr.getTypeCollector();
- if (TypeInfoCollector.isNotParameterizedCollection(mbr) || TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
- status.setMapOrCollectionOrBundleAmoungTheTokens();
- }
- proposalsToFilter.addAll(infos.getMethodPresentations());
- proposalsToFilter.addAll(infos.getPropertyPresentations(status.getUnpairedGettersOrSetters()));
- status.setMemberOfResolvedOperand(mbr);
+ continue;
+ }
+ if (mbr.getMemberType() == null) {
+ continue;
+ }
+ TypeInfoCollector infos = mbr.getTypeCollector();
+ if (TypeInfoCollector.isNotParameterizedCollection(mbr) || TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
+ status.setMapOrCollectionOrBundleAmoungTheTokens();
+ }
+ proposals.addAll(infos.getMethodPresentationStrings());
+ proposals.addAll(infos.getPropertyPresentationStrings(status.getUnpairedGettersOrSetters()));
+ }
+ } else
+ if(expr.getType() != ELObjectType.EL_ARGUMENT_INVOCATION)
+ //actually any case
+// if (token.getType() == ELOperandToken.EL_VARIABLE_NAME_TOKEN ||
+// token.getType() == ELOperandToken.EL_PROPERTY_NAME_TOKEN ||
+// token.getType() == ELOperandToken.EL_METHOD_TOKEN)
+ {
+ // return filtered methods + properties
+ Set<TypeInfoCollector.MemberPresentation> proposalsToFilter = new TreeSet<TypeInfoCollector.MemberPresentation>(TypeInfoCollector.MEMBER_PRESENTATION_COMPARATOR);
+ for (TypeInfoCollector.MemberInfo mbr : members) {
+ if (mbr instanceof MessagesInfo) {
+ Collection<String> keys = ((MessagesInfo)mbr).getKeys();
+ for (String key : keys) {
+ proposalsToFilter.add(new TypeInfoCollector.MemberPresentation(key, mbr));
}
- for (TypeInfoCollector.MemberPresentation proposal : proposalsToFilter) {
- // We do expect nothing but name for method tokens (No round brackets)
- String filter = token.getText();
- if (filter.indexOf('(') != -1) {
- filter = filter.substring(0, filter.indexOf('('));
- }
- if(returnEqualedVariablesOnly) {
- // This is used for validation.
- if (proposal.getPresentation().equals(filter)) {
- proposals.add(proposal.getPresentation());
- status.setMemberOfResolvedOperand(proposal.getMember());
- if(status.getUnpairedGettersOrSetters()!=null) {
- TypeInfoCollector.MethodInfo unpirMethod = status.getUnpairedGettersOrSetters().get(filter);
- status.clearUnpairedGettersOrSetters();
- if(unpirMethod!=null) {
- status.getUnpairedGettersOrSetters().put(filter, unpirMethod);
- }
- }
- break;
+ continue;
+ }
+ if (mbr.getMemberType() == null) continue;
+ TypeInfoCollector infos = mbr.getTypeCollector();
+ if (TypeInfoCollector.isNotParameterizedCollection(mbr) || TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
+ status.setMapOrCollectionOrBundleAmoungTheTokens();
+ }
+ proposalsToFilter.addAll(infos.getMethodPresentations());
+ proposalsToFilter.addAll(infos.getPropertyPresentations(status.getUnpairedGettersOrSetters()));
+ status.setMemberOfResolvedOperand(mbr);
+ }
+ for (TypeInfoCollector.MemberPresentation proposal : proposalsToFilter) {
+ // We do expect nothing but name for method tokens (No round brackets)
+ LexicalToken lt = (expr instanceof ELPropertyInvocation)
+ ? ((ELPropertyInvocation)expr).getName()
+ : (expr instanceof ELMethodInvocation)
+ ? ((ELMethodInvocation)expr).getName()
+ : null;
+ String filter = lt != null ? lt.getText() : ""; //token.getText();
+// if (filter.indexOf('(') != -1) {
+// filter = filter.substring(0, filter.indexOf('('));
+// }
+ if(returnEqualedVariablesOnly) {
+ // This is used for validation.
+ if (proposal.getPresentation().equals(filter)) {
+ proposals.add(proposal.getPresentation());
+ status.setMemberOfResolvedOperand(proposal.getMember());
+ if(status.getUnpairedGettersOrSetters()!=null) {
+ TypeInfoCollector.MethodInfo unpirMethod = status.getUnpairedGettersOrSetters().get(filter);
+ status.clearUnpairedGettersOrSetters();
+ if(unpirMethod!=null) {
+ status.getUnpairedGettersOrSetters().put(filter, unpirMethod);
}
- } else if (proposal.getPresentation().startsWith(filter)) {
- // This is used for CA.
- proposals.add(proposal.getPresentation().substring(filter.length()));
}
+ break;
}
+ } else if (proposal.getPresentation().startsWith(filter)) {
+ // This is used for CA.
+ proposals.add(proposal.getPresentation().substring(filter.length()));
}
- status.setProposals(proposals);
- if (status.isOK()){
- status.setLastResolvedToken(token);
- }
}
}
-
- if(status.getProposals().isEmpty() && status.getUnpairedGettersOrSetters()!=null) {
- status.clearUnpairedGettersOrSetters();
+ status.setProposals(proposals);
+ if (status.isOK()){
+ status.setLastResolvedToken(expr);
}
- return status;
}
-
+
private String computeVariableName(List<ELOperandToken> tokens){
if (tokens == null)
tokens = new ArrayList<ELOperandToken>();
@@ -591,6 +631,30 @@
return new ArrayList<ISeamContextVariable>();
}
+ private List<ISeamContextVariable> resolveVariables(ISeamProject project, ScopeType scope, ELInvocationExpression expr, boolean isFinal, boolean onlyEqualNames) {
+ List<ISeamContextVariable>resolvedVars = new ArrayList<ISeamContextVariable>();
+ String varName = expr.toString();
+ if (varName != null) {
+ resolvedVars = SeamExpressionResolver.resolveVariables(project, scope, varName, onlyEqualNames);
+ }
+ if (resolvedVars != null && resolvedVars.size() > 0) {
+ List<ISeamContextVariable> newResolvedVars = new ArrayList<ISeamContextVariable>();
+ for (ISeamContextVariable var : resolvedVars) {
+ if(!isFinal) {
+ // Do filter by equals (name)
+ // In case of the last pass - do not filter by startsWith(name) instead of equals
+ if (varName.equals(var.getName())) {
+ newResolvedVars.add(var);
+ }
+ } else {
+ newResolvedVars.add(var);
+ }
+ }
+ return newResolvedVars;
+ }
+ return new ArrayList<ISeamContextVariable>();
+ }
+
/**
* Creates and returns list of possible variable name combinations from expression starting from the longest name
*
@@ -715,9 +779,11 @@
* @param position Offset of the prefix
*/
public List<IJavaElement> getJavaElementsForExpression(ISeamProject project, IFile file, String expression) throws BadLocationException, StringIndexOutOfBoundsException {
- SeamELOperandTokenizer tokenizer = new SeamELOperandTokenizer(expression, expression.length());
- List<ELOperandToken> tokens = tokenizer.getTokens();
- return getJavaElementsForELOperandTokens(project, file, tokens);
+ ELExpression expr = parseOperand(expression);
+ if(!(expr instanceof ELInvocationExpression)) {
+ return new ArrayList<IJavaElement>();
+ }
+ return getJavaElementsForELOperandTokens(project, file, (ELInvocationExpression)expr);
}
/**
@@ -874,7 +940,175 @@
return res;
}
- /**
+
+ /**
+ * 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
+ */
+ public List<IJavaElement> getJavaElementsForELOperandTokens(
+ ISeamProject project, IFile file,
+ ELInvocationExpression expr) throws BadLocationException, StringIndexOutOfBoundsException {
+ List<IJavaElement> res = new ArrayList<IJavaElement>();
+ if (expr == null
+ || (expr.getType() == ELObjectType.EL_PROPERTY_INVOCATION
+ && expr.getMemberName() == null)) {
+ return res;
+ }
+
+ List<ELOperandToken> resolvedExpressionPart = new ArrayList<ELOperandToken>();
+ List<ISeamContextVariable> resolvedVariables = new ArrayList<ISeamContextVariable>();
+ ScopeType scope = getScope(project, file);
+ ELInvocationExpression left = expr;
+
+ while(left != null) {
+ List<ISeamContextVariable>resolvedVars = new ArrayList<ISeamContextVariable>();
+ resolvedVars = resolveVariables(project, scope,
+ left, left == expr,
+ true);
+ if (resolvedVars != null && !resolvedVars.isEmpty()) {
+ resolvedVariables = resolvedVars;
+ break;
+ }
+ left = (ELInvocationExpression)left.getLeft();
+ }
+
+ // Here we have a list of vars for some part of expression
+ // OK. we'll proceed with members of these vars
+ if (left == expr) {
+ // First segment is the last one
+ for (ISeamContextVariable var : resolvedVariables) {
+ IMember member = SeamExpressionResolver.getMemberByVariable(var, true);
+ if (member instanceof IJavaElement){
+ res.add((IJavaElement)member);
+ }
+ }
+ return res;
+ }
+
+ // First segment is found - proceed with next tokens
+ int startTokenIndex = (resolvedExpressionPart == null ? 0 : resolvedExpressionPart.size());
+ List<TypeInfoCollector.MemberInfo> members = new ArrayList<TypeInfoCollector.MemberInfo>();
+ for (ISeamContextVariable var : resolvedVariables) {
+ TypeInfoCollector.MemberInfo member = SeamExpressionResolver.getMemberInfoByVariable(var, true);
+ if (member != null && !members.contains(member))
+ members.add(member);
+ }
+
+ if(left != null) while(left != expr) {
+ left = (ELInvocationExpression)left.getParent();
+ if (left != expr) { // inside expression
+ members = resolveSegment(left, members);
+ } else { // Last segment
+ resolveLastSegment(expr, members, res);
+ break;
+ }
+ }
+
+ return res;
+ }
+
+ private List<TypeInfoCollector.MemberInfo> resolveSegment(ELInvocationExpression expr,
+ List<TypeInfoCollector.MemberInfo> members) {
+
+ LexicalToken lt = (expr instanceof ELPropertyInvocation)
+ ? ((ELPropertyInvocation)expr).getName()
+ : (expr instanceof ELMethodInvocation)
+ ? ((ELMethodInvocation)expr).getName()
+ : null;
+ String name = lt != null ? lt.getText() : ""; // token.getText();
+ if (expr.getType() == ELObjectType.EL_PROPERTY_INVOCATION) {
+ // Find properties for the token
+ List<TypeInfoCollector.MemberInfo> newMembers = new ArrayList<TypeInfoCollector.MemberInfo>();
+ for (TypeInfoCollector.MemberInfo mbr : members) {
+ TypeInfoCollector infos = mbr.getTypeCollector();
+ List<TypeInfoCollector.MemberInfo> properties = infos.getProperties();
+ for (TypeInfoCollector.MemberInfo property : properties) {
+ StringBuffer propertyName = new StringBuffer(property.getName());
+ if (property instanceof TypeInfoCollector.MethodInfo) { // Setter or getter
+ propertyName.delete(0, 3);
+ propertyName.setCharAt(0, Character.toLowerCase(propertyName.charAt(0)));
+ }
+ if (name.equals(propertyName.toString())) {
+ newMembers.add(property);
+ }
+ }
+ }
+ members = newMembers;
+ }
+ if (expr.getType() == ELObjectType.EL_METHOD_INVOCATION) {
+ // Find methods for the token
+ List<TypeInfoCollector.MemberInfo> newMembers = new ArrayList<TypeInfoCollector.MemberInfo>();
+ for (TypeInfoCollector.MemberInfo mbr : members) {
+ TypeInfoCollector infos = mbr.getTypeCollector();
+ List<TypeInfoCollector.MemberInfo> methods = infos.getMethods();
+ for (TypeInfoCollector.MemberInfo method : methods) {
+ if (method instanceof TypeInfoCollector.MethodInfo
+ && name.equals(method.getName())) {
+ newMembers.add(method);
+ }
+ }
+ }
+ members = newMembers;
+ }
+
+ return members;
+ }
+
+
+ private void resolveLastSegment(ELInvocationExpression expr,
+ List<TypeInfoCollector.MemberInfo> members,
+ List<IJavaElement> res
+ ) {
+ List<IJavaElement> javaElements = new ArrayList<IJavaElement>();
+ if(expr.getType() != ELObjectType.EL_ARGUMENT_INVOCATION) {
+ // return filtered methods + properties
+ List<TypeInfoCollector.MemberInfo> javaElementInfosToFilter = new ArrayList<TypeInfoCollector.MemberInfo>();
+ for (TypeInfoCollector.MemberInfo mbr : members) {
+ TypeInfoCollector infos = mbr.getTypeCollector();
+ javaElementInfosToFilter.addAll(infos.getMethods());
+ javaElementInfosToFilter.addAll(infos.getProperties());
+ }
+
+ for (TypeInfoCollector.MemberInfo info : javaElementInfosToFilter) {
+ // We do expect nothing but name for method tokens (No round brackets)
+ LexicalToken lt = (expr instanceof ELPropertyInvocation)
+ ? ((ELPropertyInvocation)expr).getName()
+ : (expr instanceof ELMethodInvocation)
+ ? ((ELMethodInvocation)expr).getName()
+ : null;
+ String filter = lt != null ? lt.getText() : ""; //token.getText();
+
+ // This is used for validation.
+ if (info.getName().equals(filter)) {
+ javaElements.add(info.getJavaElement());
+ } else {
+ if (info instanceof TypeInfoCollector.MethodInfo) {
+ TypeInfoCollector.MethodInfo methodInfo = (TypeInfoCollector.MethodInfo)info;
+ if(methodInfo.isGetter() || methodInfo.isSetter()) {
+ StringBuffer name = new StringBuffer(methodInfo.getName());
+ if(methodInfo.getName().startsWith("i")) { //$NON-NLS-1$
+ name.delete(0, 2);
+ } else {
+ name.delete(0, 3);
+ }
+ name.setCharAt(0, Character.toLowerCase(name.charAt(0)));
+ String propertyName = name.toString();
+ if (propertyName.equals(filter)) {
+ javaElements.add(methodInfo.getJavaElement());
+ }
+ }
+ }
+ }
+ }
+ }
+ res.addAll(javaElements);
+ }
+
+ /**
* Returns list of Seam ELOperandToken which are placed under the cursor position
*
* @param document
@@ -931,18 +1165,4 @@
return firstToken.getStart();
}
- /*
- * Scans the document from the offset to the beginning to find start of Seam EL operand
- * Returns the end position of last Seam EL operand token
- */
- private static int getELEnd(IDocument document, int offset) {
- SeamELOperandTokenizer tokenizer = new SeamELOperandTokenizerForward(document, offset);
- List<ELOperandToken> tokens = tokenizer.getTokens();
-
- if (tokens == null || tokens.size() == 0)
- return -1;
-
- ELOperandToken lastToken = tokens.get(tokens.size() - 1);
- return lastToken.getStart() + lastToken.getLength();
- }
-}
\ No newline at end of file
+}
Deleted: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELOperandResolveStatus.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELOperandResolveStatus.java 2008-09-26 15:31:32 UTC (rev 10517)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELOperandResolveStatus.java 2008-09-26 15:31:44 UTC (rev 10518)
@@ -1,175 +0,0 @@
-package org.jboss.tools.seam.internal.core.el;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-
-import org.jboss.tools.common.model.util.TypeInfoCollector;
-import org.jboss.tools.seam.core.ISeamContextVariable;
-
-/**
- * Status of EL resolving.
- * @author Jeremy
- */
-public class SeamELOperandResolveStatus {
- private List<ELOperandToken> tokens;
- public List<ISeamContextVariable> usedVariables;
- Map<String, TypeInfoCollector.MethodInfo> unpairedGettersOrSetters;
- Set<String> proposals;
- private ELOperandToken lastResolvedToken;
- private boolean isMapOrCollectionOrBundleAmoungTheTokens = false;
- private TypeInfoCollector.MemberInfo memberOfResolvedOperand;
-
- /**
- * @return MemberInfo of last segment of EL operand. Null if El is not resolved.
- */
- public TypeInfoCollector.MemberInfo getMemberOfResolvedOperand() {
- return memberOfResolvedOperand;
- }
-
- /**
- * Sets MemberInfo for last segment of EL operand.
- * @param lastResolvedMember
- */
- public void setMemberOfResolvedOperand(
- TypeInfoCollector.MemberInfo lastResolvedMember) {
- this.memberOfResolvedOperand = lastResolvedMember;
- }
-
- /**
- * Constructor
- * @param tokens Tokens of EL
- */
- public SeamELOperandResolveStatus(List<ELOperandToken> tokens) {
- this.tokens = tokens;
- }
-
- /**
- * @return true if EL contains any not parametrized Collection or ResourceBundle.
- */
- public boolean isMapOrCollectionOrBundleAmoungTheTokens() {
- return this.isMapOrCollectionOrBundleAmoungTheTokens;
- }
-
- public void setMapOrCollectionOrBundleAmoungTheTokens() {
- this.isMapOrCollectionOrBundleAmoungTheTokens = true;
- }
-
- /**
- * @return true if EL is resolved.
- */
- public boolean isOK() {
- return !getProposals().isEmpty() || isMapOrCollectionOrBundleAmoungTheTokens();
- }
-
- /**
- * @return false if El is not resolved.
- */
- public boolean isError() {
- return !isOK();
- }
-
- /**
- * @return List of resolved tokens of EL. Includes separators "."
- */
- public List<ELOperandToken> getResolvedTokens() {
- List<ELOperandToken> resolvedTokens = new ArrayList<ELOperandToken>();
- int index = tokens.indexOf(lastResolvedToken); // index == -1 means that no tokens are resolved
- for (int i = 0; i < tokens.size() && i <= index; i++) {
- resolvedTokens.add(tokens.get(i));
- }
- return resolvedTokens;
- }
-
- /**
- * @return List of unresolved tokens of EL.
- */
- public List<ELOperandToken> getUnresolvedTokens() {
- List<ELOperandToken> unresolvedTokens = new ArrayList<ELOperandToken>();
- int index = tokens.indexOf(lastResolvedToken); // index == -1 means that no tokens are resolved
- for (int i = index + 1; i < tokens.size(); i++) {
- unresolvedTokens.add(tokens.get(i));
- }
- return unresolvedTokens;
- }
-
- /**
- * @return Last resolved token of EL. Can be separator "."
- */
- public ELOperandToken getLastResolvedToken() {
- return lastResolvedToken;
- }
-
- /**
- * @param lastResolvedToken Last resolved token of EL. Can be separator "."
- */
- public void setLastResolvedToken(ELOperandToken lastResolvedToken) {
- this.lastResolvedToken = lastResolvedToken;
- }
-
- /**
- * @return Tokens of EL.
- */
- public List<ELOperandToken> getTokens() {
- return tokens;
- }
-
- /**
- * @param tokens Tokens of EL.
- */
- public void setTokens(List<ELOperandToken> tokens) {
- this.tokens = tokens;
- }
-
- /**
- * @return Set of proposals for EL.
- */
- public Set<String> getProposals() {
- return proposals == null ? new TreeSet<String>() : proposals;
- }
-
- /**
- * @param proposals Set of proposals.
- */
- public void setProposals(Set<String> proposals) {
- this.proposals = proposals;
- }
-
- /**
- * @return List of Seam Context Variables used in EL.
- */
- public List<ISeamContextVariable> getUsedVariables() {
- return (usedVariables == null ? new ArrayList<ISeamContextVariable>() : usedVariables);
- }
-
- /**
- * @param usedVariables List of Seam Context Variables used in EL.
- */
- public void setUsedVariables(List<ISeamContextVariable> usedVariables) {
- this.usedVariables = usedVariables;
- }
-
- /**
- * @return Map of unpaired getters and setters (getters/setters without proper setters/getters).
- * of all properties used in EL.
- * Key - name of property.
- * Value - MethodInfo of existed getter/setter.
- */
- public Map<String, TypeInfoCollector.MethodInfo> getUnpairedGettersOrSetters() {
- if (unpairedGettersOrSetters == null) {
- unpairedGettersOrSetters = new HashMap<String, TypeInfoCollector.MethodInfo>();
- }
- return unpairedGettersOrSetters;
- }
-
- /**
- * Clear Map of unpaired getters and setters.
- */
- public void clearUnpairedGettersOrSetters() {
- getUnpairedGettersOrSetters().clear();
- }
-
-}
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-09-26 15:31:32 UTC (rev 10517)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java 2008-09-26 15:31:44 UTC (rev 10518)
@@ -55,7 +55,6 @@
import org.jboss.tools.seam.core.SeamCoreMessages;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.SeamPreferences;
-import org.jboss.tools.seam.internal.core.el.ELOperandToken;
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.SeamELOperandResolveStatus;
@@ -296,15 +295,10 @@
try {
int offset = operand.length();
if (!operand.endsWith(".")) { //$NON-NLS-1$
- String prefix = SeamELCompletionEngine.getPrefix(operand, offset);
- if(prefix!=null) {
- int position = operand.indexOf(prefix);
- if (position == -1) {
- position = 0;
- }
+ {
SeamELOperandResolveStatus status =
- engine.resolveSeamELOperand(project, file, operand, true, varListForCurentValidatedNode, elVarSearcher);
+ engine.resolveSeamELOperand(project, file, operandToken, true, varListForCurentValidatedNode, elVarSearcher);
if(status.getUsedVariables().size()==0 && status.isError()) {
// Save resources with unknown variables names
@@ -334,18 +328,25 @@
// It's valid EL.
return;
}
+
+ ELInvocationExpression ts = status.getUnresolvedTokens();
+
+ varName = ts.getMemberName();
+ offsetOfVarName = documnetOffset + ts.getInvocationStartPosition();
+ lengthOfVarName = varName.length();
+ unresolvedTokenIsVariable = true; //TODO
- 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;
- }
- }
+// 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) {
16 years, 3 months
JBoss Tools SVN: r10517 - in trunk/seam/plugins/org.jboss.tools.seam.text.ext: src/org/jboss/tools/seam/text/ext/hyperlink and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-09-26 11:31:32 -0400 (Fri, 26 Sep 2008)
New Revision: 10517
Modified:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/META-INF/MANIFEST.MF
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlinkPartitioner.java
Log:
JBIDE-1497.
Methods in SeamELCompletionEngine refactored.
Modified: trunk/seam/plugins/org.jboss.tools.seam.text.ext/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.text.ext/META-INF/MANIFEST.MF 2008-09-26 15:31:19 UTC (rev 10516)
+++ trunk/seam/plugins/org.jboss.tools.seam.text.ext/META-INF/MANIFEST.MF 2008-09-26 15:31:32 UTC (rev 10517)
@@ -21,6 +21,7 @@
org.eclipse.core.resources,
org.jboss.tools.common,
org.jboss.tools.common.model,
+ org.jboss.tools.common.el.core,
org.jboss.tools.common.text.ext,
org.jboss.tools.jst.web,
org.jboss.tools.jsf,
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-09-26 15:31:19 UTC (rev 10516)
+++ trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlinkPartitioner.java 2008-09-26 15:31:32 UTC (rev 10517)
@@ -18,6 +18,8 @@
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
+import org.jboss.tools.common.el.core.model.ELExpression;
+import org.jboss.tools.common.el.core.model.ELInvocationExpression;
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;
@@ -253,13 +255,14 @@
SeamELCompletionEngine engine= new SeamELCompletionEngine();
- List<ELOperandToken> tokens = SeamELCompletionEngine.findTokensAtOffset(document, r.getOffset() + r.getLength());
- if (tokens == null)
+ String prefix = SeamELCompletionEngine.getPrefix(document.get(), r.getOffset() + r.getLength());
+ ELExpression expr = SeamELCompletionEngine.parseOperand(prefix);
+ if (expr == null)
return null; // No EL Operand found
List<IJavaElement> javaElements = null;
try {
- javaElements = engine.getJavaElementsForELOperandTokens(seamProject, file, tokens);
+ javaElements = engine.getJavaElementsForELOperandTokens(seamProject, file, (ELInvocationExpression)expr);
} catch (StringIndexOutOfBoundsException e) {
SeamExtPlugin.getPluginLog().logError(e);
return null;
@@ -272,28 +275,17 @@
// Try to find a local Var (a pair of variable-value attributes)
ElVarSearcher varSearcher = new ElVarSearcher(seamProject, file, new SeamELCompletionEngine());
// Find a Var in the EL
- int start = tokens.get(0).getStart();
- int end = tokens.get(tokens.size() - 1).getStart() +
- tokens.get(tokens.size() - 1).getLength();
+ int start = expr.getStartPosition();
+ int end = expr.getEndPosition();
- StringBuffer elText = new StringBuffer();
- 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 ||
- token.getType() == ELOperandToken.EL_SEPARATOR_TOKEN) {
- elText.append(token.getText());
- }
- }
-
- if (elText.length() == 0)
+ if (expr.getText().length() == 0)
return null;
List<Var> allVars= ElVarSearcher.findAllVars(file, start);
- Var var = varSearcher.findVarForEl(elText.toString(), allVars, true);
+ 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, tokens.get(0).getStart());
+ var = ElVarSearcher.findVar(file, start);
}
if (var == null)
return null;
@@ -307,17 +299,12 @@
resolvedValue = resolvedValue.substring(0, resolvedValue.lastIndexOf("}"));
// Replace the Var with its resolved value in tokens (Var is always the first token)
- elText = new StringBuffer();
+ StringBuffer elText = new StringBuffer();
elText.append(resolvedValue);
- for (int i = 1; i < tokens.size(); i++) {
- ELOperandToken token = tokens.get(i);
- if (token.getType() == ELOperandToken.EL_VARIABLE_NAME_TOKEN ||
- token.getType() == ELOperandToken.EL_PROPERTY_NAME_TOKEN ||
- token.getType() == ELOperandToken.EL_METHOD_TOKEN ||
- token.getType() == ELOperandToken.EL_SEPARATOR_TOKEN) {
- elText.append(token.getText());
- }
- }
+ String app = expr.getText();
+ int i = app.indexOf('.');
+ app = app.substring(i + 1);
+ elText.append('.').append(app);
javaElements = engine.getJavaElementsForExpression(
seamProject, file, elText.toString());
16 years, 3 months
JBoss Tools SVN: r10516 - in trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui: text/java and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-09-26 11:31:19 -0400 (Fri, 26 Sep 2008)
New Revision: 10516
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/search/SeamSearchVisitor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java
Log:
JBIDE-1497.
Methods in SeamELCompletionEngine refactored.
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/search/SeamSearchVisitor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/search/SeamSearchVisitor.java 2008-09-26 15:22:47 UTC (rev 10515)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/search/SeamSearchVisitor.java 2008-09-26 15:31:19 UTC (rev 10516)
@@ -116,7 +116,6 @@
import org.jboss.tools.seam.internal.core.el.ELOperandToken;
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.SeamELOperandTokenizerForward;
import org.jboss.tools.seam.internal.core.el.Var;
import org.jboss.tools.seam.internal.core.scanner.ScannerException;
import org.jboss.tools.seam.internal.core.scanner.java.AnnotatedASTNode;
@@ -716,32 +715,24 @@
String operand = token.getText();
String varName = operand;
int offsetOfToken = offset + token.getFirstToken().getStart();
- SeamELOperandTokenizerForward forwardTokenizer = new SeamELOperandTokenizerForward(operand, 0);
- List<ELOperandToken>operandTokens = forwardTokenizer.getTokens();
if (fJavaMatchers != null) {
- List<List<ELOperandToken>> variations = SeamELCompletionEngine.getPossibleVarsFromPrefix(operandTokens);
-
- for (List<ELOperandToken> variation : variations) {
+ ELInvocationExpression expr = token;
+ while(expr != null) {
List<IJavaElement> elements = null;
try {
- elements = fCompletionEngine.getJavaElementsForELOperandTokens(fCurrentSeamProject, file, variation);
+ elements = fCompletionEngine.getJavaElementsForELOperandTokens(fCurrentSeamProject, file, expr);
} catch (StringIndexOutOfBoundsException e) {
SeamGuiPlugin.getPluginLog().logError(e);
} catch (BadLocationException e) {
SeamGuiPlugin.getPluginLog().logError(e);
}
- if (elements == null || elements.size() == 0) {
- continue;
- }
-
- for (int i = 0; i < elements.size(); i++) {
+ if(elements != null) for (int i = 0; i < elements.size(); i++) {
if (!matches(elements.get(i)))
continue;
- int start = variation.get(0).getStart();
- int end = variation.get(variation.size() - 1).getStart() +
- variation.get(variation.size() - 1).getLength();
+ int start = 0;
+ int end = expr.getEndPosition() - expr.getStartPosition();
String variationText = operand.substring(start, end);
int offsetOfOperandToken = offsetOfToken + start;
@@ -752,23 +743,20 @@
return; // no further reporting requested
}
}
+ expr = expr.getLeft();
}
} else if (fVariableMatchers != null) {
- List<List<ELOperandToken>> variations = SeamELCompletionEngine.getPossibleVarsFromPrefix(operandTokens);
+ ELInvocationExpression expr = token;
- for (List<ELOperandToken> variation : variations) {
- Set<ISeamContextVariable> variables = fCurrentSeamProject.getVariablesByName(tokensToString(variation));
- if (variables == null || variables.size() == 0) {
- continue;
- }
+ while(expr != null) {
+ Set<ISeamContextVariable> variables = fCurrentSeamProject.getVariablesByName(expr.getText());
- for (ISeamContextVariable variable : variables) {
+ if(variables != null) for (ISeamContextVariable variable : variables) {
if (!matches(variable))
continue;
- int start = variation.get(0).getStart();
- int end = variation.get(variation.size() - 1).getStart() +
- variation.get(variation.size() - 1).getLength();
+ int start = 0;
+ int end = expr.getEndPosition() - expr.getStartPosition();
String variationText = operand.substring(start, end);
int offsetOfOperandToken = offsetOfToken + start;
@@ -779,15 +767,17 @@
return; // no further reporting requested
}
}
+ expr = expr.getLeft();
}
} else if (fVarMatchers != null) {
Var var = fELVarSearcher.findVarForEl(operand, fVarListForCurentValidatedNode, false);
if (var != null){
if (matches(var)) {
- String varRefText = operandTokens.get(0).getText();
- int start = operandTokens.get(0).getStart();
- int end = operandTokens.get(0).getStart() +
- operandTokens.get(0).getLength();
+ ELInvocationExpression expr = token;
+ while(expr.getLeft() != null) expr = expr.getLeft();
+ String varRefText = expr.getText();
+ int start = expr.getStartPosition();
+ int end = expr.getEndPosition();
int offsetOfVarRefToken = offsetOfToken + start;
int lengthOfVarRefToken = end - start;
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java 2008-09-26 15:22:47 UTC (rev 10515)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java 2008-09-26 15:31:19 UTC (rev 10516)
@@ -333,7 +333,7 @@
for (String string : uniqueSuggestions) {
if (string.length() >= 0) {
string = proposalPrefix + string + proposalSufix;
- if ('#' == string.charAt(0) || '$' == string.charAt(0))
+ if (string.length() > 0 && ('#' == string.charAt(0) || '$' == string.charAt(0)))
string = elStartChar + string.substring(1);
if (string.startsWith("['") && string.endsWith("']") && prefix != null && prefix.endsWith(".")) {
16 years, 3 months
JBoss Tools SVN: r10515 - trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2008-09-26 11:22:47 -0400 (Fri, 26 Sep 2008)
New Revision: 10515
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE675Test.java
Log:
=junit tests adjustment
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE675Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE675Test.java 2008-09-26 15:21:58 UTC (rev 10514)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE675Test.java 2008-09-26 15:22:47 UTC (rev 10515)
@@ -150,9 +150,7 @@
nsIDOMNode div = nodeMapping.getVisualNode();
- nsIDOMNode span = div.getFirstChild();
-
- nsIDOMNode textNode = span.getFirstChild();
+ nsIDOMNode textNode = div.getFirstChild();
assertEquals(textNode.getNodeType(), nsIDOMNode.TEXT_NODE);
@@ -210,10 +208,8 @@
nsIDOMNode div = nodeMapping.getVisualNode();
- nsIDOMNode span = div.getFirstChild();
+ nsIDOMNode textNode = div.getFirstChild();
- nsIDOMNode textNode = span.getFirstChild();
-
assertEquals(textNode.getNodeType(), nsIDOMNode.TEXT_NODE);
assertNotNull(textNode.getNodeValue());
16 years, 3 months
JBoss Tools SVN: r10514 - in trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor: figures and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2008-09-26 11:21:58 -0400 (Fri, 26 Sep 2008)
New Revision: 10514
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/PathLabel.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/LinkEditPart.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/FigureFactory.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2254
fine tuning
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/LinkEditPart.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/LinkEditPart.java 2008-09-26 15:20:23 UTC (rev 10513)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/LinkEditPart.java 2008-09-26 15:21:58 UTC (rev 10514)
@@ -35,7 +35,6 @@
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.jboss.tools.common.gef.edit.GEFRootEditPart;
-import org.jboss.tools.common.gef.figures.GEFLabel;
import org.jboss.tools.common.gef.figures.xpl.CustomLocator;
import org.jboss.tools.seam.ui.pages.editor.PagesEditor;
import org.jboss.tools.seam.ui.pages.editor.PagesEditor.ModelSelectionProvider;
@@ -44,6 +43,7 @@
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesElement;
import org.jboss.tools.seam.ui.pages.editor.figures.ConnectionFigure;
import org.jboss.tools.seam.ui.pages.editor.figures.FigureFactory;
+import org.jboss.tools.seam.ui.pages.editor.figures.PathLabel;
public class LinkEditPart extends AbstractConnectionEditPart implements
PropertyChangeListener, EditPartListener {
@@ -60,11 +60,11 @@
private CustomLocator shortcutLocator;
- private GEFLabel shortcutLabel;
+ private PathLabel shortcutLabel;
private CustomLocator pathLocator;
- private GEFLabel pathLabel;
+ private PathLabel pathLabel;
private PageEditPart pagePart = null;
@@ -118,8 +118,7 @@
//conn.repaint();
}
- pathLabel = new GEFLabel(getLink().getName(),
- FigureFactory.normalColor);
+ pathLabel = new PathLabel(getLink().getName());
pathLabel.setFont(pathFont);
pathLabel.setIcon(null);
pathLabel.setTextAlignment(Label.LEFT);
@@ -136,7 +135,7 @@
if(getLink().getToElement() != null)
text = getLink().getToElement().getName();
- shortcutLabel = new GEFLabel(text, FigureFactory.normalColor);
+ shortcutLabel = new PathLabel(text);
// if (getLink().getJSFModel().getOptions().showShortcutIcon())
shortcutLabel.setIcon(icon);
// shortcutLabel.setFont(getLink().getJSFModel().getOptions()
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/FigureFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/FigureFactory.java 2008-09-26 15:20:23 UTC (rev 10513)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/FigureFactory.java 2008-09-26 15:21:58 UTC (rev 10514)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.seam.ui.pages.editor.figures;
-import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.PolygonDecoration;
import org.eclipse.draw2d.geometry.PointList;
import org.eclipse.swt.graphics.Color;
@@ -19,9 +18,9 @@
import org.jboss.tools.seam.ui.pages.editor.edit.xpl.PagesConnectionRouter;
public class FigureFactory {
- public static final Color normalColor = new Color(null, 0x88, 0x89, 0x88);
+ public static final Color pathColor = new Color(null, 0x84, 0x85, 0x84);
+ public static final Color normalColor = new Color(null, 0xad, 0xae, 0xad);
public static final Color selectedColor = new Color(null, 0xff, 0x84, 0x00);
- public static final Color highlightColor = ColorConstants.black;
public static final PointList TRIANGLE_TIP = new PointList();
Added: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/PathLabel.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/PathLabel.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/PathLabel.java 2008-09-26 15:21:58 UTC (rev 10514)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.ui.pages.editor.figures;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+public class PathLabel extends Label{
+
+ public PathLabel(String name){
+ super(name);
+ }
+
+ protected void paintFigure(Graphics graphics){
+ Rectangle bounds = getBounds();
+ graphics.translate(bounds.x, bounds.y);
+ if(!graphics.getForegroundColor().equals(FigureFactory.selectedColor)) graphics.setForegroundColor(FigureFactory.pathColor);
+ if(getIcon()!= null)graphics.drawImage(getIcon(), getIconLocation());
+ graphics.drawText(getSubStringText(), getTextLocation());
+ graphics.translate(-bounds.x, -bounds.y);
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/PathLabel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 3 months
JBoss Tools SVN: r10513 - documentation/trunk/movies/index/en.
by jbosstools-commits@lists.jboss.org
Author: smukhina
Date: 2008-09-26 11:20:23 -0400 (Fri, 26 Sep 2008)
New Revision: 10513
Modified:
documentation/trunk/movies/index/en/master.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-426
movies are grouped
Modified: documentation/trunk/movies/index/en/master.xml
===================================================================
--- documentation/trunk/movies/index/en/master.xml 2008-09-26 14:55:32 UTC (rev 10512)
+++ documentation/trunk/movies/index/en/master.xml 2008-09-26 15:20:23 UTC (rev 10513)
@@ -15,70 +15,81 @@
<title/>
<!--title>The following viewlets illustrate various aspects of JBoss Tools and JBDS.</title-->
<itemizedlist>
+ <title>Hibernate Demos</title>
<listitem>
<para>
<ulink url="demos/create_console_config/create_console_config.htm">Creating Console Configuration</ulink>
</para>
<para>This movie shows how to create a console configuration for JPA; but it is the same steps needed for projects using hbm.xml or Hibernate Annotations stand alone</para>
</listitem>
-
<listitem>
<para>
- <ulink url="demos/cust_tag_lib_to_palette/cust_tag_lib_to_palette.htm">Importing Custom Tag Library to Palette</ulink>
+ <ulink url="demos/HQL_JPA-QL_queries/HQL_JPA-QL_queries.htm">Edit and run HQL/JPA-QL queries</ulink>
</para>
- <para>It explains how you can easy and fast add a CustomTag Library to the Palette </para>
+ <para>It demonstrates how to use the HQL editor with code completion and dynamic sql preview and how to inspect the results</para>
</listitem>
<listitem>
<para>
- <ulink url="demos/seam2_plus_ejb3/seam2_plus_ejb3.htm">Creating Seam2 + EJB3 EAR Project</ulink>
+ <ulink url="demos/edit_and_run_criteria/edit_and_run_criteria.htm">Criteria Editor in Action</ulink>
</para>
- <para>The online demo shows all the basics you'll need to create such application</para>
+ <para>The demo explains how it be used for executing (almost) arbitrary java for quick manipulation/creation of persistent objects.</para>
</listitem>
<listitem>
<para>
- <ulink url="demos/archiving/archiving.htm">Archiving</ulink>
+ <ulink url="demos/java_hql_editing_and_validation/java_hql_editing_and_validation.htm">Java HQL Editing and Validation</ulink>
</para>
- <para>This screencast tells you how to create archives</para>
+ <para>The demo movie shows how the HQL/JPA-QL code completion is also available inside the java editor; together with syntax checking of the query strings inside @NamedQuery and createQuery strings.</para>
</listitem>
+ </itemizedlist>
+
+ <itemizedlist>
+ <title>VPE Demos</title>
<listitem>
<para>
- <ulink url="demos/ootb_new_seam_project/new_seam_project.htm">New Seam Project</ulink>
+ <ulink url="demos/cust_tag_lib_to_palette/cust_tag_lib_to_palette.htm">Importing Custom Tag Library to Palette</ulink>
</para>
- <para>This movie shows you step-by-step how to crete a new seam project</para>
+ <para>It explains how you can easy and fast add a CustomTag Library to the Palette </para>
</listitem>
+ <listitem>
+ <para>
+ <ulink url="demos/rich_faces_demo/rich_faces_demo.htm">RichFaces Toolkit for developing Web application</ulink>
+ </para>
+ <para>This demo covers a creation of a jsf application with simple content using the RichFaces components</para>
+ </listitem>
+
+
+ </itemizedlist>
+
+ <itemizedlist>
+ <title>Seam Demos</title>
<listitem>
<para>
- <ulink url="demos/HQL_JPA-QL_queries/HQL_JPA-QL_queries.htm">Edit and run HQL/JPA-QL queries</ulink>
+ <ulink url="demos/seam2_plus_ejb3/seam2_plus_ejb3.htm">Creating Seam2 + EJB3 EAR Project</ulink>
</para>
- <para>It demonstrates how to use the HQL editor with code completion and dynamic sql preview and how to inspect the results</para>
+ <para>The online demo shows all the basics you'll need to create such application</para>
</listitem>
- <listitem>
+ <listitem>
+ <para>
+ <ulink url="demos/ootb_new_seam_project/new_seam_project.htm">New Seam Project</ulink>
+ </para>
+ <para>This movie shows you step-by-step how to crete a new seam project</para>
+ </listitem>
+
+ </itemizedlist>
+ <itemizedlist>
+ <title>Server Manager Demos</title>
+ <listitem>
<para>
- <ulink url="demos/rich_faces_demo/rich_faces_demo.htm">RichFaces Toolkit for developing Web application</ulink>
+ <ulink url="demos/archiving/archiving.htm">Archiving</ulink>
</para>
- <para>This demo covers a creation of a jsf application with simple content using the RichFaces components</para>
+ <para>This screencast tells you how to create archives</para>
</listitem>
-
- <listitem>
- <para>
- <ulink url="demos/edit_and_run_criteria/edit_and_run_criteria.htm">Criteria Editor in Action</ulink>
- </para>
- <para>The demo explains how it be used for executing (almost) arbitrary java for quick manipulation/creation of persistent objects.</para>
- </listitem>
-
- <listitem>
- <para>
- <ulink url="demos/java_hql_editing_and_validation/java_hql_editing_and_validation.htm">Java HQL Editing and Validation</ulink>
- </para>
- <para>The demo movie shows how the HQL/JPA-QL code completion is also available inside the java editor; together with syntax checking of the query strings inside @NamedQuery and createQuery strings.</para>
- </listitem>
-
-
+
</itemizedlist>
</index>
</book>
16 years, 3 months
JBoss Tools SVN: r10512 - trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2008-09-26 10:55:32 -0400 (Fri, 26 Sep 2008)
New Revision: 10512
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2594Test.java
Log:
=junit test error fixing
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2594Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2594Test.java 2008-09-26 14:49:16 UTC (rev 10511)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2594Test.java 2008-09-26 14:55:32 UTC (rev 10512)
@@ -47,7 +47,7 @@
public void testReplaceGlobalElVariable(){
- String replaceString= KEY_6+"images/test.gif"; //$NON-NLS-1$
+ String replaceString= "#{"+KEY_6+"}"+"images/test.gif"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
String replacedString = ElService.getInstance().replaceEl(file, replaceString);
assertEquals("Should be equals " + globalElMap.get(KEY_6) + "images/test.gif", replacedString, globalElMap.get(KEY_6) //$NON-NLS-1$ //$NON-NLS-2$
@@ -60,7 +60,7 @@
* @throws CoreException the core exception
*/
public void testOverrideLocalVariable() throws CoreException {
- String string1 = KEY_1+"/images/smalle.gif"; //$NON-NLS-1$
+ String string1 = "${"+KEY_1+"}"+"/images/smalle.gif"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
String replacedValue = ElService.getInstance().replaceEl(file, string1);
assertEquals("Should be equals " + globalElMap.get(KEY_1) + "/images/smalle.gif", replacedValue, globalElMap.get(KEY_1) //$NON-NLS-1$ //$NON-NLS-2$
16 years, 3 months
JBoss Tools SVN: r10511 - in trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces: resources/menuItem and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2008-09-26 10:49:16 -0400 (Fri, 26 Sep 2008)
New Revision: 10511
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/menuGroup/menuGroup.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/menuItem/menuItem.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDropDownMenuTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuGroupTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuItemTemplate.java
Log:
JBIDE-2497, html div positions and styles were updated.
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/menuGroup/menuGroup.css
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/menuGroup/menuGroup.css 2008-09-26 14:22:47 UTC (rev 10510)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/menuGroup/menuGroup.css 2008-09-26 14:49:16 UTC (rev 10511)
@@ -32,30 +32,28 @@
}
.rich-menu-item-icon-enabled {
border:0pt solid transparent;
- padding:2px 36px 2px 2px;
+ padding:2px 10px 2px 2px;
}
.rich-menu-item-icon-selected {
}
.rich-menu-list-border {
font-family:Arial,Verdana,sans-serif;
- /*background-color:#F1EEE9;*/
- background-color:#C4C0B9;
+ background-color:#F1EEE9;
+ background-color:#F1EEE9;
border-color:#C4C0B9;
border:1px solid;
}
.rich-menu-list-bg {
- background-image:url(list-bg.png);
- border-left-color:#F1EEE9;
- border-right-color:#F1EEE9;
- border-top-color:#F1EEE9;
-
background:transparent none repeat-y scroll left center;
+ background-image:url(list-bg.png);
+ border-left-color:#C4C0B9;
+ border-right-color:#C4C0B9;
+ border-top-color:#C4C0B9;
border-left-style:solid;
border-left-width:1px;
border-right-style:solid;
border-right-width:1px;
border-top-style:solid;
border-top-width:1px;
-
}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/menuItem/menuItem.css
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/menuItem/menuItem.css 2008-09-26 14:22:47 UTC (rev 10510)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/menuItem/menuItem.css 2008-09-26 14:49:16 UTC (rev 10511)
@@ -5,7 +5,8 @@
}
.rich-menu-item-icon {
-
+ border:0pt solid transparent;
+ padding:2px 10px 2px 2px;
}
.rich-menu-item-disabled {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDropDownMenuTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDropDownMenuTemplate.java 2008-09-26 14:22:47 UTC (rev 10510)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDropDownMenuTemplate.java 2008-09-26 14:49:16 UTC (rev 10511)
@@ -51,8 +51,8 @@
private static final String CSS_RICH_LABEL_TEXT_DECOR = "rich-label-text-decor"; //$NON-NLS-1$
private static final String CSS_RICH_MENU_LIST_BORDER = "rich-menu-list-border"; //$NON-NLS-1$
private static final String CSS_RICH_MENU_LIST_BG = "rich-menu-list-bg"; //$NON-NLS-1$
- private static final String CSS_RICH_DDEMENU_LIST_DIV_STYLE = "position: relative; z-index: 100;"; //$NON-NLS-1$
- private static final String CSS_RICH_DDEMENU_BORDER_DIV_STYLE = "position: relative; z-index: 2;"; //$NON-NLS-1$
+ private static final String CSS_RICH_DDEMENU_LIST_DIV_STYLE = "position: relative; z-index: 100; display: table;"; //$NON-NLS-1$
+ private static final String CSS_RICH_DDEMENU_BORDER_DIV_STYLE = "position: relative; z-index: 2; display: table;"; //$NON-NLS-1$
/*
* rich:dropDownMenu attributes names
@@ -168,14 +168,20 @@
/*
* Setting css styles
*/
+ String cssListDivStyle = EMPTY;
+ String cssListBorderDivStyle = EMPTY;
String cssLabelDivStyle = EMPTY;
- String cssListBorderDivStyle = EMPTY;
- cssLabelDivStyle += SPACE + CSS_RICH_DDEMENU_LIST_DIV_STYLE;
+ cssListDivStyle += SPACE + CSS_RICH_DDEMENU_LIST_DIV_STYLE;
cssListBorderDivStyle += SPACE + CSS_RICH_DDEMENU_BORDER_DIV_STYLE;
- ddmListDiv.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, cssLabelDivStyle);
+ if (attrPresents(ddm_style)) {
+ cssLabelDivStyle += SPACE + ddm_style;
+ }
+
+ ddmListDiv.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, cssListDivStyle);
ddmListBorderDiv.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, cssListBorderDivStyle);
+ ddmLabelDiv.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, cssLabelDivStyle);
/*
* Encoding label value
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuGroupTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuGroupTemplate.java 2008-09-26 14:22:47 UTC (rev 10510)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuGroupTemplate.java 2008-09-26 14:49:16 UTC (rev 10511)
@@ -59,8 +59,8 @@
private static final String CSS_RICH_MENU_ITEM_ICON_SELECTED = "rich-menu-item-icon-selected"; //$NON-NLS-1$
private static final String CSS_RICH_MENU_LIST_BORDER = "rich-menu-list-border"; //$NON-NLS-1$
private static final String CSS_RICH_MENU_LIST_BG = "rich-menu-list-bg"; //$NON-NLS-1$
- private static final String CSS_RICH_LIST_FOLDER_DIV_STYLE = "position: relative; z-index: 100;"; //$NON-NLS-1$
- private static final String CSS_RICH_LIST_BORDER_DIV_STYLE = "position: relative; z-index: 2;"; //$NON-NLS-1$
+ private static final String CSS_RICH_LIST_FOLDER_DIV_STYLE = "position: relative; z-index: 100; display: table;"; //$NON-NLS-1$
+ private static final String CSS_RICH_LIST_BORDER_DIV_STYLE = "position: relative; z-index: 2; display: table;"; //$NON-NLS-1$
/*
* rich:menuGroup attributes names
@@ -180,6 +180,13 @@
/*
* Setting css styles
*/
+ String topDivStyle = EMPTY;
+
+ if (attrPresents(mg_style)) {
+ topDivStyle += SPACE + mg_style;
+ }
+
+ grTopDiv.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, topDivStyle);
grFolderDiv.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, CSS_RICH_LIST_FOLDER_DIV_STYLE);
grListBorderDiv.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, CSS_RICH_LIST_BORDER_DIV_STYLE);
@@ -213,8 +220,12 @@
* Create spacer image
*/
ComponentUtil.setImg(grImg, SPACER_IMG_PATH);
- grImgSpan.appendChild(grImg);
}
+ /*
+ * Add image to span
+ */
+ grImgSpan.appendChild(grImg);
+
}
String menuGroupId = (String) sourceNode.getUserData(MENU_GROUP_ID);
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuItemTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuItemTemplate.java 2008-09-26 14:22:47 UTC (rev 10510)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesMenuItemTemplate.java 2008-09-26 14:49:16 UTC (rev 10511)
@@ -150,6 +150,17 @@
itemLabelSpan.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, labelSpanClass);
/*
+ * Setting css styles
+ */
+ String topDivStyle = EMPTY;
+
+ if (attrPresents(mi_style)) {
+ topDivStyle += SPACE + mi_style;
+ }
+
+ itemTopDiv.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, topDivStyle);
+
+ /*
* Encode label and icon value
*/
Attr valueAttr = sourceElement.getAttributeNode(HtmlComponentUtil.HTML_VALUE_ATTR);
@@ -184,6 +195,7 @@
* Add image to span
*/
itemIconImgSpan.appendChild(itemIconImg);
+
}
/*
16 years, 3 months
JBoss Tools SVN: r10510 - trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2008-09-26 10:22:47 -0400 (Fri, 26 Sep 2008)
New Revision: 10510
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2594Test.java
Log:
=junit test adjustment
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2594Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2594Test.java 2008-09-26 13:39:36 UTC (rev 10509)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2594Test.java 2008-09-26 14:22:47 UTC (rev 10510)
@@ -33,7 +33,7 @@
/**
*
*/
- protected static final String KEY_6 = "#{global.value1}"; //$NON-NLS-1$
+ protected static final String KEY_6 = "global.value1"; //$NON-NLS-1$
protected Map<String, String> globalElMap = new HashMap<String, String>();
/**
@@ -100,6 +100,8 @@
@Override
protected void tearDown() throws Exception {
+ //clear global resources
+ GlobalELReferenceList.getInstance().setAllResources(Platform.getLocation(), new ResourceReference[0]);
super.tearDown();
}
16 years, 3 months