Author: akazakov
Date: 2009-10-27 11:43:23 -0400 (Tue, 27 Oct 2009)
New Revision: 18307
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolution.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolutionImpl.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFMessageELCompletionEngine.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/AbstractELCompletionEngine.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4427
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolution.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolution.java 2009-10-27
15:17:23 UTC (rev 18306)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolution.java 2009-10-27
15:43:23 UTC (rev 18307)
@@ -76,4 +76,11 @@
* @return the number of resolved segments
*/
int getNumberOfResolvedSegments();
+
+ /**
+ * @return the resolved value of this EL as String.
+ * In case of message bundle properties it will be an value from properties file.
+ * If the value is not available for this EL then source EL String will be returned.
+ */
+ String getValue();
}
\ No newline at end of file
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolutionImpl.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolutionImpl.java 2009-10-27
15:17:23 UTC (rev 18306)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolutionImpl.java 2009-10-27
15:43:23 UTC (rev 18307)
@@ -31,7 +31,12 @@
protected Set<TextProposal> proposals = new HashSet<TextProposal>();
protected ELInvocationExpression lastResolvedToken;
protected boolean mapOrCollectionOrBundleAmoungTheTokens;
-
+ protected String value;
+
+ public ELResolutionImpl(ELExpression operand) {
+ setSourceOperand(operand);
+ }
+
/* (non-Javadoc)
* @see
org.jboss.tools.common.el.core.resolver.ELResolution#findSegmentsByJavaElement(org.eclipse.jdt.core.IJavaElement)
*/
@@ -169,20 +174,6 @@
}
/**
- * @return the operand
- */
- public ELExpression getOperand() {
- return operand;
- }
-
- /**
- * @param operand the operand to set
- */
- public void setOperand(ELExpression operand) {
- this.operand = operand;
- }
-
- /**
* @return the mapOrCollectionOrBundleAmoungTheTokens
*/
public boolean isMapOrCollectionOrBundleAmoungTheTokens() {
@@ -223,4 +214,22 @@
}
return i;
}
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.common.el.core.resolver.ELResolution#getValue()
+ */
+ public String getValue() {
+ if(value==null) {
+ value = operand.toString();
+ }
+ return value;
+ }
+
+ /**
+ * @param value
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
}
\ No newline at end of file
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFMessageELCompletionEngine.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFMessageELCompletionEngine.java 2009-10-27
15:17:23 UTC (rev 18306)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFMessageELCompletionEngine.java 2009-10-27
15:43:23 UTC (rev 18307)
@@ -22,7 +22,6 @@
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.swt.graphics.Image;
-import org.jboss.tools.common.el.core.model.ELArgumentInvocation;
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;
@@ -156,8 +155,7 @@
&& ((ELPropertyInvocation)expr).getName() == null;
boolean isArgument = expr.getType() == ELObjectType.EL_ARGUMENT_INVOCATION;
- ELResolutionImpl resolution = new ELResolutionImpl();
- resolution.setOperand(expr);
+ ELResolutionImpl resolution = new ELResolutionImpl(expr);
ELInvocationExpression left = expr;
List<Variable> resolvedVariables = new ArrayList<Variable>();
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java 2009-10-27
15:17:23 UTC (rev 18306)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java 2009-10-27
15:43:23 UTC (rev 18307)
@@ -10,21 +10,12 @@
******************************************************************************/
package org.jboss.tools.jst.jsp.contentassist;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
-import org.eclipse.core.internal.resources.ICoreConstants;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
@@ -33,14 +24,10 @@
import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TLDCMDocumentManager;
import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TaglibTracker;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.common.componentcore.internal.ComponentResource;
-import org.eclipse.wst.common.componentcore.internal.StructureEdit;
-import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
import org.eclipse.wst.sse.core.StructuredModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
import org.eclipse.wst.xml.core.internal.document.NodeContainer;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
@@ -57,15 +44,12 @@
import org.jboss.tools.common.el.core.resolver.ElVarSearcher;
import org.jboss.tools.common.el.core.resolver.Var;
import org.jboss.tools.common.text.TextProposal;
-import org.jboss.tools.common.text.ext.util.Utils;
-import org.jboss.tools.jst.web.kb.IIncludedContextSupport;
import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.kb.IResourceBundle;
import org.jboss.tools.jst.web.kb.KbQuery;
import org.jboss.tools.jst.web.kb.PageContextFactory;
import org.jboss.tools.jst.web.kb.PageProcessor;
import org.jboss.tools.jst.web.kb.KbQuery.Type;
-import org.jboss.tools.jst.web.kb.include.IncludeContextBuilder;
import org.jboss.tools.jst.web.kb.internal.JspContextImpl;
import org.jboss.tools.jst.web.kb.internal.ResourceBundle;
import org.jboss.tools.jst.web.kb.internal.XmlContextImpl;
@@ -271,9 +255,8 @@
sModel.releaseFromRead();
}
}
-
}
-
+
/**
* Calculates and adds the attribute name proposals to the Content Assist Request
object
*
@@ -281,50 +264,46 @@
* @param childPosition the
*/
protected void addAttributeNameProposals(ContentAssistRequest contentAssistRequest) {
- try {
- String matchString = contentAssistRequest.getMatchString();
- String query = matchString;
- if (query == null)
- query = ""; //$NON-NLS-1$
- String stringQuery = matchString;
-
- KbQuery kbQuery = createKbQuery(Type.ATTRIBUTE_NAME, query, stringQuery);
- TextProposal[] proposals = PageProcessor.getInstance().getProposals(kbQuery,
getContext());
+ String matchString = contentAssistRequest.getMatchString();
+ String query = matchString;
+ if (query == null)
+ query = ""; //$NON-NLS-1$
+ String stringQuery = matchString;
+
+ KbQuery kbQuery = createKbQuery(Type.ATTRIBUTE_NAME, query, stringQuery);
+ TextProposal[] proposals = PageProcessor.getInstance().getProposals(kbQuery,
getContext());
+
+ for (int i = 0; proposals != null && i < proposals.length; i++) {
+ TextProposal textProposal = proposals[i];
- for (int i = 0; proposals != null && i < proposals.length; i++) {
- TextProposal textProposal = proposals[i];
-
- if (isExistingAttribute(textProposal.getLabel()))
- continue;
-
- String replacementString = textProposal.getReplacementString() +
"=\"\""; //$NON-NLS-1$
-
- int replacementOffset = contentAssistRequest.getReplacementBeginPosition();
- int replacementLength = contentAssistRequest.getReplacementLength();
- int cursorPosition = getCursorPositionForProposedText(replacementString);
- Image image = textProposal.getImage();
- if (image == null) {
- image =
XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_ATTRIBUTE);
- }
+ if (isExistingAttribute(textProposal.getLabel()))
+ continue;
- String displayString = textProposal.getLabel() == null ?
- replacementString :
- textProposal.getLabel();
- IContextInformation contextInformation = null;
- String additionalProposalInfo = textProposal.getContextInfo();
- int relevance = textProposal.getRelevance();
-
- AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(true,
replacementString,
- replacementOffset, replacementLength, cursorPosition, image, displayString,
- contextInformation, additionalProposalInfo, relevance);
+ String replacementString = textProposal.getReplacementString() +
"=\"\""; //$NON-NLS-1$
- contentAssistRequest.addProposal(proposal);
+ int replacementOffset = contentAssistRequest.getReplacementBeginPosition();
+ int replacementLength = contentAssistRequest.getReplacementLength();
+ int cursorPosition = getCursorPositionForProposedText(replacementString);
+ Image image = textProposal.getImage();
+ if (image == null) {
+ image =
XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_ATTRIBUTE);
}
- } finally {
+
+ String displayString = textProposal.getLabel() == null ?
+ replacementString :
+ textProposal.getLabel();
+ IContextInformation contextInformation = null;
+ String additionalProposalInfo = textProposal.getContextInfo();
+ int relevance = textProposal.getRelevance();
+
+ AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(true,
replacementString,
+ replacementOffset, replacementLength, cursorPosition, image, displayString,
+ contextInformation, additionalProposalInfo, relevance);
+
+ contentAssistRequest.addProposal(proposal);
}
}
-
/**
* Calculates and adds the EL proposals to the Content Assist Request object
*/
@@ -339,7 +318,7 @@
ELExpression operand, boolean returnEqualedVariablesOnly,
List<Var> vars, ElVarSearcher varSearcher)
throws BadLocationException, StringIndexOutOfBoundsException {
- return new ELResolutionImpl();
+ return new ELResolutionImpl(operand);
}
public ELParserFactory getParserFactory() {
@@ -351,7 +330,7 @@
}
public ELResolution resolve(ELContext context, ELExpression operand) {
- return new ELResolutionImpl();
+ return new ELResolutionImpl(operand);
}
};
ElVarSearcher varSearcher = new ElVarSearcher(file, fakeEngine);
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/AbstractELCompletionEngine.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/AbstractELCompletionEngine.java 2009-10-27
15:17:23 UTC (rev 18306)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/AbstractELCompletionEngine.java 2009-10-27
15:43:23 UTC (rev 18307)
@@ -346,8 +346,7 @@
return null;
}
- ELResolutionImpl resolution = new ELResolutionImpl();
- resolution.setSourceOperand(operand);
+ ELResolutionImpl resolution = new ELResolutionImpl(operand);
ELInvocationExpression expr = (ELInvocationExpression)operand;
boolean isIncomplete = expr.getType() == ELObjectType.EL_PROPERTY_INVOCATION