Author: vrubezhny
Date: 2009-12-18 20:47:05 -0500 (Fri, 18 Dec 2009)
New Revision: 19482
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java
Log:
JBIDE-5449: Unnecessary JSF EL expression proposal in CA for non web JSF project
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.java 2009-12-18
23:04:41 UTC (rev 19481)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.java 2009-12-19
01:47:05 UTC (rev 19482)
@@ -49,6 +49,9 @@
*/
@Override
protected void addTextELProposals(ContentAssistRequest contentAssistRequest) {
+ if (!isJsfProject())
+ return;
+
TextRegion prefix = getELPrefix(contentAssistRequest);
if (prefix == null || !prefix.isELStarted()) {
AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(true,
"#{}", //$NON-NLS-1$
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java 2009-12-18
23:04:41 UTC (rev 19481)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java 2009-12-19
01:47:05 UTC (rev 19482)
@@ -13,6 +13,8 @@
import java.util.List;
import java.util.Map;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.swt.graphics.Image;
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
@@ -285,6 +287,9 @@
@Override
protected void addAttributeValueELProposals(ContentAssistRequest contentAssistRequest)
{
+ if (!isJsfProject())
+ return;
+
TextRegion prefix = getELPrefix(contentAssistRequest);
if (prefix == null) {
return;
@@ -430,4 +435,23 @@
contentAssistRequest.addProposal(proposal);
}
}
+
+ /**
+ * A temporary fix to decide if JSF-tricks are to play
+ *
+ * @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;
+ }
}
\ No newline at end of file
Show replies by date