Author: akazakov
Date: 2009-05-08 12:09:37 -0400 (Fri, 08 May 2009)
New Revision: 15140
Added:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/IFaceletPageContext.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/IPageContext.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/IProposalProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/IResourceBundle.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/internal/FaceletContextImpl.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/internal/taglib/
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractComponent.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractTagLib.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/IAttribute.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/IComponent.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/ICustomTagLibrary.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/IELFunction.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/IFaceletTagLibrary.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/IFacesConfigTagLibrary.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/INameSpace.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/ITLDLibrary.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/ITagLibrary.java
Removed:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/FaceletPageContext.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/PageContext.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/ResourceBundle.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/internal/text/
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/Attribute.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/Component.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/CustomTagLibrary.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/FaceletTagLibrary.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/FacesConfigTagLibrary.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/NameSpace.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/TLDLibrary.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/TagLibrary.java
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/ELResolver.java
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/text/TextProposal.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/KbQuery.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/PageContextFactory.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/PageProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/TagLibriryManager.java
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.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamELAttributeContentProposalProvider.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2808
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/text/TextProposal.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/text/TextProposal.java 2009-05-08
14:50:46 UTC (rev 15139)
+++
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/text/TextProposal.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -41,10 +41,10 @@
private int relevance = R_NONE;
private int position = -1;
private boolean autoActivationContentAssistantAfterApplication = false;
-
+
private int start = -1;
private int end = -1;
-
+
PostProcessing postProcessing;
/**
@@ -76,7 +76,7 @@
public Image getImage() {
return image;
}
-
+
/**
* @return
*/
@@ -205,7 +205,7 @@
buffer.append(contextInfo);
buffer.append("\nreplacementString: ");
buffer.append(replacementString);
-
+
return buffer.toString();
}
@@ -262,36 +262,34 @@
public void setAutoActivationContentAssistantAfterApplication(boolean
autoActivationContentAssistantAfterApplication) {
this.autoActivationContentAssistantAfterApplication =
autoActivationContentAssistantAfterApplication;
}
-
+
public void setStart(int n) {
start = n;
}
-
+
public void setEnd(int n) {
end = n;
}
-
+
public int getStart() {
return start;
}
-
+
public int getEnd() {
return end;
}
-
+
public void setPostProcessing(PostProcessing postProcessing) {
this.postProcessing = postProcessing;
}
-
+
public void postProcess(String value, int offset) {
if(postProcessing != null) postProcessing.process(this, value, offset);
}
- public static final Comparator<TextProposal> KB_PROPOSAL_ORDER
- = new TextProposalComparator();
+ public static final Comparator<TextProposal> KB_PROPOSAL_ORDER = new
TextProposalComparator();
private static class TextProposalComparator implements Comparator<TextProposal>
{
-
public int compare(TextProposal p1, TextProposal p2) {
int n1=p1.replacementString.length(), n2=p2.replacementString.length();
for (int i1=0, i2=0; i1<n1 && i2<n2; i1++, i2++) {
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-08
14:50:46 UTC (rev 15139)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContext.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -24,9 +24,14 @@
IFile getResource();
/**
- * Returns "var" attributes which are available in particular offset.
+ * Returns "var" attributes
* @param offset
* @return
*/
- Var[] getVars(int offset);
+ Var[] getVars();
+
+ /**
+ * @return
+ */
+ ElVarSearcher getVarSearcher();
}
\ No newline at end of file
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolver.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolver.java 2009-05-08
14:50:46 UTC (rev 15139)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolver.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -22,13 +22,13 @@
public interface ELResolver {
/**
- *
* @param elString
* @param position
* @param context
+ * @param returnEqualedVariablesOnly
* @return
*/
- List<TextProposal> getCompletions(String elString, int position, ELContext
context);
+ List<TextProposal> getCompletions(String elString, boolean
returnEqualedVariablesOnly, int position, ELContext context);
/**
*
@@ -36,5 +36,5 @@
* @param context
* @return
*/
- ELOperandResolveStatus resolveELOperand(ELExpression operand, ELContext context);
+ ELOperandResolveStatus resolveELOperand(ELExpression operand, ELContext context, boolean
returnEqualedVariablesOnly);
}
\ No newline at end of file
Deleted:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/FaceletPageContext.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/FaceletPageContext.java 2009-05-08
14:50:46 UTC (rev 15139)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/FaceletPageContext.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -1,35 +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;
-
-import java.util.Map;
-
-/**
- * @author Alexey Kazakov
- */
-public interface FaceletPageContext extends PageContext {
-
- /**
- * Returns parent page context. For example if some this facelet page is used in a
template then
- * this method will return a page context for that template.
- * May return null.
- * @return
- */
- FaceletPageContext getParentContext();
-
- /**
- * Returns parameters which are declared in the parent context and are available within
this page.
- * Key - name of Parameter.
- * Value - value of Parameter.
- * @return
- */
- Map<String, String> getParams();
-}
\ No newline at end of file
Copied:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/IFaceletPageContext.java
(from rev 14973,
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/FaceletPageContext.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/IFaceletPageContext.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/IFaceletPageContext.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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;
+
+import java.util.Map;
+
+/**
+ * @author Alexey Kazakov
+ */
+public interface IFaceletPageContext extends IPageContext {
+
+ /**
+ * Returns parent page context. For example if some this facelet page is used in a
template then
+ * this method will return a page context for that template.
+ * May return null.
+ * @return
+ */
+ IFaceletPageContext getParentContext();
+
+ /**
+ * Returns parameters which are declared in the parent context and are available within
this page.
+ * Key - name of Parameter.
+ * Value - value of Parameter.
+ * @return
+ */
+ Map<String, String> getParams();
+}
\ No newline at end of file
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/IFaceletPageContext.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/IPageContext.java
(from rev 14973,
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/PageContext.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/IPageContext.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/IPageContext.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * 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;
+
+import org.eclipse.jface.text.IDocument;
+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.Var;
+import org.jboss.tools.jst.web.kb.taglib.ITagLibrary;
+
+/**
+ * Page context
+ * @author Alexey Kazakov
+ */
+public interface IPageContext extends ELContext {
+
+ /**
+ * Returns libraries which should be used in this context
+ * @return
+ */
+ ITagLibrary[] getLibraries();
+
+ /**
+ * Returns EL Resolvers which are declared for this page
+ * @return
+ */
+ ELResolver[] getElResolvers();
+
+ /**
+ * Returns resource bundles
+ * @return
+ */
+ IResourceBundle[] getResourceBundles();
+
+ /**
+ * Returns IDocument for source file
+ * @return
+ */
+ IDocument getDocument();
+
+ /**
+ * Returns "var" attributes which are available in particular offset.
+ * @param offset
+ * @return
+ */
+ Var[] getVars(int offset);
+}
\ No newline at end of file
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/IPageContext.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/IProposalProcessor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/IProposalProcessor.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/IProposalProcessor.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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;
+
+import org.jboss.tools.common.text.TextProposal;
+
+/**
+ * @author Alexey Kazakov
+ */
+public interface IProposalProcessor {
+
+ /**
+ * @return proposals
+ */
+ TextProposal[] getProposals(KbQuery query, IPageContext context);
+
+}
\ No newline at end of file
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/IProposalProcessor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/IResourceBundle.java
(from rev 14973,
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/ResourceBundle.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/IResourceBundle.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/IResourceBundle.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * 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;
+
+/**
+ * @author Alexey Kazakov
+ */
+public interface IResourceBundle {
+
+ /**
+ * @return var attribute value
+ */
+ String getVar();
+
+ /**
+ * @return basename attribute value
+ */
+ String getBasename();
+}
\ No newline at end of file
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/IResourceBundle.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/KbQuery.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/KbQuery.java 2009-05-08
14:50:46 UTC (rev 15139)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/KbQuery.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -16,12 +16,17 @@
*/
public class KbQuery {
+ public static final String PREFIX_SEPARATOR = ":";
+
private int offset;
private String uri;
private String[] parentTags;
private String value;
+ private String stringQuery;
private boolean useAsMask;
+ private String prefix;
private Type type;
+ private String parent;
/**
* Type of object for which we want to get info
@@ -57,11 +62,41 @@
return parentTags;
}
+ /**
+ * @param parentTags the stack of parent tags
+ */
public void setParentTags(String[] parentTags) {
this.parentTags = parentTags;
}
/**
+ * return the last parent tag
+ */
+ public String getLastParentTag() {
+ if(parentTags.length>0) {
+ return parentTags[parentTags.length-1];
+ }
+ return null;
+ }
+
+ /**
+ * @return the name of parent tag (type==TAG_NAME) or attribute (type==ATTRIBUTE_NAME or
type==ATTRIBUTE_VALE) to set
+ */
+ public String getParent() {
+ if(type == Type.TAG_NAME) {
+ return getLastParentTag();
+ }
+ return parent;
+ }
+
+ /**
+ * @param name the name of parent tag or attribute to set
+ */
+ public void setParent(String name) {
+ this.parent = name;
+ }
+
+ /**
* Value of query. For example in case of ATTRIBUTE_NAME type it is an attribute name.
* @return
*/
@@ -74,7 +109,7 @@
}
/**
- * True if the value is a mask. For example we ask all tags which start with
"<h:outputT" then the value "outputT" ia a mask.
+ * True if the value is a mask. For example we ask all tags which start with
"<h:outputT" then the value "outputT" is a mask.
* @return
*/
public boolean isMask() {
@@ -107,4 +142,34 @@
public void setOffset(int offset) {
this.offset = offset;
}
+
+ /**
+ * @return the string representation of this query.
+ * In case of tag name this method will return "<h:outputText"
+ * but getValue() will return "outputText".
+ */
+ public String getStringQuery() {
+ return stringQuery;
+ }
+
+ /**
+ * @param stringQuery the stringQuery to set
+ */
+ public void setStringQuery(String stringQuery) {
+ this.stringQuery = stringQuery;
+ }
+
+ /**
+ * @return the tag prefix.
+ */
+ public String getPrefix() {
+ return prefix;
+ }
+
+ /**
+ * @param prefix the prefix to set
+ */
+ public void setPrefix(String prefix) {
+ this.prefix = prefix;
+ }
}
\ No newline at end of file
Deleted:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/PageContext.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/PageContext.java 2009-05-08
14:50:46 UTC (rev 15139)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/PageContext.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -1,40 +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;
-
-import org.jboss.tools.common.el.core.resolver.ELContext;
-import org.jboss.tools.common.el.core.resolver.ELResolver;
-import org.jboss.tools.jst.web.kb.taglib.TagLibrary;
-
-/**
- * Page context
- * @author Alexey Kazakov
- */
-public interface PageContext extends ELContext {
-
- /**
- * Returns libraries which should be used in this context
- * @return
- */
- TagLibrary[] getLibraries();
-
- /**
- * Returns EL Resolvers which are declared for this page
- * @return
- */
- ELResolver[] getElResolvers();
-
- /**
- * Returns resource bundles
- * @return
- */
- ResourceBundle[] getResourceBundles();
-}
\ No newline at end of file
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/PageContextFactory.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/PageContextFactory.java 2009-05-08
14:50:46 UTC (rev 15139)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/PageContextFactory.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -23,7 +23,7 @@
* @param offset
* @return
*/
- public static PageContext createPageContext(IFile file, int offset) {
+ public static IPageContext createPageContext(IFile file, int offset) {
// TODO
return null;
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/PageProcessor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/PageProcessor.java 2009-05-08
14:50:46 UTC (rev 15139)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/PageProcessor.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -10,21 +10,80 @@
******************************************************************************/
package org.jboss.tools.jst.web.kb;
+import java.util.ArrayList;
+
+import org.jboss.tools.common.el.core.resolver.ELResolver;
import org.jboss.tools.common.text.TextProposal;
-import org.jboss.tools.jst.web.kb.taglib.Component;
+import org.jboss.tools.jst.web.kb.taglib.IAttribute;
+import org.jboss.tools.jst.web.kb.taglib.IComponent;
+import org.jboss.tools.jst.web.kb.taglib.ITagLibrary;
/**
* @author Alexey Kazakov
*/
-public class PageProcessor {
+public class PageProcessor implements IProposalProcessor {
- public TextProposal[] getProposals(KbQuery query, PageContext context) {
- //TODO
- return null;
+ /*
+ * (non-Javadoc)
+ * @see
org.jboss.tools.jst.web.kb.ProposalProcessor#getProposals(org.jboss.tools.jst.web.kb.KbQuery,
org.jboss.tools.jst.web.kb.PageContext)
+ */
+ public TextProposal[] getProposals(KbQuery query, IPageContext context) {
+ ArrayList<TextProposal> proposals = new ArrayList<TextProposal>();
+ ITagLibrary[] libs = context.getLibraries();
+ for (int i = 0; i < libs.length; i++) {
+ TextProposal[] libProposals = libs[i].getProposals(query, context);
+ for (int j = 0; j < libProposals.length; j++) {
+ proposals.add(libProposals[i]);
+ }
+ }
+ if(query.getType() == KbQuery.Type.ATTRIBUTE_VALUE || query.getType() ==
KbQuery.Type.TEXT) {
+ String value = query.getValue();
+ //TODO convert value to EL string.
+ String elString = value;
+ ELResolver[] resolvers = context.getElResolvers();
+ for (int i = 0; i < resolvers.length; i++) {
+ proposals.addAll(resolvers[i].getCompletions(elString, !query.isMask(),
query.getOffset(), context));
+ }
+ }
+
+ return proposals.toArray(new TextProposal[proposals.size()]);
}
- public Component[] getComponents(KbQuery query, PageContext context) {
- //TODO
- return null;
+ /**
+ * Returns components
+ * @param query
+ * @param context
+ * @return components
+ */
+ public IComponent[] getComponents(KbQuery query, IPageContext context) {
+ ArrayList<IComponent> components = new ArrayList<IComponent>();
+ ITagLibrary[] libs = context.getLibraries();
+ for (int i = 0; i < libs.length; i++) {
+ IComponent[] libComponents = libs[i].getComponents(query, context);
+ for (int j = 0; j < libComponents.length; j++) {
+ components.add(libComponents[i]);
+ }
+ }
+ return components.toArray(new IComponent[components.size()]);
}
+
+ /**
+ * Returns attributes
+ * @param query
+ * @param context
+ * @return attributes
+ */
+ public IAttribute[] getAttributes(KbQuery query, IPageContext context) {
+ ArrayList<IAttribute> attributes = new ArrayList<IAttribute>();
+ if(query.getType() == KbQuery.Type.ATTRIBUTE_NAME || query.getType() ==
KbQuery.Type.ATTRIBUTE_VALUE) {
+ IComponent[] components = getComponents(query, context);
+ for (int i = 0; i < components.length; i++) {
+ IAttribute[] libAttributess = components[i].getAttributes(query, context);
+ for (int j = 0; j < libAttributess.length; j++) {
+ attributes.add(libAttributess[i]);
+ }
+ }
+ }
+ return attributes.toArray(new IAttribute[attributes.size()]);
+ }
}
\ No newline at end of file
Deleted:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/ResourceBundle.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/ResourceBundle.java 2009-05-08
14:50:46 UTC (rev 15139)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/ResourceBundle.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -1,27 +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;
-
-/**
- * @author Alexey Kazakov
- */
-public interface ResourceBundle {
-
- /**
- * @return var attribute value
- */
- String getVar();
-
- /**
- * @return basename attribute value
- */
- String getBasename();
-}
\ No newline at end of file
Copied:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/internal/FaceletContextImpl.java
(from rev 14973,
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/internal/text/FaceletContextImpl.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/internal/FaceletContextImpl.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/internal/FaceletContextImpl.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * 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
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/internal/FaceletContextImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java
(from rev 14973,
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/internal/text/JspContextImpl.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * 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.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.Region;
+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.taglib.ITagLibrary;
+
+/**
+ * JSP page context
+ * @author Alexey Kazakov
+ */
+public class JspContextImpl implements IPageContext {
+
+ private IFile resource;
+ private IDocument document;
+ private ElVarSearcher varSearcher;
+ private ITagLibrary[] libs;
+ private ELResolver[] elResolvers;
+ private Map<Region, Var[]> vars = new HashMap<Region, Var[]>();
+ private Set<Var> allVars = new HashSet<Var>();
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.common.kb.text.PageContext#getResource()
+ */
+ public IFile getResource() {
+ return resource;
+ }
+
+ public void setResource(IFile resource) {
+ this.resource = resource;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.common.kb.text.PageContext#getLibraries()
+ */
+ public ITagLibrary[] getLibraries() {
+ return libs;
+ }
+
+ public void setLibraries(ITagLibrary[] libs) {
+ this.libs = libs;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.common.kb.text.PageContext#getElResolvers()
+ */
+ public ELResolver[] getElResolvers() {
+ return elResolvers;
+ }
+
+ public void setElResolvers(ELResolver[] elResolvers) {
+ this.elResolvers = elResolvers;
+ }
+
+ private final static Var[] EMPTY_VAR_ARRAY = new Var[0];
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.common.kb.text.PageContext#getVars(int)
+ */
+ public Var[] getVars(int offset) {
+ for (Region region : vars.keySet()) {
+ if(offset>=region.getOffset() && offset<=region.getOffset() +
region.getLength()) {
+ return vars.get(region);
+ }
+ }
+ return EMPTY_VAR_ARRAY;
+ }
+
+ /**
+ * Adds new Var to the context
+ * @param region
+ * @param vars
+ */
+ public void addVars(Region region, Var[] vars) {
+ this.vars.put(region, vars);
+ for (int i = 0; i < vars.length; i++) {
+ allVars.add(vars[i]);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.common.kb.text.PageContext#getResourceBundles()
+ */
+ public IResourceBundle[] getResourceBundles() {
+ // TODO
+ return null;
+ }
+
+ /**
+ * @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) {
+ this.document = document;
+ }
+
+ /**
+ * @param varSearcher the varSearcher to set
+ */
+ public void setVarSearcher(ElVarSearcher varSearcher) {
+ this.varSearcher = varSearcher;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.PageContext#getDocument()
+ */
+ public IDocument getDocument() {
+ return document;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.common.el.core.resolver.ELContext#getVarSearcher()
+ */
+ public ElVarSearcher getVarSearcher() {
+ return varSearcher;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.common.el.core.resolver.ELContext#getVars()
+ */
+ public Var[] getVars() {
+ return allVars.toArray(new Var[allVars.size()]);
+ }
+}
\ No newline at end of file
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractComponent.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractComponent.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractComponent.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -0,0 +1,225 @@
+/*******************************************************************************
+ * 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.taglib;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.tools.common.text.TextProposal;
+import org.jboss.tools.jst.web.kb.IPageContext;
+import org.jboss.tools.jst.web.kb.KbQuery;
+import org.jboss.tools.jst.web.kb.taglib.IAttribute;
+import org.jboss.tools.jst.web.kb.taglib.IComponent;
+import org.jboss.tools.jst.web.kb.taglib.INameSpace;
+
+/**
+ * Abstract implementation of IComponent
+ * @author Alexey Kazakov
+ */
+public abstract class AbstractComponent implements IComponent {
+
+ protected boolean canHaveBody;
+ protected String componentClass;
+ protected String componentType;
+ protected String description;
+ protected String name;
+ protected INameSpace nameSpace;
+ protected Map<String, IAttribute> attributes = new HashMap<String,
IAttribute>();
+ protected Map<String, IAttribute> preferableAttributes = new HashMap<String,
IAttribute>();
+ protected Map<String, IAttribute> requiredAttributes = new HashMap<String,
IAttribute>();
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.taglib.IComponent#canHaveBody()
+ */
+ public boolean canHaveBody() {
+ return canHaveBody;
+ }
+
+ /**
+ * @param canHaveBody
+ */
+ public void setCanHaveBody(boolean canHaveBody) {
+ this.canHaveBody = canHaveBody;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.taglib.IComponent#getAttribute(java.lang.String)
+ */
+ public IAttribute getAttribute(String name) {
+ return attributes.get(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.taglib.IComponent#getAttributes()
+ */
+ public IAttribute[] getAttributes() {
+ synchronized (attributes) {
+ return attributes.values().toArray(new IAttribute[attributes.size()]);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.taglib.IComponent#getAttributes(java.lang.String)
+ */
+ public IAttribute[] getAttributes(String nameTemplate) {
+ List<IAttribute> list = new ArrayList<IAttribute>();
+ IAttribute[] atts = getAttributes();
+ for (int i = 0; i < atts.length; i++) {
+ if(atts[i].getName().startsWith(nameTemplate)) {
+ list.add(atts[i]);
+ }
+ }
+ return list.toArray(new IAttribute[list.size()]);
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.tools.jst.web.kb.taglib.IComponent#getAttributes(org.jboss.tools.jst.web.kb.KbQuery,
org.jboss.tools.jst.web.kb.IPageContext)
+ */
+ public IAttribute[] getAttributes(KbQuery query, IPageContext context) {
+ String attrName = null;
+ boolean mask = false;
+ if(query.getType()==KbQuery.Type.ATTRIBUTE_NAME) {
+ attrName = query.getValue();
+ mask = query.isMask();
+ } else if(query.getType()==KbQuery.Type.ATTRIBUTE_VALUE) {
+ attrName = query.getParent();
+ }
+ if(attrName == null) {
+ return null;
+ }
+ if(mask) {
+ return getAttributes(attrName);
+ }
+ return new IAttribute[]{getAttribute(attrName)};
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.taglib.IComponent#getComponentClass()
+ */
+ public String getComponentClass() {
+ return componentClass;
+ }
+
+ /**
+ * @param componentClass the component class name to set
+ */
+ public void setComponentClass(String componentClass) {
+ this.componentClass = componentClass;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.taglib.IComponent#getComponentType()
+ */
+ public String getComponentType() {
+ return componentType;
+ }
+
+ /**
+ * @param componentType the component type to set
+ */
+ public void setComponentType(String componentType) {
+ this.componentType = componentType;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.taglib.IComponent#getDescription()
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @param description the description to set
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.taglib.IComponent#getName()
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.taglib.IComponent#getNameSpace()
+ */
+ public INameSpace getNameSpace() {
+ return nameSpace;
+ }
+
+ /**
+ * @param nameSpace the name space to set
+ */
+ public void setNameSpace(INameSpace nameSpace) {
+ this.nameSpace = nameSpace;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.taglib.IComponent#getPreferableAttributes()
+ */
+ public IAttribute[] getPreferableAttributes() {
+ synchronized (preferableAttributes) {
+ return preferableAttributes.values().toArray(new
IAttribute[preferableAttributes.size()]);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.taglib.IComponent#getRequiredAttributes()
+ */
+ public IAttribute[] getRequiredAttributes() {
+ synchronized (requiredAttributes) {
+ return requiredAttributes.values().toArray(new
IAttribute[requiredAttributes.size()]);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.tools.jst.web.kb.IProposalProcessor#getProposals(org.jboss.tools.jst.web.kb.KbQuery,
org.jboss.tools.jst.web.kb.IPageContext)
+ */
+ public TextProposal[] getProposals(KbQuery query, IPageContext context) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * Adds the attribute to the component.
+ * @param attribute
+ */
+ public void addAttribute(IAttribute attribute) {
+ attributes.put(attribute.getName(), attribute);
+ if(attribute.isPreferable()) {
+ preferableAttributes.put(attribute.getName(), attribute);
+ }
+ if(attribute.isRequired()) {
+ requiredAttributes.put(attribute.getName(), attribute);
+ }
+ }
+
+ /**
+ * Removes the attribute from the component
+ * @param attribute
+ */
+ public void removeAttribute(IAttribute attribute) {
+ attributes.remove(attribute.getName());
+ preferableAttributes.remove(attribute.getName());
+ requiredAttributes.remove(attribute.getName());
+ }
+}
\ No newline at end of file
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractComponent.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractTagLib.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractTagLib.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractTagLib.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -0,0 +1,179 @@
+/*******************************************************************************
+ * 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.taglib;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.jboss.tools.common.text.TextProposal;
+import org.jboss.tools.jst.web.kb.IPageContext;
+import org.jboss.tools.jst.web.kb.KbQuery;
+import org.jboss.tools.jst.web.kb.taglib.IAttribute;
+import org.jboss.tools.jst.web.kb.taglib.IComponent;
+import org.jboss.tools.jst.web.kb.taglib.ITagLibrary;
+
+/**
+ * Abstract implementation of ITagLibrary
+ * @author Alexey Kazakov
+ */
+public abstract class AbstractTagLib implements ITagLibrary {
+
+ protected String uri;
+ protected IFile resource;
+ protected Map<String, IComponent> components = new HashMap<String,
IComponent>();
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.taglib.TagLibrary#getAllComponents()
+ */
+ public IComponent[] getComponents() {
+ synchronized (components) {
+ return components.values().toArray(new IComponent[components.size()]);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.taglib.TagLibrary#getComponent(java.lang.String)
+ */
+ public IComponent getComponent(String name) {
+ return components.get(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.taglib.TagLibrary#getComponents(java.lang.String)
+ */
+ public IComponent[] getComponents(String nameTemplate) {
+ List<IComponent> list = new ArrayList<IComponent>();
+ IComponent[] comps = getComponents();
+ for (int i = 0; i < comps.length; i++) {
+ if(comps[i].getName().startsWith(nameTemplate)) {
+ list.add(comps[i]);
+ }
+ }
+ return list.toArray(new IComponent[list.size()]);
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.tools.jst.web.kb.taglib.TagLibrary#getComponents(org.jboss.tools.jst.web.kb.KbQuery,
org.jboss.tools.jst.web.kb.PageContext)
+ */
+ public IComponent[] getComponents(KbQuery query, IPageContext context) {
+ String tagName = null;
+ boolean mask = false;
+ if(query.getType()==KbQuery.Type.TAG_NAME) {
+ tagName = query.getValue();
+ mask = query.isMask();
+ } else {
+ tagName = query.getLastParentTag();
+ }
+ if(tagName == null) {
+ return null;
+ }
+ if(mask) {
+ return getComponents(tagName);
+ }
+ return new IComponent[]{getComponent(tagName)};
+ }
+
+ /**
+ * Adds component to tag lib.
+ * @param component
+ */
+ public void addComponent(IComponent component) {
+ components.put(component.getName(), component);
+ }
+
+ /**
+ * @param components the components to set
+ */
+ protected void setComponents(Map<String, IComponent> components) {
+ this.components = components;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.taglib.TagLibrary#getResource()
+ */
+ public IResource getResource() {
+ return resource;
+ }
+
+ /**
+ * @param resource the resource to set
+ */
+ public void setResource(IFile resource) {
+ this.resource = resource;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.taglib.TagLibrary#getURI()
+ */
+ public String getURI() {
+ return uri;
+ }
+
+ /**
+ * @param uri the URI to set
+ */
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.tools.jst.web.kb.ProposalProcessor#getProposals(org.jboss.tools.jst.web.kb.KbQuery,
org.jboss.tools.jst.web.kb.PageContext)
+ */
+ public TextProposal[] getProposals(KbQuery query, IPageContext context) {
+ List<TextProposal> proposals = new ArrayList<TextProposal>();
+ IComponent[] components = getComponents(query, context);
+ if(query.getType() == KbQuery.Type.TAG_NAME) {
+ for (int i = 0; i < components.length; i++) {
+ TextProposal proposal = new TextProposal();
+ proposal.setContextInfo(components[i].getDescription());
+ StringBuffer label = new StringBuffer();
+ if(query.getPrefix()!=null) {
+ label.append(query.getPrefix() + KbQuery.PREFIX_SEPARATOR);
+ }
+ label.append(components[i].getName());
+ proposal.setLabel(label.toString());
+
+ IAttribute[] attributes = components[i].getPreferableAttributes();
+ StringBuffer attributeSB = new StringBuffer();
+ for (int j = 0; j < attributes.length; j++) {
+ attributeSB.append("
").append(attributes[j].getName()).append("=\"\"");
+ }
+ label.append(attributeSB);
+ if(!components[i].canHaveBody()) {
+ label.append(" /");
+ }
+
+ proposal.setReplacementString(label.toString());
+
+ int position = proposal.getReplacementString().indexOf('"');
+ if(position!=-1) {
+ position ++;
+ } else {
+ position = proposal.getReplacementString().length();
+ }
+ proposal.setPosition(position);
+ proposals.add(proposal);
+ }
+ } else {
+ for (int i = 0; i < components.length; i++) {
+ TextProposal[] componentProposals = components[i].getProposals(query, context);
+ for (int j = 0; j < componentProposals.length; j++) {
+ proposals.add(componentProposals[j]);
+ }
+ }
+ }
+ return proposals.toArray(new TextProposal[proposals.size()]);
+ }
+}
\ No newline at end of file
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractTagLib.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/Attribute.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/Attribute.java 2009-05-08
14:50:46 UTC (rev 15139)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/Attribute.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -1,37 +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.taglib;
-
-/**
- * @author Alexey Kazakov
- */
-public interface Attribute {
-
- /**
- * @return name of attribute
- */
- String getName();
-
- /**
- * @return description
- */
- String getDesription();
-
- /**
- * @return true if the attribute is required.
- */
- boolean isRequired();
-
- /**
- * @return true if the attribute is preferable. E.g. <h:outputText
value=""/>
- */
- boolean isPreferable();
-}
\ No newline at end of file
Deleted:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/Component.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/Component.java 2009-05-08
14:50:46 UTC (rev 15139)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/Component.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -1,64 +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.taglib;
-
-/**
- * @author Alexey Kazakov
- */
-public interface Component {
-
- /**
- * @return name space
- */
- NameSpace getNameSpace();
-
- /**
- * @return component name
- */
- String getName();
-
- /**
- * @return description
- */
- String getDesription();
-
- /**
- * @return true if the tag can have a body
- */
- boolean canHaveBody();
-
- /**
- * @return the component type
- */
- String getComponentType();
-
- /**
- * @return the component class name
- */
- String getComponentClass();
-
- /**
- * @return all attributes of this component
- */
- Attribute[] getAttributes();
-
- /**
- * @param nameTemplate
- * @return attributes with names which start with given template.
- */
- Attribute[] getAttributes(String nameTemplate);
-
- /**
- * @param name
- * @return attribute by name
- */
- Attribute getAttribute(String name);
-}
\ No newline at end of file
Deleted:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/CustomTagLibrary.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/CustomTagLibrary.java 2009-05-08
14:50:46 UTC (rev 15139)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/CustomTagLibrary.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -1,18 +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.taglib;
-
-/**
- * @author Alexey Kazakov
- */
-public interface CustomTagLibrary extends TagLibrary {
-
-}
\ No newline at end of file
Deleted:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/FaceletTagLibrary.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/FaceletTagLibrary.java 2009-05-08
14:50:46 UTC (rev 15139)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/FaceletTagLibrary.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -1,18 +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.taglib;
-
-/**
- * @author Alexey Kazakov
- */
-public interface FaceletTagLibrary extends TagLibrary {
-
-}
\ No newline at end of file
Deleted:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/FacesConfigTagLibrary.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/FacesConfigTagLibrary.java 2009-05-08
14:50:46 UTC (rev 15139)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/FacesConfigTagLibrary.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -1,40 +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.taglib;
-
-/**
- * @author Alexey Kazakov
- */
-public interface FacesConfigTagLibrary extends TagLibrary {
-
- /**
- * @param type
- * @return component by type
- */
- Component getComponentByType(String type);
-
- /**
- * @return all facets of this component
- */
- Facet[] getFacets();
-
- /**
- * @param nameTemplate
- * @return facets with names which start with given template.
- */
- Facet[] getFacets(String nameTemplate);
-
- /**
- * @param name
- * @return facet by name
- */
- Facet getFacet(String name);
-}
\ No newline at end of file
Copied:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/IAttribute.java
(from rev 14973,
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/Attribute.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/IAttribute.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/IAttribute.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * 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.taglib;
+
+import org.jboss.tools.jst.web.kb.IProposalProcessor;
+
+/**
+ * @author Alexey Kazakov
+ */
+public interface IAttribute extends IProposalProcessor {
+
+ /**
+ * @return name of attribute
+ */
+ String getName();
+
+ /**
+ * @return description
+ */
+ String getDesription();
+
+ /**
+ * @return true if the attribute is required.
+ */
+ boolean isRequired();
+
+ /**
+ * @return true if the attribute is preferable. E.g. <h:outputText
value=""/>
+ */
+ boolean isPreferable();
+}
\ No newline at end of file
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/IAttribute.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/IComponent.java
(from rev 14973,
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/Component.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/IComponent.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/IComponent.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * 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.taglib;
+
+import org.jboss.tools.jst.web.kb.IPageContext;
+import org.jboss.tools.jst.web.kb.IProposalProcessor;
+import org.jboss.tools.jst.web.kb.KbQuery;
+
+/**
+ * @author Alexey Kazakov
+ */
+public interface IComponent extends IProposalProcessor {
+
+ /**
+ * @return name space
+ */
+ INameSpace getNameSpace();
+
+ /**
+ * @return component name
+ */
+ String getName();
+
+ /**
+ * @return description
+ */
+ String getDescription();
+
+ /**
+ * @return true if the tag can have a body
+ */
+ boolean canHaveBody();
+
+ /**
+ * @return the component type
+ */
+ String getComponentType();
+
+ /**
+ * @return the component class name
+ */
+ String getComponentClass();
+
+ /**
+ * @return all attributes of this component
+ */
+ IAttribute[] getAttributes();
+
+ /**
+ * @param nameTemplate
+ * @return attributes with names which start with given template.
+ */
+ IAttribute[] getAttributes(String nameTemplate);
+
+ /**
+ * @return all required attributes of this component
+ */
+ IAttribute[] getRequiredAttributes();
+
+ /**
+ * @return all preferable attributes of this component
+ */
+ IAttribute[] getPreferableAttributes();
+
+ /**
+ * @param name
+ * @return attribute by name
+ */
+ IAttribute getAttribute(String name);
+
+ /**
+ * Return attributes
+ * @param query
+ * @param context
+ * @return
+ */
+ public IAttribute[] getAttributes(KbQuery query, IPageContext context);
+}
\ No newline at end of file
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/IComponent.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/ICustomTagLibrary.java
(from rev 14973,
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/CustomTagLibrary.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/ICustomTagLibrary.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/ICustomTagLibrary.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * 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.taglib;
+
+/**
+ * @author Alexey Kazakov
+ */
+public interface ICustomTagLibrary extends ITagLibrary {
+
+}
\ No newline at end of file
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/ICustomTagLibrary.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/IELFunction.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/IELFunction.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/IELFunction.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * 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.taglib;
+
+/**
+ * @author Alexey Kazakov
+ */
+public interface IELFunction {
+
+ /**
+ * @return the name of EL function
+ */
+ String getName();
+
+ /**
+ * @return the signature
+ */
+ String getFunctionSignature();
+}
\ No newline at end of file
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/IELFunction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/IFaceletTagLibrary.java
(from rev 14973,
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/FaceletTagLibrary.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/IFaceletTagLibrary.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/IFaceletTagLibrary.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * 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.taglib;
+
+/**
+ * @author Alexey Kazakov
+ */
+public interface IFaceletTagLibrary extends ITagLibrary {
+
+ /**
+ * @return EL functions
+ */
+ IELFunction[] getFunctions();
+}
\ No newline at end of file
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/IFaceletTagLibrary.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/IFacesConfigTagLibrary.java
(from rev 14973,
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/FacesConfigTagLibrary.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/IFacesConfigTagLibrary.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/IFacesConfigTagLibrary.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * 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.taglib;
+
+/**
+ * @author Alexey Kazakov
+ */
+public interface IFacesConfigTagLibrary extends ITagLibrary {
+
+ /**
+ * @param type
+ * @return component by type
+ */
+ IComponent getComponentByType(String type);
+
+ /**
+ * @return all facets of this component
+ */
+ Facet[] getFacets();
+
+ /**
+ * @param nameTemplate
+ * @return facets with names which start with given template.
+ */
+ Facet[] getFacets(String nameTemplate);
+
+ /**
+ * @param name
+ * @return facet by name
+ */
+ Facet getFacet(String name);
+}
\ No newline at end of file
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/IFacesConfigTagLibrary.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/INameSpace.java
(from rev 14973,
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/NameSpace.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/INameSpace.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/INameSpace.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * 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.taglib;
+
+/**
+ * @author Alexey Kazakov
+ */
+public interface INameSpace {
+
+ /**
+ * @return URI
+ */
+ String getURI();
+
+ /**
+ * @return prefix
+ */
+ String getPrefix();
+}
\ No newline at end of file
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/INameSpace.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/ITLDLibrary.java
(from rev 14973,
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/TLDLibrary.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/ITLDLibrary.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/ITLDLibrary.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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.taglib;
+
+/**
+ * @author Alexey Kazakov
+ */
+public interface ITLDLibrary extends ITagLibrary {
+
+ /**
+ * @return version of TLD
+ */
+ String getVersion();
+
+ /**
+ * @return display name
+ */
+ String displayName();
+
+ /**
+ * @return short name
+ */
+ String getShortName();
+}
\ No newline at end of file
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/ITLDLibrary.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/ITagLibrary.java
(from rev 14973,
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/TagLibrary.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/ITagLibrary.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/ITagLibrary.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * 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.taglib;
+
+import org.eclipse.core.resources.IResource;
+import org.jboss.tools.jst.web.kb.KbQuery;
+import org.jboss.tools.jst.web.kb.IPageContext;
+import org.jboss.tools.jst.web.kb.IProposalProcessor;
+
+/**
+ * Represents a tag library.
+ * @author Alexey Kazakov
+ */
+public interface ITagLibrary extends IProposalProcessor {
+
+ /**
+ * @return URI of the tag lib.
+ */
+ String getURI();
+
+ /**
+ * @return resource of this tag lib.
+ */
+ IResource getResource();
+
+ /**
+ * @return all tags
+ */
+ IComponent[] getComponents();
+
+ /**
+ * @param nameTemplate
+ * @return tags with names which start with given template
+ */
+ IComponent[] getComponents(String nameTemplate);
+
+ /**
+ * @param name
+ * @return tag by name
+ */
+ IComponent getComponent(String name);
+
+ /**
+ * @param query
+ * @param context
+ * @return components
+ */
+ public IComponent[] getComponents(KbQuery query, IPageContext context);
+}
\ No newline at end of file
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/ITagLibrary.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/NameSpace.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/NameSpace.java 2009-05-08
14:50:46 UTC (rev 15139)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/NameSpace.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -1,27 +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.taglib;
-
-/**
- * @author Alexey Kazakov
- */
-public interface NameSpace {
-
- /**
- * @return URI
- */
- String getURI();
-
- /**
- * @return prefix
- */
- String getPrefix();
-}
\ No newline at end of file
Deleted:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/TLDLibrary.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/TLDLibrary.java 2009-05-08
14:50:46 UTC (rev 15139)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/TLDLibrary.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -1,32 +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.taglib;
-
-/**
- * @author Alexey Kazakov
- */
-public interface TLDLibrary extends TagLibrary {
-
- /**
- * @return version of TLD
- */
- String getVersion();
-
- /**
- * @return display name
- */
- String displayName();
-
- /**
- * @return short name
- */
- String getShortName();
-}
\ No newline at end of file
Deleted:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/TagLibrary.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/TagLibrary.java 2009-05-08
14:50:46 UTC (rev 15139)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/TagLibrary.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -1,47 +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.taglib;
-
-import org.eclipse.core.resources.IResource;
-
-/**
- * Represents a tag library.
- * @author Alexey Kazakov
- */
-public interface TagLibrary {
-
- /**
- * @return URI of the tag lib.
- */
- String getURI();
-
- /**
- * @return resource of this tag lib.
- */
- IResource getResource();
-
- /**
- * @return all tags
- */
- Component[] getAllComponents();
-
- /**
- * @param nameTemplate
- * @return tags with names which start with given template
- */
- Component[] getComponents(String nameTemplate);
-
- /**
- * @param name
- * @return tag by name
- */
- Component getComponent(String name);
-}
\ No newline at end of file
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/TagLibriryManager.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/TagLibriryManager.java 2009-05-08
14:50:46 UTC (rev 15139)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/kb/taglib/TagLibriryManager.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -22,7 +22,7 @@
* @param page
* @return
*/
- public static TagLibrary[] getLibraries(IFile page) {
+ public static ITagLibrary[] getLibraries(IFile page) {
//TODO
return null;
}
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-08
14:50:46 UTC (rev 15139)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -47,13 +47,16 @@
import org.jboss.tools.common.el.core.parser.ELParserUtil;
import org.jboss.tools.common.el.core.parser.LexicalToken;
import org.jboss.tools.common.el.core.resolver.ELCompletionEngine;
+import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.el.core.resolver.ELOperandResolveStatus;
+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.TypeInfoCollector;
import org.jboss.tools.common.el.core.resolver.Var;
import org.jboss.tools.common.el.core.resolver.TypeInfoCollector.MemberInfo;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.text.TextProposal;
+import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.seam.core.IBijectedAttribute;
import org.jboss.tools.seam.core.ISeamComponent;
import org.jboss.tools.seam.core.ISeamContextShortVariable;
@@ -75,7 +78,7 @@
*
* @author Jeremy
*/
-public final class SeamELCompletionEngine implements ELCompletionEngine {
+public final class SeamELCompletionEngine implements ELCompletionEngine, ELResolver {
private static final Image SEAM_EL_PROPOSAL_IMAGE =
SeamCorePlugin.getDefault().getImage(SeamCorePlugin.CA_SEAM_EL_IMAGE_PATH);
@@ -84,6 +87,7 @@
ISeamProject project;
private static ELParserFactory factory = ELParserUtil.getJbossFactory();
+
/**
* Constructs SeamELCompletionEngine object
*/
@@ -91,11 +95,61 @@
this.project = project;
}
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.common.el.core.resolver.ELCompletionEngine#getParserFactory()
+ */
public ELParserFactory getParserFactory() {
return factory;
}
+ /*
+ * (non-Javadoc)
+ * @see
org.jboss.tools.common.el.core.resolver.ELResolver#getCompletions(java.lang.String,
boolean, int, org.jboss.tools.common.el.core.resolver.ELContext)
+ */
+ public List<TextProposal> getCompletions(String elString, boolean
returnEqualedVariablesOnly, int position, ELContext context) {
+ IDocument document = null;
+ if(context instanceof IPageContext) {
+ IPageContext pageContext = (IPageContext)context;
+ document = pageContext.getDocument();
+ }
+ List<Var> vars = new ArrayList<Var>();
+ Var[] array = context.getVars();
+ for (int i = 0; i < array.length; i++) {
+ vars.add(array[i]);
+ }
+ List<TextProposal> proposals = null;
+ try {
+ proposals = getCompletions(context.getResource(), document, elString.subSequence(0,
elString.length()), position, returnEqualedVariablesOnly, vars);
+ } catch (StringIndexOutOfBoundsException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ } catch (BadLocationException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ return proposals;
+ }
+ /*
+ * (non-Javadoc)
+ * @see
org.jboss.tools.common.el.core.resolver.ELResolver#resolveELOperand(org.jboss.tools.common.el.core.model.ELExpression,
org.jboss.tools.common.el.core.resolver.ELContext, boolean)
+ */
+ public ELOperandResolveStatus resolveELOperand(ELExpression operand, ELContext context,
boolean returnEqualedVariablesOnly) {
+ List<Var> vars = new ArrayList<Var>();
+ Var[] array = context.getVars();
+ for (int i = 0; i < array.length; i++) {
+ vars.add(array[i]);
+ }
+ ELOperandResolveStatus status = null;
+ try {
+ status = resolveELOperand(context.getResource(), operand, returnEqualedVariablesOnly,
vars, context.getVarSearcher());
+ } catch (StringIndexOutOfBoundsException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ } catch (BadLocationException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ return status;
+ }
+
/**
* Create the list of suggestions.
* @param seamProject Seam project
@@ -105,8 +159,6 @@
* @param position Offset of the prefix
* @param vars - 'var' attributes which can be used in this EL. Can be null.
* @param returnEqualedVariablesOnly 'false' if we get proposals for mask
- * @param start start of relevant region in document
- * @param end end of relevant region in document
* for example:
* we have 'variableName.variableProperty',
'variableName.variableProperty1', 'variableName.variableProperty2'
* prefix is 'variableName.variableProperty'
@@ -121,7 +173,7 @@
* @throws StringIndexOutOfBoundsException
*/
public List<TextProposal> getCompletions(IFile file, IDocument document,
CharSequence prefix,
- int position, boolean returnEqualedVariablesOnly, List<Var> vars, int start, int
end) throws BadLocationException, StringIndexOutOfBoundsException {
+ int position, boolean returnEqualedVariablesOnly, List<Var> vars) throws
BadLocationException, StringIndexOutOfBoundsException {
List<TextProposal> completions = new ArrayList<TextProposal>();
ELOperandResolveStatus status = resolveELOperand(file, parseOperand("" +
prefix), returnEqualedVariablesOnly, vars, new ElVarSearcher(file, this));
@@ -958,53 +1010,7 @@
}
return res;
}
-
- private void resolveLastSegment(ELInvocationExpression expr,
- List<TypeInfoCollector.MemberInfo> members,
- List<IJavaElement> res
- ) {
- List<IJavaElement> javaElements = new ArrayList<IJavaElement>();
- if(expr.getType() != ELObjectType.EL_ARGUMENT_INVOCATION) {
- // return filtered methods + properties
- List<TypeInfoCollector.MemberInfo> javaElementInfosToFilter = new
ArrayList<TypeInfoCollector.MemberInfo>();
- for (TypeInfoCollector.MemberInfo mbr : members) {
- TypeInfoCollector infos = mbr.getTypeCollector();
- javaElementInfosToFilter.addAll(infos.getMethods());
- javaElementInfosToFilter.addAll(infos.getProperties());
- }
-
- for (TypeInfoCollector.MemberInfo info : javaElementInfosToFilter) {
- // We do expect nothing but name for method tokens (No round brackets)
- String filter = expr.getMemberName();
- if(filter == null) filter = "";
-
- // This is used for validation.
- if (info.getName().equals(filter)) {
- javaElements.add(info.getJavaElement());
- } else {
- if (info instanceof TypeInfoCollector.MethodInfo) {
- TypeInfoCollector.MethodInfo methodInfo = (TypeInfoCollector.MethodInfo)info;
- if(methodInfo.isGetter() || methodInfo.isSetter()) {
- StringBuffer name = new StringBuffer(methodInfo.getName());
- if(methodInfo.getName().startsWith("i")) { //$NON-NLS-1$
- name.delete(0, 2);
- } else {
- name.delete(0, 3);
- }
- name.setCharAt(0, Character.toLowerCase(name.charAt(0)));
- String propertyName = name.toString();
- if (propertyName.equals(filter)) {
- javaElements.add(methodInfo.getJavaElement());
- }
- }
- }
- }
- }
- }
- res.addAll(javaElements);
- }
-
/**
*
* @param document
@@ -1089,7 +1095,6 @@
public static boolean isSeamMessagesComponentVariable(ISeamContextVariable variable) {
return (null != getSeamMessagesComponentVariable(variable));
}
-
}
class StringVariable implements ISeamContextVariable, ISeamJavaSourceReference {
@@ -1145,5 +1150,4 @@
public StringVariable clone() throws CloneNotSupportedException {
throw new CloneNotSupportedException();
}
-}
-
+}
\ No newline at end of file
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java 2009-05-08
14:50:46 UTC (rev 15139)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -436,7 +436,7 @@
List<Var> vars = varSearcher.findAllVars(viewer, offset);
SeamELCompletionEngine fEngine= new SeamELCompletionEngine(seamProject);
- List<TextProposal> suggestions = fEngine.getCompletions(file, document, prefix,
offset + proposalPrefix.length() - prefix.length(), false, vars, start, end);
+ List<TextProposal> suggestions = fEngine.getCompletions(file, document, prefix,
offset + proposalPrefix.length() - prefix.length(), false, vars);
List<TextProposal> uniqueSuggestions = fEngine.makeKbUnique(suggestions);
List<ICompletionProposal> result= new ArrayList<ICompletionProposal>();
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamELAttributeContentProposalProvider.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamELAttributeContentProposalProvider.java 2009-05-08
14:50:46 UTC (rev 15139)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamELAttributeContentProposalProvider.java 2009-05-08
16:09:37 UTC (rev 15140)
@@ -110,7 +110,7 @@
List<TextProposal> suggestions = null;
try {
- suggestions = engine.getCompletions(file, null, prefix, position, false, null, 0,
contents.length());
+ suggestions = engine.getCompletions(file, null, prefix, position, false, null);
} catch (BadLocationException e) {
SeamGuiPlugin.getPluginLog().logError(e);
}