Author: vrubezhny
Date: 2009-05-22 14:45:32 -0400 (Fri, 22 May 2009)
New Revision: 15455
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java
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/JspContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java
Log:
JBIDE-2808: Improve/refactor org.jboss.tools.common.kb plugin.
The skeleton for initial implementation of new-style ContentAssistProcessors
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java 2009-05-22
18:39:41 UTC (rev 15454)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java 2009-05-22
18:45:32 UTC (rev 15455)
@@ -33,11 +33,13 @@
private IDocument fDocument;
private int fDocumentPosition;
+ private ELContext fContext;
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer,
int offset) {
this.fDocument = (viewer == null ? null : viewer.getDocument());
this.fDocumentPosition = offset;
+ this.fContext = createContext();
System.out.println("AbstractXMLContentAssistProcessor:
computeCompletionProposals() invoked");
try {
@@ -49,7 +51,9 @@
public IContextInformation[] computeContextInformation(ITextViewer viewer,
int offset) {
+ this.fDocument = (viewer == null ? null : viewer.getDocument());
this.fDocumentPosition = offset;
+ this.fContext = createContext();
return super.computeContextInformation(viewer, offset);
}
@@ -190,8 +194,12 @@
return contentAssistRequest;
}
- abstract protected ELContext getContext();
+ abstract protected ELContext createContext();
+ protected ELContext getContext() {
+ return this.fContext;
+ }
+
protected int getOffset() {
return this.fDocumentPosition;
}
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-05-22
18:39:41 UTC (rev 15454)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.java 2009-05-22
18:45:32 UTC (rev 15455)
@@ -22,8 +22,8 @@
public class FaceletPageContectAssistProcessor extends JspContentAssistProcessor {
@Override
- protected IPageContext getContext() {
- IPageContext superContext = super.getContext();
+ protected IPageContext createContext() {
+ IPageContext superContext = super.createContext();
FaceletPageContextImpl context = new FaceletPageContextImpl();
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-05-22
18:39:41 UTC (rev 15454)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java 2009-05-22
18:45:32 UTC (rev 15455)
@@ -26,8 +26,8 @@
public class JspContentAssistProcessor extends XmlContentAssistProcessor {
@Override
- protected IPageContext getContext() {
- ELContext superContext = super.getContext();
+ protected IPageContext createContext() {
+ ELContext superContext = super.createContext();
IFile file = getResource();
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-05-22
18:39:41 UTC (rev 15454)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java 2009-05-22
18:45:32 UTC (rev 15455)
@@ -9,7 +9,7 @@
public class XmlContentAssistProcessor extends AbstractXMLContentAssistProcessor {
@Override
- protected ELContext getContext() {
+ protected ELContext createContext() {
IFile file = getResource();
ElVarSearcher varSearcher = null; // TODO
ELResolver[] elResolvers = getELResolvers(file);