Author: vrubezhny
Date: 2010-04-22 08:56:52 -0400 (Thu, 22 Apr 2010)
New Revision: 21607
Modified:
branches/jbosstools-3.1.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.java
branches/jbosstools-3.1.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java
Log:
JBIDE-6055: Seam EL code completion requaires JSF nature.
The EL CA availability is validated thru number of EL Resolvers defined for the project
(EL CA will be shown if and only if there is at least one EL resolver defined for the
project)
The "New EL Expression" proposal appearance is corrected (this proposal will not
appear in case of no EL Proposals defined for project)
Patch is applied in branch 3.1.x
Modified:
branches/jbosstools-3.1.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.java
===================================================================
---
branches/jbosstools-3.1.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.java 2010-04-22
11:53:35 UTC (rev 21606)
+++
branches/jbosstools-3.1.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.java 2010-04-22
12:56:52 UTC (rev 21607)
@@ -82,7 +82,7 @@
*/
@Override
protected void addTextELProposals(ContentAssistRequest contentAssistRequest) {
- if (!isJsfProject())
+ if (!isELCAToBeShown())
return;
TextRegion prefix = getELPrefix(contentAssistRequest);
Modified:
branches/jbosstools-3.1.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java
===================================================================
---
branches/jbosstools-3.1.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java 2010-04-22
11:53:35 UTC (rev 21606)
+++
branches/jbosstools-3.1.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java 2010-04-22
12:56:52 UTC (rev 21607)
@@ -22,6 +22,7 @@
import org.eclipse.wst.xml.ui.internal.editor.XMLEditorPluginImageHelper;
import org.eclipse.wst.xml.ui.internal.editor.XMLEditorPluginImages;
import org.jboss.tools.common.el.core.resolver.ELContext;
+import org.jboss.tools.common.el.core.resolver.ELResolver;
import org.jboss.tools.common.text.TextProposal;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
import org.jboss.tools.jst.jsp.messages.JstUIMessages;
@@ -296,6 +297,9 @@
* @param contentAssistRequest
*/
protected void addELPredicateProposals(ContentAssistRequest contentAssistRequest, int
baseRelevance, boolean shiftRelevanceAgainstTagNameProposals) {
+ if (!isELCAToBeShown())
+ return;
+
// Need to check if the cursor is placed right after a word part.
// If there is no word part found then just quit
TextRegion prefix = getELPredicatePrefix(contentAssistRequest);
@@ -363,7 +367,7 @@
@Override
protected void addAttributeValueELProposals(ContentAssistRequest contentAssistRequest)
{
- if (!isJsfProject())
+ if (!isELCAToBeShown())
return;
TextRegion prefix = getELPrefix(contentAssistRequest);
@@ -447,6 +451,9 @@
@Override
protected void addTextELProposals(ContentAssistRequest contentAssistRequest) {
+ if (!isELCAToBeShown())
+ return;
+
TextRegion prefix = getELPrefix(contentAssistRequest);
if (prefix == null || !prefix.isELStarted()) {
AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(true,
"#{}", //$NON-NLS-1$
@@ -513,21 +520,12 @@
}
/**
- * A temporary fix to decide if JSF-tricks are to play
+ * Checks is we need to show EL proposals
*
* @return
*/
- protected boolean isJsfProject() {
- if (getContext() == null || getContext().getResource() == null)
- return false;
-
- IProject project = getContext().getResource().getProject();
- try {
- if (project.getNature("org.jboss.tools.jsf.jsfnature") != null)
//$NON-NLS-1$
- return true;
- } catch (CoreException e) {
- JspEditorPlugin.getDefault().logError(e);
- }
- return false;
+ protected boolean isELCAToBeShown() {
+ ELResolver[] resolvers = getContext().getElResolvers();
+ return (resolvers != null && resolvers.length > 0);
}
}
\ No newline at end of file
Show replies by date