Author: akazakov
Date: 2009-05-15 08:18:47 -0400 (Fri, 15 May 2009)
New Revision: 15271
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/.classpath
trunk/jst/plugins/org.jboss.tools.jst.web.kb/.project
trunk/jst/plugins/org.jboss.tools.jst.web.kb/.settings/
trunk/jst/plugins/org.jboss.tools.jst.web.kb/.settings/org.eclipse.jdt.core.prefs
trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/
trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF
trunk/jst/plugins/org.jboss.tools.jst.web.kb/about.html
trunk/jst/plugins/org.jboss.tools.jst.web.kb/build.properties
trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.properties
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/Activator.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IFaceletPageContext.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IPageContext.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IProposalProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IResourceBundle.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbQuery.java
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/PageProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/
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/JspContextImpl.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2808
Share project "org.jboss.tools.jst.web.kb" into
"https://svn.jboss.org/repos/jbosstools"
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/.classpath
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/.classpath (rev
0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/.classpath 2009-05-15 12:18:47 UTC (rev
15271)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/.classpath
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/.project
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/.project (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/.project 2009-05-15 12:18:47 UTC (rev
15271)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.jst.web.kb</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/.settings/org.eclipse.jdt.core.prefs 2009-05-15
12:18:47 UTC (rev 15271)
@@ -0,0 +1,8 @@
+#Fri May 15 15:20:06 MSD 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF
(rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF 2009-05-15 12:18:47
UTC (rev 15271)
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name.0
+Bundle-SymbolicName: org.jboss.tools.jst.web.kb;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: org.jboss.tools.jst.web.kb.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.jboss.tools.jst.web;bundle-version="2.0.0",
+ org.jboss.tools.common.el.core;bundle-version="2.0.0",
+ org.eclipse.jface.text;bundle-version="3.5.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Vendor: %providerName
+Export-Package: org.jboss.tools.jst.web.kb,
+ org.jboss.tools.jst.web.kb.taglib
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/about.html
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/about.html (rev
0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/about.html 2009-05-15 12:18:47 UTC (rev
15271)
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+
+<head>
+<title>About</title>
+<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
+</head>
+
+<BODY lang="EN-US">
+
+<H3>About This Content</H3>
+
+<P>©2009 Red Hat, Inc. All rights reserved</P>
+
+<H3>License</H3>
+
+<P>Red Hat Inc., through its JBoss division, makes available all content in this
plug-in
+("Content"). Unless otherwise indicated below, the Content is provided to you
+under the terms and conditions of the Eclipse Public License Version 1.0
+("EPL"). A copy of the EPL is available at
+<A
href="http://www.eclipse.org/org/documents/epl-v10.php">http...;.
+For purposes of the EPL, "Program" will mean the Content.</P>
+
+<P>If you did not receive this Content directly from Red Hat Inc., the
+Content is being redistributed by another party ("Redistributor") and different
+terms and conditions may apply to your use of any object code in the Content.
+Check the Redistributor's license that was provided with the Content. If no such
+license exists, contact the Redistributor. Unless otherwise indicated below, the
+terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at
+ <A
href="http://www.jboss.org/tools">http://www.jboss.org/tools...
+
+</BODY>
+</HTML>
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/about.html
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/build.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/build.properties
(rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/build.properties 2009-05-15 12:18:47 UTC
(rev 15271)
@@ -0,0 +1,7 @@
+bin.includes = META-INF/,\
+ plugin.properties,\
+ webKb.jar,\
+ about.html
+source.webKb.jar = src/
+output.webKb.jar = bin/
+jars.compile.order = webKb.jar
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/build.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.properties
(rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.properties 2009-05-15 12:18:47 UTC
(rev 15271)
@@ -0,0 +1,4 @@
+providerName=JBoss, a division of Red Hat
+# START NON-TRANSLATABLE
+Bundle-Name.0 = Web KB
+# END NON-TRANSLATABLE
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/Activator.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/Activator.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/Activator.java 2009-05-15
12:18:47 UTC (rev 15271)
@@ -0,0 +1,50 @@
+package org.jboss.tools.jst.web.kb;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.jst.web.kb";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/Activator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IFaceletPageContext.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IFaceletPageContext.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IFaceletPageContext.java 2009-05-15
12:18:47 UTC (rev 15271)
@@ -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.kb/src/org/jboss/tools/jst/web/kb/IFaceletPageContext.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IPageContext.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IPageContext.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IPageContext.java 2009-05-15
12:18:47 UTC (rev 15271)
@@ -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.kb/src/org/jboss/tools/jst/web/kb/IPageContext.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IProposalProcessor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IProposalProcessor.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IProposalProcessor.java 2009-05-15
12:18:47 UTC (rev 15271)
@@ -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.kb/src/org/jboss/tools/jst/web/kb/IProposalProcessor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IResourceBundle.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IResourceBundle.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IResourceBundle.java 2009-05-15
12:18:47 UTC (rev 15271)
@@ -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.kb/src/org/jboss/tools/jst/web/kb/IResourceBundle.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbQuery.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbQuery.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbQuery.java 2009-05-15
12:18:47 UTC (rev 15271)
@@ -0,0 +1,175 @@
+/*******************************************************************************
+ * 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;
+
+/**
+ * Query object is used to get info from Page Processors.
+ * @author Alexey Kazakov
+ */
+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
+ * @author Alexey Kazakov
+ */
+ public static enum Type {
+ TEXT,
+ TAG_NAME,
+ ATTRIBUTE_NAME,
+ ATTRIBUTE_VALUE
+ }
+
+ public KbQuery() {
+ }
+
+ /**
+ * URI of tag library
+ * @return
+ */
+ public String getUri() {
+ return uri;
+ }
+
+ public void setUri(String uri) {
+ this.uri = uri;
+ }
+
+ /**
+ * The stack of parent tags
+ * @return
+ */
+ public String[] getParentTags() {
+ 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
+ */
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ /**
+ * 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() {
+ return useAsMask;
+ }
+
+ public void setMask(boolean useAsMask) {
+ this.useAsMask = useAsMask;
+ }
+
+ /**
+ * Returns type of value
+ * @return
+ */
+ public Type getType() {
+ return type;
+ }
+
+ public void setType(Type type) {
+ this.type = type;
+ }
+
+ /**
+ * @return offset
+ */
+ public int getOffset() {
+ return offset;
+ }
+
+ 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
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbQuery.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
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
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java 2009-05-15
12:18:47 UTC (rev 15271)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * 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.core.resources.IFile;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class PageContextFactory {
+
+ /**
+ * Creates a page context for given resource and offset.
+ * @param file
+ * @param offset
+ * @return
+ */
+ public static IPageContext createPageContext(IFile file, int offset) {
+ // TODO
+ return null;
+ }
+}
\ No newline at end of file
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageProcessor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageProcessor.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageProcessor.java 2009-05-15
12:18:47 UTC (rev 15271)
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * 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.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.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 implements IProposalProcessor {
+
+ /*
+ * (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()]);
+ }
+
+ /**
+ * 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
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageProcessor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
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
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/FaceletContextImpl.java 2009-05-15
12:18:47 UTC (rev 15271)
@@ -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.kb/src/org/jboss/tools/jst/web/kb/internal/FaceletContextImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
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
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java 2009-05-15
12:18:47 UTC (rev 15271)
@@ -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.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain