Author: akazakov
Date: 2009-05-18 13:11:12 -0400 (Mon, 18 May 2009)
New Revision: 15333
Added:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContext.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/internal/JspContextImpl.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2808
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContext.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContext.java 2009-05-18
16:58:19 UTC (rev 15332)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContext.java 2009-05-18
17:11:12 UTC (rev 15333)
@@ -34,4 +34,10 @@
* @return
*/
ElVarSearcher getVarSearcher();
+
+ /**
+ * Returns EL Resolvers which are declared for this resource
+ * @return
+ */
+ ELResolver[] getElResolvers();
}
\ No newline at end of file
Added:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java
(rev 0)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java 2009-05-18
17:11:12 UTC (rev 15333)
@@ -0,0 +1,93 @@
+package org.jboss.tools.common.el.core.resolver;
+
+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.Region;
+
+/**
+ * EL context
+ * @author Alexey Kazakov
+ */
+public class ELContextImpl implements ELContext {
+
+ protected IFile resource;
+ protected ELResolver[] elResolvers;
+ protected ElVarSearcher varSearcher;
+ protected Map<Region, Set<Var>> vars = new HashMap<Region,
Set<Var>>();
+ protected Set<Var> allVars = new HashSet<Var>();
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.common.kb.text.PageContext#getElResolvers()
+ */
+ public ELResolver[] getElResolvers() {
+ return elResolvers;
+ }
+
+ public void setElResolvers(ELResolver[] elResolvers) {
+ this.elResolvers = elResolvers;
+ }
+
+ /*
+ * (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.el.core.resolver.ELContext#getVarSearcher()
+ */
+ public ElVarSearcher getVarSearcher() {
+ return varSearcher;
+ }
+
+ /**
+ * @param varSearcher the varSearcher to set
+ */
+ public void setVarSearcher(ElVarSearcher varSearcher) {
+ this.varSearcher = varSearcher;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.common.el.core.resolver.ELContext#getVars()
+ */
+ public Var[] getVars() {
+ return allVars.toArray(new Var[allVars.size()]);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.common.kb.text.PageContext#getVars(int)
+ */
+ public Var[] getVars(int offset) {
+ Set<Var> result = new HashSet<Var>();
+ for (Region region : vars.keySet()) {
+ if(offset>=region.getOffset() && offset<=region.getOffset() +
region.getLength()) {
+ result.addAll(vars.get(region));
+ }
+ }
+ return result.toArray(new Var[result.size()]);
+ }
+
+ /**
+ * Adds new Var to the context
+ * @param region
+ * @param vars
+ */
+ public void addVar(Region region, Var var) {
+ this.vars.get(region).add(var);
+ allVars.add(var);
+ }
+}
\ No newline at end of file
Property changes on:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
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 2009-05-18
16:58:19 UTC (rev 15332)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IPageContext.java 2009-05-18
17:11:12 UTC (rev 15333)
@@ -14,7 +14,6 @@
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.INameSpace;
import org.jboss.tools.jst.web.kb.taglib.ITagLibrary;
@@ -32,12 +31,6 @@
ITagLibrary[] getLibraries();
/**
- * Returns EL Resolvers which are declared for this page
- * @return
- */
- ELResolver[] getElResolvers();
-
- /**
* Returns resource bundles
* @return
*/
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java 2009-05-18
16:58:19 UTC (rev 15332)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java 2009-05-18
17:11:12 UTC (rev 15333)
@@ -11,16 +11,11 @@
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.common.el.core.resolver.ELContextImpl;
import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.kb.IResourceBundle;
import org.jboss.tools.jst.web.kb.taglib.INameSpace;
@@ -30,32 +25,15 @@
* JSP page context
* @author Alexey Kazakov
*/
-public class JspContextImpl implements IPageContext {
+public class JspContextImpl extends ELContextImpl implements IPageContext {
- private IFile resource;
private IDocument document;
- private ElVarSearcher varSearcher;
private ITagLibrary[] libs;
- private ELResolver[] elResolvers;
- private Map<Region, Set<Var>> vars = new HashMap<Region,
Set<Var>>();
private Map<Region, Map<String, INameSpace>> nameSpaces = new
HashMap<Region, Map<String, INameSpace>>();
- private Set<Var> allVars = new HashSet<Var>();
private IResourceBundle[] bundles;
/*
* (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() {
@@ -68,42 +46,6 @@
/*
* (non-Javadoc)
- * @see org.jboss.tools.common.kb.text.PageContext#getElResolvers()
- */
- public ELResolver[] getElResolvers() {
- return elResolvers;
- }
-
- public void setElResolvers(ELResolver[] elResolvers) {
- this.elResolvers = elResolvers;
- }
-
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.common.kb.text.PageContext#getVars(int)
- */
- public Var[] getVars(int offset) {
- Set<Var> result = new HashSet<Var>();
- for (Region region : vars.keySet()) {
- if(offset>=region.getOffset() && offset<=region.getOffset() +
region.getLength()) {
- result.addAll(vars.get(region));
- }
- }
- return result.toArray(new Var[result.size()]);
- }
-
- /**
- * Adds new Var to the context
- * @param region
- * @param vars
- */
- public void addVar(Region region, Var var) {
- this.vars.get(region).add(var);
- allVars.add(var);
- }
-
- /*
- * (non-Javadoc)
* @see org.jboss.tools.common.kb.text.PageContext#getResourceBundles()
*/
public IResourceBundle[] getResourceBundles() {
@@ -139,13 +81,6 @@
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()
@@ -154,22 +89,6 @@
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()]);
- }
-
/* (non-Javadoc)
* @see org.jboss.tools.jst.web.kb.IPageContext#getNameSpaces(int)
*/