JBoss Tools SVN: r15457 - in trunk: jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-05-22 15:09:05 -0400 (Fri, 22 May 2009)
New Revision: 15457
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContext.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java
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
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2808
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContext.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContext.java 2009-05-22 18:56:43 UTC (rev 15456)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContext.java 2009-05-22 19:09:05 UTC (rev 15457)
@@ -31,11 +31,6 @@
Var[] getVars();
/**
- * @return
- */
- ElVarSearcher getVarSearcher();
-
- /**
* Returns EL Resolvers which are declared for this resource
* @return
*/
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java 2009-05-22 18:56:43 UTC (rev 15456)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java 2009-05-22 19:09:05 UTC (rev 15457)
@@ -26,7 +26,6 @@
protected IFile resource;
protected ELResolver[] elResolvers;
- protected ElVarSearcher varSearcher;
protected Map<Region, Set<Var>> vars = new HashMap<Region, Set<Var>>();
protected Set<Var> allVars = new HashSet<Var>();
@@ -56,21 +55,6 @@
/*
* (non-Javadoc)
- * @see org.jboss.tools.common.el.core.resolver.ELContext#getVarSearcher()
- */
- public ElVarSearcher getVarSearcher() {
- return varSearcher;
- }
-
- /**
- * @param varSearcher the varSearcher to set
- */
- public void setVarSearcher(ElVarSearcher varSearcher) {
- this.varSearcher = varSearcher;
- }
-
- /*
- * (non-Javadoc)
* @see org.jboss.tools.common.el.core.resolver.ELContext#getVars()
*/
public Var[] getVars() {
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:56:43 UTC (rev 15456)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java 2009-05-22 19:09:05 UTC (rev 15457)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.jst.jsp.contentassist;
import org.eclipse.core.filebuffers.FileBuffers;
@@ -34,7 +44,12 @@
private IDocument fDocument;
private int fDocumentPosition;
private ELContext fContext;
-
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.xml.ui.internal.contentassist.AbstractContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.text.ITextViewer, int)
+ */
+ @Override
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer,
int offset) {
this.fDocument = (viewer == null ? null : viewer.getDocument());
@@ -49,6 +64,11 @@
}
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.xml.ui.internal.contentassist.AbstractContentAssistProcessor#computeContextInformation(org.eclipse.jface.text.ITextViewer, int)
+ */
+ @Override
public IContextInformation[] computeContextInformation(ITextViewer viewer,
int offset) {
this.fDocument = (viewer == null ? null : viewer.getDocument());
@@ -58,18 +78,38 @@
return super.computeContextInformation(viewer, offset);
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.xml.ui.internal.contentassist.AbstractContentAssistProcessor#getCompletionProposalAutoActivationCharacters()
+ */
+ @Override
public char[] getCompletionProposalAutoActivationCharacters() {
return PROPOSAL_AUTO_ACTIVATION_CHARS;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.xml.ui.internal.contentassist.AbstractContentAssistProcessor#getContextInformationAutoActivationCharacters()
+ */
+ @Override
public char[] getContextInformationAutoActivationCharacters() {
return super.getContextInformationAutoActivationCharacters();
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.xml.ui.internal.contentassist.AbstractContentAssistProcessor#getContextInformationValidator()
+ */
+ @Override
public IContextInformationValidator getContextInformationValidator() {
return super.getContextInformationValidator();
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.xml.ui.internal.contentassist.AbstractContentAssistProcessor#getErrorMessage()
+ */
+ @Override
public String getErrorMessage() {
return super.getErrorMessage();
}
@@ -230,4 +270,4 @@
ELResolverFactoryManager elrfm = ELResolverFactoryManager.getInstance();
return elrfm.getResolvers(resource);
}
-}
+}
\ No newline at end of file
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:56:43 UTC (rev 15456)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.java 2009-05-22 19:09:05 UTC (rev 15457)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.jst.jsp.contentassist;
import java.util.Map;
@@ -21,6 +31,10 @@
public class FaceletPageContectAssistProcessor extends JspContentAssistProcessor {
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.jsp.contentassist.JspContentAssistProcessor#createContext()
+ */
@Override
protected IPageContext createContext() {
IPageContext superContext = super.createContext();
@@ -28,7 +42,6 @@
FaceletPageContextImpl context = new FaceletPageContextImpl();
context.setResource(superContext.getResource());
- context.setVarSearcher(superContext.getVarSearcher());
context.setElResolvers(superContext.getElResolvers());
setVars(context);
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:56:43 UTC (rev 15456)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java 2009-05-22 19:09:05 UTC (rev 15457)
@@ -1,7 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.jst.jsp.contentassist;
import java.util.List;
-import java.util.Map;
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.text.IRegion;
@@ -13,9 +22,6 @@
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
import org.jboss.tools.common.el.core.resolver.ELContext;
-import org.jboss.tools.common.el.core.resolver.ELResolver;
-import org.jboss.tools.common.el.core.resolver.ElVarSearcher;
-import org.jboss.tools.common.el.core.resolver.Var;
import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.kb.IResourceBundle;
import org.jboss.tools.jst.web.kb.internal.JspContextImpl;
@@ -25,6 +31,10 @@
public class JspContentAssistProcessor extends XmlContentAssistProcessor {
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.jsp.contentassist.XmlContentAssistProcessor#createContext()
+ */
@Override
protected IPageContext createContext() {
ELContext superContext = super.createContext();
@@ -33,7 +43,6 @@
JspContextImpl context = new JspContextImpl();
context.setResource(superContext.getResource());
- context.setVarSearcher(superContext.getVarSearcher());
context.setElResolvers(superContext.getElResolvers());
setVars(context);
context.setResourceBundles(getResourceBundles());
@@ -101,4 +110,4 @@
// TODO
return null;
}
-}
+}
\ No newline at end of file
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:56:43 UTC (rev 15456)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java 2009-05-22 19:09:05 UTC (rev 15457)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.jst.jsp.contentassist;
import org.eclipse.core.resources.IFile;
@@ -4,27 +14,27 @@
import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.el.core.resolver.ELContextImpl;
import org.jboss.tools.common.el.core.resolver.ELResolver;
-import org.jboss.tools.common.el.core.resolver.ElVarSearcher;
public class XmlContentAssistProcessor extends AbstractXMLContentAssistProcessor {
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.jsp.contentassist.AbstractXMLContentAssistProcessor#createContext()
+ */
@Override
protected ELContext createContext() {
IFile file = getResource();
- ElVarSearcher varSearcher = null; // TODO
ELResolver[] elResolvers = getELResolvers(file);
ELContextImpl context = new ELContextImpl();
context.setResource(getResource());
- context.setVarSearcher(varSearcher);
context.setElResolvers(elResolvers);
setVars(context);
-
+
return context;
}
-
+
protected void setVars(ELContext context) {
// TODO
}
-
-}
+}
\ No newline at end of file
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 2009-05-22 18:56:43 UTC (rev 15456)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java 2009-05-22 19:09:05 UTC (rev 15457)
@@ -141,7 +141,7 @@
}
ELOperandResolveStatus status = null;
try {
- status = resolveELOperand(context.getResource(), operand, returnEqualedVariablesOnly, vars, context.getVarSearcher());
+ status = resolveELOperand(context.getResource(), operand, returnEqualedVariablesOnly, vars, new ElVarSearcher(context.getResource(), this));
} catch (StringIndexOutOfBoundsException e) {
SeamCorePlugin.getPluginLog().logError(e);
} catch (BadLocationException e) {
15 years, 4 months
JBoss Tools SVN: r15456 - trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-05-22 14:56:43 -0400 (Fri, 22 May 2009)
New Revision: 15456
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2808
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java 2009-05-22 18:45:32 UTC (rev 15455)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java 2009-05-22 18:56:43 UTC (rev 15456)
@@ -15,7 +15,6 @@
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
import org.jboss.tools.common.el.core.resolver.ELContextImpl;
import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.kb.IResourceBundle;
15 years, 4 months
JBoss Tools SVN: r15455 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist.
by jbosstools-commits@lists.jboss.org
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);
15 years, 4 months
JBoss Tools SVN: r15454 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-05-22 14:39:41 -0400 (Fri, 22 May 2009)
New Revision: 15454
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.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/FaceletPageContectAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.java 2009-05-22 18:10:43 UTC (rev 15453)
+++ 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)
@@ -1,7 +1,23 @@
package org.jboss.tools.jst.jsp.contentassist;
+import java.util.Map;
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.Region;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.kb.internal.FaceletPageContextImpl;
+import org.jboss.tools.jst.web.kb.taglib.INameSpace;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
public class FaceletPageContectAssistProcessor extends JspContentAssistProcessor {
@@ -28,6 +44,114 @@
}
protected void setNameSpaces(IPageContext superContext, FaceletPageContextImpl context) {
- // TODO
+ IStructuredModel sModel = StructuredModelManager
+ .getModelManager()
+ .getExistingModelForRead(getDocument());
+ if (superContext != null) {
+ IRegion region = new Region (0, getDocument().getLength());
+ Map<String, INameSpace> nameSpaces = superContext.getNameSpaces(getOffset());
+ for (String prefix : nameSpaces.keySet()) {
+ context.addNameSpace(region, nameSpaces.get(prefix));
+ }
+ }
+
+ try {
+ if (sModel == null)
+ return;
+
+ Document xmlDocument = (sModel instanceof IDOMModel) ? ((IDOMModel) sModel)
+ .getDocument()
+ : null;
+
+ if (xmlDocument == null)
+ return;
+
+ Node n = findNodeForOffset(xmlDocument, getOffset());
+ while (n != null) {
+ if (!(n instanceof Element)) {
+ if (n instanceof Attr) {
+ n = ((Attr) n).getOwnerElement();
+ } else {
+ n = n.getParentNode();
+ }
+ continue;
+ }
+
+ NamedNodeMap attrs = n.getAttributes();
+ for (int j = 0; attrs != null && j < attrs.getLength(); j++) {
+ Attr a = (Attr) attrs.item(j);
+ String name = a.getName();
+ if (name.startsWith("xmlns:")) {
+ final String prefix = name.substring("xmlns:".length());
+ final String uri = a.getValue();
+ if (prefix != null && prefix.trim().length() > 0 &&
+ uri != null && uri.trim().length() > 0) {
+
+ // TODO: Check the IRegion instance creation
+ IRegion region = new Region(
+ ((IndexedRegion)n).getStartOffset(),
+ ((IndexedRegion)n).getLength());
+
+ INameSpace nameSpace = new INameSpace(){
+
+ public String getURI() {
+ return uri.trim();
+ }
+
+ public String getPrefix() {
+ return prefix.trim();
+ }
+ };
+ context.addNameSpace(region, nameSpace);
+ }
+ }
+ }
+
+ n = n.getParentNode();
+ }
+
+ return;
+ } finally {
+ if (sModel != null) {
+ sModel.releaseFromRead();
+ }
+ }
}
+
+
+ /* Utility functions */
+ private Node findNodeForOffset(IDOMNode node, int offset) {
+ if(node == null) return null;
+ if (!node.contains(offset)) return null;
+
+ if (node.hasChildNodes()) {
+ // Try to find the node in children
+ NodeList children = node.getChildNodes();
+ for (int i = 0; children != null && i < children.getLength(); i++) {
+ IDOMNode child = (IDOMNode)children.item(i);
+ if (child.contains(offset)) {
+ return findNodeForOffset(child, offset);
+ }
+ }
+ }
+ // Not found in children or nave no children
+ if (node.hasAttributes()) {
+ // Try to find in the node attributes
+ NamedNodeMap attributes = node.getAttributes();
+
+ for (int i = 0; attributes != null && i < attributes.getLength(); i++) {
+ IDOMNode attr = (IDOMNode)attributes.item(i);
+ if (attr.contains(offset)) {
+ return attr;
+ }
+ }
+ }
+ // Return the node itself
+ return node;
+ }
+
+ private Node findNodeForOffset(Node node, int offset) {
+ return (node instanceof IDOMNode) ? findNodeForOffset((IDOMNode)node, offset) : null;
+ }
+
}
15 years, 4 months
JBoss Tools SVN: r15453 - in trunk/jst/plugins/org.jboss.tools.jst.jsp: src/org/jboss/tools/jst/jsp/contentassist and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-05-22 14:10:43 -0400 (Fri, 22 May 2009)
New Revision: 15453
Added:
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
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF
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/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF 2009-05-22 18:04:25 UTC (rev 15452)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF 2009-05-22 18:10:43 UTC (rev 15453)
@@ -57,7 +57,8 @@
org.eclipse.wst.common.uriresolver,
org.eclipse.core.resources,
org.eclipse.core.runtime,
- org.eclipse.ui.views
+ org.eclipse.ui.views,
+ org.jboss.tools.jst.web.kb;bundle-version="1.0.0"
Bundle-Version: 2.0.0
Export-Package: org.jboss.tools.jst.jsp.outline.cssdialog.common,
org.jboss.tools.jst.jsp.outline.cssdialog.events,
Added: 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 (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java 2009-05-22 18:10:43 UTC (rev 15453)
@@ -0,0 +1,225 @@
+package org.jboss.tools.jst.jsp.contentassist;
+
+import org.eclipse.core.filebuffers.FileBuffers;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.IContextInformation;
+import org.eclipse.jface.text.contentassist.IContextInformationValidator;
+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.sse.core.internal.provisional.text.ITextRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
+import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
+import org.eclipse.wst.xml.ui.internal.contentassist.AbstractContentAssistProcessor;
+import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
+import org.jboss.tools.common.el.core.resolver.ELContext;
+import org.jboss.tools.common.el.core.resolver.ELResolver;
+import org.jboss.tools.common.el.core.resolver.ELResolverFactoryManager;
+import org.w3c.dom.Node;
+
+abstract public class AbstractXMLContentAssistProcessor extends AbstractContentAssistProcessor {
+ private static final char[] PROPOSAL_AUTO_ACTIVATION_CHARS = new char[] {
+ '<', '=', '"', '\'', '.'
+ };
+
+ private IDocument fDocument;
+ private int fDocumentPosition;
+
+ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer,
+ int offset) {
+ this.fDocument = (viewer == null ? null : viewer.getDocument());
+ this.fDocumentPosition = offset;
+
+ System.out.println("AbstractXMLContentAssistProcessor: computeCompletionProposals() invoked");
+ try {
+ return super.computeCompletionProposals(viewer, offset);
+ } finally {
+ System.out.println("AbstractXMLContentAssistProcessor: computeCompletionProposals() exited");
+ }
+ }
+
+ public IContextInformation[] computeContextInformation(ITextViewer viewer,
+ int offset) {
+ this.fDocumentPosition = offset;
+
+ return super.computeContextInformation(viewer, offset);
+ }
+
+ public char[] getCompletionProposalAutoActivationCharacters() {
+ return PROPOSAL_AUTO_ACTIVATION_CHARS;
+ }
+
+ public char[] getContextInformationAutoActivationCharacters() {
+ return super.getContextInformationAutoActivationCharacters();
+ }
+
+ public IContextInformationValidator getContextInformationValidator() {
+ return super.getContextInformationValidator();
+ }
+
+ public String getErrorMessage() {
+ return super.getErrorMessage();
+ }
+
+
+
+ /* the methods to be overriden in derived classes */
+
+ protected void addAttributeNameProposals(ContentAssistRequest contentAssistRequest) {
+ System.out.println("AbstractXMLContentAssistProcessor: addAttributeNameProposals() invoked");
+ }
+
+ protected void addAttributeValueProposals(ContentAssistRequest contentAssistRequest) {
+
+ IDOMNode node = (IDOMNode) contentAssistRequest.getNode();
+
+ // Find the attribute region and name for which this position should
+ // have a value proposed
+ IStructuredDocumentRegion open = node.getFirstStructuredDocumentRegion();
+ ITextRegionList openRegions = open.getRegions();
+ int i = openRegions.indexOf(contentAssistRequest.getRegion());
+ if (i < 0) {
+ return;
+ }
+ ITextRegion nameRegion = null;
+ while (i >= 0) {
+ nameRegion = openRegions.get(i--);
+ if (nameRegion.getType() == DOMRegionContext.XML_TAG_ATTRIBUTE_NAME) {
+ break;
+ }
+ }
+
+ // the name region is REQUIRED to do anything useful
+ if (nameRegion != null) {
+ // Retrieve the declaration
+ CMElementDeclaration elementDecl = getCMElementDeclaration(node);
+
+ // String attributeName = nameRegion.getText();
+ String attributeName = open.getText(nameRegion);
+ String currentValue = node.getAttributes().getNamedItem(attributeName).getNodeValue();
+ String currentValueText = ((IDOMAttr)node.getAttributes().getNamedItem(attributeName)).getValueRegionText();
+ ITextRegion currentValueRegion = ((IDOMAttr)node.getAttributes().getNamedItem(attributeName)).getValueRegion();
+
+
+
+ ITextRegion invokeRegion = contentAssistRequest.getRegion();
+ int pos = contentAssistRequest.getRegion().getStart();
+ int replBegin = contentAssistRequest.getReplacementBeginPosition();
+ int invokeRegionEnd = invokeRegion.getStart() + invokeRegion.getLength();
+ IDOMAttr attrNode = (IDOMAttr)node.getAttributes().getNamedItem(attributeName);
+ int valueRegionStartOffset = attrNode.getValueRegionStartOffset();
+ ITextRegion eqRegion = attrNode.getEqualRegion();
+ int eqRegionEnd= eqRegion.getStart() + eqRegion.getLength();
+ int attrValueEnd=eqRegionEnd + currentValueText.length();
+ int attrTextEnd = invokeRegion.getTextEnd();
+ // attrNode.getValueRegionText()
+ System.out.println("AbstractXMLContentAssistProcessor: addAttributeValueProposals() invoked");
+ }
+ else {
+ setErrorMessage(UNKNOWN_CONTEXT);
+ }
+ }
+
+ protected void addCommentProposal(ContentAssistRequest contentAssistRequest) {
+ System.out.println("AbstractXMLContentAssistProcessor: addCommentProposal() invoked");
+ }
+
+ protected void addDocTypeProposal(ContentAssistRequest contentAssistRequest) {
+ System.out.println("AbstractXMLContentAssistProcessor: addDocTypeProposal() invoked");
+ }
+
+ protected void addEmptyDocumentProposals(ContentAssistRequest contentAssistRequest) {
+ System.out.println("AbstractXMLContentAssistProcessor: addEmptyDocumentProposals() invoked");
+ }
+
+ protected void addEndTagNameProposals(ContentAssistRequest contentAssistRequest) {
+ System.out.println("AbstractXMLContentAssistProcessor: addEndTagNameProposals() invoked");
+ }
+
+ protected void addEndTagProposals(ContentAssistRequest contentAssistRequest) {
+ System.out.println("AbstractXMLContentAssistProcessor: addEndTagProposals() invoked");
+ }
+
+ protected void addEntityProposals(ContentAssistRequest contentAssistRequest, int documentPosition, ITextRegion completionRegion, IDOMNode treeNode) {
+ System.out.println("AbstractXMLContentAssistProcessor: addEntityProposals() invoked");
+ }
+
+ protected void addPCDATAProposal(String nodeName, ContentAssistRequest contentAssistRequest) {
+ System.out.println("AbstractXMLContentAssistProcessor: addPCDATAProposal() invoked");
+ }
+
+ protected void addStartDocumentProposals(ContentAssistRequest contentAssistRequest) {
+ System.out.println("AbstractXMLContentAssistProcessor: addStartDocumentProposals() invoked");
+ }
+
+ protected void addTagCloseProposals(ContentAssistRequest contentAssistRequest) {
+ System.out.println("AbstractXMLContentAssistProcessor: addTagCloseProposals() invoked");
+ }
+
+ protected void addTagInsertionProposals(ContentAssistRequest contentAssistRequest, int childPosition) {
+ System.out.println("AbstractXMLContentAssistProcessor: addTagInsertionProposals() invoked");
+ }
+
+ protected void addTagNameProposals(ContentAssistRequest contentAssistRequest, int childPosition) {
+ System.out.println("AbstractXMLContentAssistProcessor: addTagNameProposals() invoked");
+ }
+
+ protected ContentAssistRequest computeCompletionProposals(int documentPosition, String matchString, ITextRegion completionRegion, IDOMNode treeNode, IDOMNode xmlnode) {
+ ContentAssistRequest contentAssistRequest = super.computeCompletionProposals(documentPosition, matchString, completionRegion, treeNode, xmlnode);
+
+ String regionType = completionRegion.getType();
+ IStructuredDocumentRegion sdRegion = getStructuredDocumentRegion(documentPosition);
+
+ /*
+ * Jeremy: Add attribute name proposals before empty tag close
+ */
+ if ((xmlnode.getNodeType() == Node.ELEMENT_NODE) || (xmlnode.getNodeType() == Node.DOCUMENT_NODE)) {
+ if (regionType == DOMRegionContext.XML_EMPTY_TAG_CLOSE) {
+ addAttributeNameProposals(contentAssistRequest);
+ }
+ }
+ return contentAssistRequest;
+ }
+
+ abstract protected ELContext getContext();
+
+ protected int getOffset() {
+ return this.fDocumentPosition;
+ }
+
+ protected IDocument getDocument() {
+ return this.fDocument;
+ }
+
+ protected IFile getResource() {
+ IStructuredModel sModel = StructuredModelManager.getModelManager().getExistingModelForRead(fTextViewer.getDocument());
+ try {
+ if (sModel != null) {
+ String baseLocation = sModel.getBaseLocation();
+ IPath location = new Path(baseLocation).makeAbsolute();
+ IFile resource = FileBuffers.getWorkspaceFileAtLocation(location);
+ return resource;
+ }
+ }
+ finally {
+ if (sModel != null) {
+ sModel.releaseFromRead();
+ }
+ }
+ return null;
+ }
+
+ ELResolver[] getELResolvers(IResource resource) {
+ ELResolverFactoryManager elrfm = ELResolverFactoryManager.getInstance();
+ return elrfm.getResolvers(resource);
+ }
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: 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 (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.java 2009-05-22 18:10:43 UTC (rev 15453)
@@ -0,0 +1,33 @@
+package org.jboss.tools.jst.jsp.contentassist;
+
+import org.jboss.tools.jst.web.kb.IPageContext;
+import org.jboss.tools.jst.web.kb.internal.FaceletPageContextImpl;
+
+public class FaceletPageContectAssistProcessor extends JspContentAssistProcessor {
+
+ @Override
+ protected IPageContext getContext() {
+ IPageContext superContext = super.getContext();
+
+
+ FaceletPageContextImpl context = new FaceletPageContextImpl();
+ context.setResource(superContext.getResource());
+ context.setVarSearcher(superContext.getVarSearcher());
+ context.setElResolvers(superContext.getElResolvers());
+ setVars(context);
+
+ context.setResourceBundles(superContext.getResourceBundles());
+ context.setDocument(getDocument());
+ setNameSpaces(superContext, context);
+ context.setLibraries(getTagLibraries(context));
+
+// IFaceletPageContext getParentContext();
+// Map<String, String> getParams();
+
+ return context;
+ }
+
+ protected void setNameSpaces(IPageContext superContext, FaceletPageContextImpl context) {
+ // TODO
+ }
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: 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 (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java 2009-05-22 18:10:43 UTC (rev 15453)
@@ -0,0 +1,104 @@
+package org.jboss.tools.jst.jsp.contentassist;
+
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.Region;
+import org.eclipse.jst.jsp.core.internal.contentmodel.TaglibController;
+import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TLDCMDocumentManager;
+import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TaglibTracker;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.jboss.tools.common.el.core.resolver.ELContext;
+import org.jboss.tools.common.el.core.resolver.ELResolver;
+import org.jboss.tools.common.el.core.resolver.ElVarSearcher;
+import org.jboss.tools.common.el.core.resolver.Var;
+import org.jboss.tools.jst.web.kb.IPageContext;
+import org.jboss.tools.jst.web.kb.IResourceBundle;
+import org.jboss.tools.jst.web.kb.internal.JspContextImpl;
+import org.jboss.tools.jst.web.kb.taglib.INameSpace;
+import org.jboss.tools.jst.web.kb.taglib.ITagLibrary;
+import org.w3c.dom.Document;
+
+public class JspContentAssistProcessor extends XmlContentAssistProcessor {
+
+ @Override
+ protected IPageContext getContext() {
+ ELContext superContext = super.getContext();
+
+ IFile file = getResource();
+
+ JspContextImpl context = new JspContextImpl();
+ context.setResource(superContext.getResource());
+ context.setVarSearcher(superContext.getVarSearcher());
+ context.setElResolvers(superContext.getElResolvers());
+ setVars(context);
+ context.setResourceBundles(getResourceBundles());
+ context.setDocument(getDocument());
+ setNameSpaces(context);
+ context.setLibraries(getTagLibraries(context));
+
+ return context;
+ }
+
+ protected void setNameSpaces(JspContextImpl context) {
+ IStructuredModel sModel = StructuredModelManager
+ .getModelManager()
+ .getExistingModelForRead(getDocument());
+ try {
+ if (sModel == null)
+ return;
+
+ Document xmlDocument = (sModel instanceof IDOMModel) ?
+ ((IDOMModel) sModel).getDocument() :
+ null;
+
+ if (xmlDocument == null)
+ return;
+
+ TLDCMDocumentManager manager = TaglibController.getTLDCMDocumentManager(getDocument());
+ List trackers = (manager == null? null : manager.getCMDocumentTrackers(getOffset()));
+ for (int i = 0; trackers != null && i < trackers.size(); i++) {
+ TaglibTracker tt = (TaglibTracker)trackers.get(i);
+ final String prefix = tt.getPrefix();
+ final String uri = tt.getURI();
+ if (prefix != null && prefix.trim().length() > 0 &&
+ uri != null && uri.trim().length() > 0) {
+
+ IRegion region = new Region(0, getDocument().getLength());
+ INameSpace nameSpace = new INameSpace(){
+
+ public String getURI() {
+ return uri.trim();
+ }
+
+ public String getPrefix() {
+ return prefix.trim();
+ }
+ };
+ context.addNameSpace(region, nameSpace);
+ }
+ }
+
+ return;
+ }
+ finally {
+ if (sModel != null) {
+ sModel.releaseFromRead();
+ }
+ }
+ }
+
+ protected ITagLibrary[] getTagLibraries(IPageContext context) {
+ // TODO
+ return null;
+ }
+
+ protected IResourceBundle[] getResourceBundles() {
+ // TODO
+ return null;
+ }
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: 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 (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java 2009-05-22 18:10:43 UTC (rev 15453)
@@ -0,0 +1,30 @@
+package org.jboss.tools.jst.jsp.contentassist;
+
+import org.eclipse.core.resources.IFile;
+import org.jboss.tools.common.el.core.resolver.ELContext;
+import org.jboss.tools.common.el.core.resolver.ELContextImpl;
+import org.jboss.tools.common.el.core.resolver.ELResolver;
+import org.jboss.tools.common.el.core.resolver.ElVarSearcher;
+
+public class XmlContentAssistProcessor extends AbstractXMLContentAssistProcessor {
+
+ @Override
+ protected ELContext getContext() {
+ IFile file = getResource();
+ ElVarSearcher varSearcher = null; // TODO
+ ELResolver[] elResolvers = getELResolvers(file);
+
+ ELContextImpl context = new ELContextImpl();
+ context.setResource(getResource());
+ context.setVarSearcher(varSearcher);
+ context.setElResolvers(elResolvers);
+ setVars(context);
+
+ return context;
+ }
+
+ protected void setVars(ELContext context) {
+ // TODO
+ }
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 4 months
JBoss Tools SVN: r15452 - trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-05-22 14:04:25 -0400 (Fri, 22 May 2009)
New Revision: 15452
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java
Log:
JBIDE-2808: Improve/refactor org.jboss.tools.common.kb plugin.
Minimal implementation changes (Region in replaced by IRegion)
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java 2009-05-22 17:54:17 UTC (rev 15451)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java 2009-05-22 18:04:25 UTC (rev 15452)
@@ -14,6 +14,7 @@
import java.util.Map;
import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
import org.jboss.tools.common.el.core.resolver.ELContextImpl;
import org.jboss.tools.jst.web.kb.IPageContext;
@@ -26,12 +27,13 @@
* @author Alexey Kazakov
*/
public class JspContextImpl extends ELContextImpl implements IPageContext {
-
protected IDocument document;
protected ITagLibrary[] libs;
- protected Map<Region, Map<String, INameSpace>> nameSpaces = new HashMap<Region, Map<String, INameSpace>>();
+ protected Map<IRegion, Map<String, INameSpace>> nameSpaces = new HashMap<IRegion, Map<String, INameSpace>>();
protected IResourceBundle[] bundles;
+
+
/*
* (non-Javadoc)
* @see org.jboss.tools.common.kb.text.PageContext#getLibraries()
@@ -80,7 +82,7 @@
*/
public Map<String, INameSpace> getNameSpaces(int offset) {
Map<String, INameSpace> result = new HashMap<String, INameSpace>();
- for (Region region : nameSpaces.keySet()) {
+ for (IRegion region : nameSpaces.keySet()) {
if(offset>=region.getOffset() && offset<=region.getOffset() + region.getLength()) {
result.putAll(nameSpaces.get(region));
}
@@ -93,7 +95,7 @@
* @param region
* @param name space
*/
- public void addNameSpace(Region region, INameSpace nameSpace) {
+ public void addNameSpace(IRegion region, INameSpace nameSpace) {
nameSpaces.get(region).put(nameSpace.getPrefix(), nameSpace);
}
}
\ No newline at end of file
15 years, 4 months
JBoss Tools SVN: r15451 - trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-05-22 13:54:17 -0400 (Fri, 22 May 2009)
New Revision: 15451
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2808
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java 2009-05-22 16:34:32 UTC (rev 15450)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java 2009-05-22 17:54:17 UTC (rev 15451)
@@ -703,16 +703,18 @@
private ITagLibrary[] allLibrariesArray = null;
Map<IPath, Set<ITagLibrary>> librariesBySource = new HashMap<IPath, Set<ITagLibrary>>();
Map<String, Set<ITagLibrary>> librariesByUri = new HashMap<String, Set<ITagLibrary>>();
- private ITagLibrary[] librariesByUriArray = null;
+ private Map<String,ITagLibrary[]> librariesByUriArray = new HashMap<String, ITagLibrary[]>();
public void clear() {
synchronized(allLibraries) {
allLibraries.clear();
allLibrariesArray = null;
- librariesByUriArray = null;
}
librariesBySource.clear();
- librariesByUri.clear();
+ synchronized (librariesByUri) {
+ librariesByUri.clear();
+ librariesByUriArray.clear();
+ }
}
public ITagLibrary[] getAllLibrariesArray() {
@@ -725,17 +727,19 @@
}
public ITagLibrary[] getLibrariesArray(String uri) {
- if(librariesByUriArray == null) {
+ ITagLibrary[] result = librariesByUriArray.get(uri);
+ if(result == null) {
synchronized(librariesByUri) {
Set<ITagLibrary> libs = librariesByUri.get(uri);
if(libs!=null) {
- librariesByUriArray = libs.toArray(new ITagLibrary[0]);
+ result = libs.toArray(new ITagLibrary[0]);
} else {
- librariesByUriArray = new ITagLibrary[0];
+ result = new ITagLibrary[0];
}
+ librariesByUriArray.put(uri, result);
}
}
- return librariesByUriArray;
+ return result;
}
public Set<ITagLibrary> getLibrariesBySource(IPath path) {
@@ -746,7 +750,6 @@
synchronized(allLibraries) {
allLibraries.add(f);
allLibrariesArray = null;
- librariesByUriArray = null;
}
IPath path = f.getSourcePath();
if(path != null) {
@@ -758,19 +761,21 @@
fs.add(f);
}
String uri = f.getURI();
- Set<ITagLibrary> ul = librariesByUri.get(uri);
- if(ul==null) {
- ul = new HashSet<ITagLibrary>();
- librariesByUri.put(uri, ul);
+ synchronized (librariesByUri) {
+ librariesByUriArray.remove(uri);
+ Set<ITagLibrary> ul = librariesByUri.get(uri);
+ if (ul == null) {
+ ul = new HashSet<ITagLibrary>();
+ librariesByUri.put(uri, ul);
+ }
+ ul.add(f);
}
- ul.add(f);
}
public void removeLibrary(ITagLibrary f) {
synchronized(allLibraries) {
allLibraries.remove(f);
allLibrariesArray = null;
- librariesByUriArray = null;
}
IPath path = f.getSourcePath();
if(path != null) {
@@ -783,13 +788,16 @@
}
}
String uri = f.getURI();
- Set<ITagLibrary> ul = librariesByUri.get(uri);
- if(ul!=null) {
- ul.remove(f);
+ synchronized (librariesByUri) {
+ Set<ITagLibrary> ul = librariesByUri.get(uri);
+ librariesByUriArray.remove(uri);
+ if (ul != null) {
+ ul.remove(f);
+ if (ul.isEmpty()) {
+ librariesByUri.remove(uri);
+ }
+ }
}
- if(ul.isEmpty()) {
- librariesByUri.remove(uri);
- }
}
public Set<ITagLibrary> removePath(IPath path) {
@@ -798,12 +806,16 @@
for (ITagLibrary f: fs) {
synchronized(allLibraries) {
allLibraries.remove(f);
+ allLibrariesArray = null;
}
synchronized (librariesByUri) {
- librariesByUri.remove(f.getURI());
+ Set<ITagLibrary> s = librariesByUri.get(f.getURI());
+ if(s != null) s.remove(f);
+ if(s != null && s.isEmpty()) {
+ librariesByUri.remove(f.getURI());
+ }
+ librariesByUriArray.remove(f.getURI());
}
- allLibrariesArray = null;
- librariesByUriArray = null;
}
librariesBySource.remove(path);
return fs;
15 years, 4 months
JBoss Tools SVN: r15450 - trunk/as/docs/reference/en/images/runtimes_servers.
by jbosstools-commits@lists.jboss.org
Author: chukhutsina
Date: 2009-05-22 12:34:32 -0400 (Fri, 22 May 2009)
New Revision: 15450
Modified:
trunk/as/docs/reference/en/images/runtimes_servers/runtimes_servers_3.png
Log:
<html><head><meta name="qrichtext" content="1" /></head><body style="font-size:9pt;font-family:Sans Serif">
<p>https://jira.jboss.org/jira/browse/JBDS-732 -According to the new features of JBoss AS profile the screen where it's used was updated. </p>
</body></html>
Modified: trunk/as/docs/reference/en/images/runtimes_servers/runtimes_servers_3.png
===================================================================
(Binary files differ)
15 years, 4 months
JBoss Tools SVN: r15449 - trunk/documentation/guides/GettingStartedGuide/en/images/manage.
by jbosstools-commits@lists.jboss.org
Author: chukhutsina
Date: 2009-05-22 12:34:07 -0400 (Fri, 22 May 2009)
New Revision: 15449
Modified:
trunk/documentation/guides/GettingStartedGuide/en/images/manage/manage_11.png
Log:
<html><head><meta name="qrichtext" content="1" /></head><body style="font-size:9pt;font-family:Sans Serif">
<p>https://jira.jboss.org/jira/browse/JBDS-732 -According to the new features of JBoss AS profile the screen where it's used was updated. </p>
</body></html>
Modified: trunk/documentation/guides/GettingStartedGuide/en/images/manage/manage_11.png
===================================================================
(Binary files differ)
15 years, 4 months
JBoss Tools SVN: r15448 - in trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb: internal and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-05-22 12:28:12 -0400 (Fri, 22 May 2009)
New Revision: 15448
Removed:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/FaceletContextImpl.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/TagLibriryManager.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2808
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java 2009-05-22 16:25:10 UTC (rev 15447)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java 2009-05-22 16:28:12 UTC (rev 15448)
@@ -11,6 +11,9 @@
package org.jboss.tools.jst.web.kb;
import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.text.IDocument;
+import org.jboss.tools.common.el.core.resolver.ELResolverFactoryManager;
+import org.jboss.tools.jst.web.kb.internal.JspContextImpl;
/**
* @author Alexey Kazakov
@@ -19,7 +22,7 @@
/**
* Creates a page context for given resource and offset.
- * @param file
+ * @param file JSP or Facelet
* @param offset
* @return
*/
@@ -29,8 +32,37 @@
}
/**
+ * Creates a jsp context for given resource and offset.
+ * @param file JSP
+ * @param offset
+ * @return
+ */
+ public static IPageContext createJSPContext(IFile file, int offset) {
+ JspContextImpl context = new JspContextImpl();
+// context.s
+ // TODO
+ return null;
+ }
+
+ /**
+ * Creates a jsp context for given resource, document and offset.
+ * @param file JSP
+ * @param offset
+ * @param document
+ * @return
+ */
+ public static IPageContext createJSPContext(IFile file, IDocument document, int offset) {
+ JspContextImpl context = new JspContextImpl();
+ context.setDocument(document);
+ context.setElResolvers(ELResolverFactoryManager.getInstance().getResolvers(file));
+// context.s
+ // TODO
+ return null;
+ }
+
+ /**
* Creates a facelet context for given resource and offset.
- * @param file
+ * @param file Facelet
* @param offset
* @return
*/
Deleted: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/FaceletContextImpl.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/FaceletContextImpl.java 2009-05-22 16:25:10 UTC (rev 15447)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/FaceletContextImpl.java 2009-05-22 16:28:12 UTC (rev 15448)
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jst.web.kb.internal;
-
-import java.util.Map;
-
-import org.jboss.tools.jst.web.kb.IFaceletPageContext;
-
-/**
- * Facelet page context
- * @author Alexey Kazakov
- */
-public class FaceletContextImpl extends JspContextImpl implements IFaceletPageContext {
-
- private IFaceletPageContext parentContext;
- private Map<String, String> params;
-
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.common.kb.text.FaceletPageContext#getParentContext()
- */
- public IFaceletPageContext getParentContext() {
- return parentContext;
- }
-
- public void setParentContext(IFaceletPageContext parentContext) {
- this.parentContext = parentContext;
- }
-
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.common.kb.text.FaceletPageContext#getParams()
- */
- public Map<String, String> getParams() {
- return params;
- }
-
- public void setParams(Map<String, String> params) {
- this.params = params;
- }
-}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java 2009-05-22 16:25:10 UTC (rev 15447)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java 2009-05-22 16:28:12 UTC (rev 15448)
@@ -61,20 +61,6 @@
}
/**
- * @return the libs
- */
- public ITagLibrary[] getLibs() {
- return libs;
- }
-
- /**
- * @param libs the libs to set
- */
- public void setLibs(ITagLibrary[] libs) {
- this.libs = libs;
- }
-
- /**
* @param document the document to set
*/
public void setDocument(IDocument document) {
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java 2009-05-22 16:25:10 UTC (rev 15447)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java 2009-05-22 16:28:12 UTC (rev 15448)
@@ -68,26 +68,59 @@
LibraryStorage libraries = new LibraryStorage();
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.IKbProject#getTagLibraries()
+ */
public ITagLibrary[] getTagLibraries() {
return libraries.getAllLibrariesArray();
}
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.IKbProject#getTagLibraries(java.lang.String)
+ */
+ public ITagLibrary[] getTagLibraries(String uri) {
+ return libraries.getLibrariesArray(uri);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.resources.IProjectNature#configure()
+ */
public void configure() throws CoreException {
addToBuildSpec(KbBuilder.BUILDER_ID);
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.resources.IProjectNature#deconfigure()
+ */
public void deconfigure() throws CoreException {
removeFromBuildSpec(KbBuilder.BUILDER_ID);
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.resources.IProjectNature#getProject()
+ */
public IProject getProject() {
return project;
}
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.internal.KbObject#getKbProject()
+ */
+ @Override
public IKbProject getKbProject() {
return this;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.resources.IProjectNature#setProject(org.eclipse.core.resources.IProject)
+ */
public void setProject(IProject project) {
this.project = project;
setSourcePath(project.getFullPath());
@@ -669,34 +702,51 @@
private Set<ITagLibrary> allLibraries = new HashSet<ITagLibrary>();
private ITagLibrary[] allLibrariesArray = null;
Map<IPath, Set<ITagLibrary>> librariesBySource = new HashMap<IPath, Set<ITagLibrary>>();
+ Map<String, Set<ITagLibrary>> librariesByUri = new HashMap<String, Set<ITagLibrary>>();
+ private ITagLibrary[] librariesByUriArray = null;
public void clear() {
synchronized(allLibraries) {
allLibraries.clear();
allLibrariesArray = null;
+ librariesByUriArray = null;
}
librariesBySource.clear();
+ librariesByUri.clear();
}
public ITagLibrary[] getAllLibrariesArray() {
- ITagLibrary[] result = allLibrariesArray;
- if(result == null) {
+ if(allLibrariesArray == null) {
synchronized(allLibraries) {
allLibrariesArray = allLibraries.toArray(new ITagLibrary[0]);
- result = allLibrariesArray;
}
}
- return result;
+ return allLibrariesArray;
}
+ public ITagLibrary[] getLibrariesArray(String uri) {
+ if(librariesByUriArray == null) {
+ synchronized(librariesByUri) {
+ Set<ITagLibrary> libs = librariesByUri.get(uri);
+ if(libs!=null) {
+ librariesByUriArray = libs.toArray(new ITagLibrary[0]);
+ } else {
+ librariesByUriArray = new ITagLibrary[0];
+ }
+ }
+ }
+ return librariesByUriArray;
+ }
+
public Set<ITagLibrary> getLibrariesBySource(IPath path) {
return librariesBySource.get(path);
}
-
+
public void addLibrary(ITagLibrary f) {
synchronized(allLibraries) {
allLibraries.add(f);
allLibrariesArray = null;
+ librariesByUriArray = null;
}
IPath path = f.getSourcePath();
if(path != null) {
@@ -707,12 +757,20 @@
}
fs.add(f);
}
+ String uri = f.getURI();
+ Set<ITagLibrary> ul = librariesByUri.get(uri);
+ if(ul==null) {
+ ul = new HashSet<ITagLibrary>();
+ librariesByUri.put(uri, ul);
+ }
+ ul.add(f);
}
-
+
public void removeLibrary(ITagLibrary f) {
synchronized(allLibraries) {
allLibraries.remove(f);
allLibrariesArray = null;
+ librariesByUriArray = null;
}
IPath path = f.getSourcePath();
if(path != null) {
@@ -724,6 +782,14 @@
librariesBySource.remove(fs);
}
}
+ String uri = f.getURI();
+ Set<ITagLibrary> ul = librariesByUri.get(uri);
+ if(ul!=null) {
+ ul.remove(f);
+ }
+ if(ul.isEmpty()) {
+ librariesByUri.remove(uri);
+ }
}
public Set<ITagLibrary> removePath(IPath path) {
@@ -732,21 +798,16 @@
for (ITagLibrary f: fs) {
synchronized(allLibraries) {
allLibraries.remove(f);
- allLibrariesArray = null;
}
+ synchronized (librariesByUri) {
+ librariesByUri.remove(f.getURI());
+ }
+ allLibrariesArray = null;
+ librariesByUriArray = null;
}
librariesBySource.remove(path);
return fs;
}
-
}
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.IKbProject#getTagLibraries(java.lang.String)
- */
- public ITagLibrary[] getTagLibraries(String uri) {
- // TODO
- return null;
- }
}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/TagLibriryManager.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/TagLibriryManager.java 2009-05-22 16:25:10 UTC (rev 15447)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/TagLibriryManager.java 2009-05-22 16:28:12 UTC (rev 15448)
@@ -11,6 +11,8 @@
package org.jboss.tools.jst.web.kb.taglib;
import org.eclipse.core.resources.IProject;
+import org.jboss.tools.jst.web.kb.IKbProject;
+import org.jboss.tools.jst.web.kb.KbProjectFactory;
/**
* @author Alexey Kazakov
@@ -24,7 +26,7 @@
* @return
*/
public static ITagLibrary[] getLibraries(IProject project, String uri) {
- //TODO
- return null;
+ IKbProject kbProject = KbProjectFactory.getKbProject(project, true);
+ return kbProject.getTagLibraries(uri);
}
}
\ No newline at end of file
15 years, 4 months