[jbosstools-commits] JBoss Tools SVN: r17628 - in trunk: jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist and 4 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Sep 16 19:44:43 EDT 2009


Author: akazakov
Date: 2009-09-16 19:44:43 -0400 (Wed, 16 Sep 2009)
New Revision: 17628

Added:
   trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/SimpleELContext.java
Modified:
   trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELCompletionEngine.java
   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/ELResolver.java
   trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ElVarSearcher.java
   trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java
   trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/AbstractELCompletionEngine.java
   trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamPromptingProvider.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-4860

Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELCompletionEngine.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELCompletionEngine.java	2009-09-16 21:01:18 UTC (rev 17627)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELCompletionEngine.java	2009-09-16 23:44:43 UTC (rev 17628)
@@ -15,12 +15,9 @@
 import org.eclipse.core.resources.IFile;
 import org.eclipse.jface.text.BadLocationException;
 import org.jboss.tools.common.el.core.model.ELExpression;
-import org.jboss.tools.common.el.core.parser.ELParserFactory;
 
-public interface ELCompletionEngine {
+public interface ELCompletionEngine extends ELResolver {
 
 	public ELResolution resolveELOperand(IFile file, ELExpression operand,  
 			boolean returnEqualedVariablesOnly, List<Var> vars, ElVarSearcher varSearcher) throws BadLocationException, StringIndexOutOfBoundsException;
-
-	public ELParserFactory getParserFactory();
 }
\ No newline at end of file

Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java	2009-09-16 21:01:18 UTC (rev 17627)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java	2009-09-16 23:44:43 UTC (rev 17628)
@@ -15,46 +15,19 @@
 import java.util.List;
 import java.util.Map;
 
-import org.eclipse.core.resources.IFile;
 import org.eclipse.jface.text.Region;
 
 /**
  * EL context
  * @author Alexey Kazakov
  */
-public class ELContextImpl implements ELContext {
+public class ELContextImpl extends SimpleELContext {
 
-	protected IFile resource;
-	protected ELResolver[] elResolvers;
 	protected Map<Region, List<Var>> vars = new HashMap<Region, List<Var>>();
 	protected List<Var> allVars = new ArrayList<Var>();
 
 	/*
 	 * (non-Javadoc)
-	 * @see org.jboss.tools.common.el.core.resolver.ELContext#getElResolvers()
-	 */
-	public ELResolver[] getElResolvers() {
-		return elResolvers;
-	}
-
-	public void setElResolvers(ELResolver[] elResolvers) {
-		this.elResolvers = elResolvers;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see org.jboss.tools.common.el.core.resolver.ELContext#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#getVars()
 	 */
 	public Var[] getVars() {

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-09-16 21:01:18 UTC (rev 17627)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolver.java	2009-09-16 23:44:43 UTC (rev 17628)
@@ -13,11 +13,11 @@
 import java.util.List;
 
 import org.jboss.tools.common.el.core.model.ELExpression;
+import org.jboss.tools.common.el.core.parser.ELParserFactory;
 import org.jboss.tools.common.text.TextProposal;
 
 /**
  * Represents EL Resolver.
- * TODO replace old ELResolver interface with this one.
  * @author Alexey Kazakov
  */
 public interface ELResolver {
@@ -36,4 +36,9 @@
 	 * @return
 	 */
 	ELResolution resolve(ELContext context, ELExpression operand);
+
+	/**
+	 * @return EL parser factory
+	 */
+	ELParserFactory getParserFactory();
 }
\ No newline at end of file

Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ElVarSearcher.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ElVarSearcher.java	2009-09-16 21:01:18 UTC (rev 17627)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ElVarSearcher.java	2009-09-16 23:44:43 UTC (rev 17628)
@@ -26,6 +26,7 @@
 import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
 import org.jboss.tools.common.el.core.Activator;
 import org.jboss.tools.common.el.core.model.ELExpression;
+import org.jboss.tools.common.el.core.parser.ELParserFactory;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
@@ -158,9 +159,32 @@
 	 * @return All var/value that can be used in this position and null if can't find anyone.
 	 */
 	public List<Var> findAllVars(IFile file, int offset) {
+		return findAllVars(file, offset, engine.getParserFactory());
+	}
+
+	/**
+	 * @param context
+	 * @param offset
+	 * @param resolver
+	 * @return All var/value that can be used in this position and null if can't find anyone.
+	 */
+	public static List<Var> findAllVars(ELContext context, int offset, ELResolver resolver) {
+		Node node = getNode(context.getResource(), offset);
+		if(node!=null) {
+			return findAllVars(node, resolver.getParserFactory());
+		}
+		return null;
+	}
+
+	/**
+	 * @param node
+	 * @param factory
+	 * @return All var/value that can be used in this position and null if can't find anyone.
+	 */
+	public static List<Var> findAllVars(IFile file, int offset, ELParserFactory factory) {
 		Node node = getNode(file, offset);
 		if(node!=null) {
-			return findAllVars(node);
+			return findAllVars(node, factory);
 		}
 		return null;
 	}
@@ -170,11 +194,19 @@
 	 * @return All var/value that can be used in node and null if can't find anyone.
 	 */
 	public List<Var> findAllVars(Node node) {
+		return findAllVars(node, engine.getParserFactory());
+	}
+
+	/**
+	 * @param node
+	 * @param factory
+	 * @return All var/value that can be used in node and null if can't find anyone.
+	 */
+	public static List<Var> findAllVars(Node node, ELParserFactory factory) {
 		ArrayList<Var> vars = null;
-//		Node parentNode = node.getParentNode();
 		Node parentNode = node;
 		while(parentNode!=null) {
-			Var var = findVar(parentNode);
+			Var var = findVar(parentNode, factory);
 			if(var!=null) {
 				if(vars == null) {
 					vars = new ArrayList<Var>();
@@ -205,6 +237,17 @@
 	 * @return found var/value or null
 	 */
 	public Var findVar(Node node) {
+		return findVar(node, engine.getParserFactory());
+	}
+
+	/**
+	 * Finds var/value attribute in node
+	 * @param node
+	 * @param vars
+	 * @param factory
+	 * @return found var/value or null
+	 */
+	public static Var findVar(Node node, ELParserFactory factory) {
 		if(node!=null && Node.ELEMENT_NODE == node.getNodeType()) {
 			Element element = (Element)node;
 			String var = element.getAttribute(VAR_ATTRIBUTE_NAME);
@@ -223,7 +266,7 @@
 					String value = element.getAttribute(VALUE_ATTRIBUTE_NAME);
 					if(value!=null) {
 						value = value.trim();
-						Var newVar = new Var(engine.getParserFactory(), var, value, declOffset, declLength);
+						Var newVar = new Var(factory, var, value, declOffset, declLength);
 						if(newVar.getElToken()!=null) {
 							return newVar;
 						}

Added: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/SimpleELContext.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/SimpleELContext.java	                        (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/SimpleELContext.java	2009-09-16 23:44:43 UTC (rev 17628)
@@ -0,0 +1,73 @@
+/******************************************************************************* 
+ * 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.common.el.core.resolver;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class SimpleELContext implements ELContext {
+
+	protected IFile resource;
+	protected ELResolver[] elResolvers;
+	protected List<Var> vars = new ArrayList<Var>();
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.common.el.core.resolver.ELContext#getElResolvers()
+	 */
+	public ELResolver[] getElResolvers() {
+		return elResolvers;
+	}
+
+	public void setElResolvers(ELResolver[] elResolvers) {
+		this.elResolvers = elResolvers;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.common.el.core.resolver.ELContext#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#getVars()
+	 */
+	public Var[] getVars() {
+		return vars.toArray(new Var[vars.size()]);
+	}
+
+	/**
+	 * @param vars
+	 */
+	public void setVars(List<Var> vars) {
+		this.vars = vars;
+	}
+
+	/**
+	 * Adds new Var to the context
+	 * @param vars
+	 */
+	public void addVar(Var var) {
+		vars.add(var);
+	}
+}


Property changes on: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/SimpleELContext.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java	2009-09-16 21:01:18 UTC (rev 17627)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java	2009-09-16 23:44:43 UTC (rev 17628)
@@ -26,6 +26,7 @@
 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.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.KbQuery.Type;
@@ -67,6 +68,14 @@
 			public ELParserFactory getParserFactory() {
 				return ELParserUtil.getJbossFactory();
 			}
+
+			public List<TextProposal> getProposals(ELContext context, String el) {
+				return null;
+			}
+
+			public ELResolution resolve(ELContext context, ELExpression operand) {
+				return null;
+			}
 		};
 		ElVarSearcher varSearcher = new ElVarSearcher(file, fakeEngine);
 		List<Var> vars = varSearcher.findAllVars(file, getOffset());

Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/AbstractELCompletionEngine.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/AbstractELCompletionEngine.java	2009-09-16 21:01:18 UTC (rev 17627)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/AbstractELCompletionEngine.java	2009-09-16 23:44:43 UTC (rev 17628)
@@ -66,80 +66,49 @@
 	 * @see org.jboss.tools.common.el.core.resolver.ELResolver2#getProposals(org.jboss.tools.common.el.core.resolver.ELContext, java.lang.String)
 	 */
 	public List<TextProposal> getProposals(ELContext context, String el) {
-		return getCompletions(el, false, 0, context);
-	}
+		List<TextProposal> completions = new ArrayList<TextProposal>();
 
-	/*
-	 * (non-Javadoc)
-	 * @see org.jboss.tools.common.el.core.resolver.ELResolver2#resolve(org.jboss.tools.common.el.core.resolver.ELContext, org.jboss.tools.common.el.core.model.ELExpression)
-	 */
-	public ELResolution resolve(ELContext context, ELExpression operand) {
 		List<Var> vars = new ArrayList<Var>();
 		Var[] array = context.getVars();
 		for (int i = 0; i < array.length; i++) {
 			vars.add(array[i]);
 		}
-		ELResolutionImpl resolution = null;
+
+		ELResolutionImpl resolution;
 		try {
-			resolution = resolveELOperand(context.getResource(), operand, true, vars, new ElVarSearcher(context.getResource(), this));
-			resolution.setContext(context);
+			resolution = resolveELOperand(context.getResource(), parseOperand(el), false, vars, new ElVarSearcher(context.getResource(), this));
+			completions.addAll(resolution.getProposals());
 		} catch (StringIndexOutOfBoundsException e) {
 			log(e);
 		} catch (BadLocationException e) {
 			log(e);
 		}
-		return resolution;
+		
+		return completions;
 	}
 
-	private List<TextProposal> getCompletions(String elString, boolean returnEqualedVariablesOnly, int position, ELContext context) {
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.common.el.core.resolver.ELResolver#resolve(org.jboss.tools.common.el.core.resolver.ELContext, org.jboss.tools.common.el.core.model.ELExpression)
+	 */
+	public ELResolution resolve(ELContext context, ELExpression operand) {
 		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;
+		ELResolutionImpl resolution = null;
 		try {
-			 proposals = getCompletions(context.getResource(), elString.subSequence(0, elString.length()), position, returnEqualedVariablesOnly, vars);
+			resolution = resolveELOperand(context.getResource(), operand, true, vars, new ElVarSearcher(context.getResource(), this));
+			resolution.setContext(context);
 		} catch (StringIndexOutOfBoundsException e) {
 			log(e);
 		} catch (BadLocationException e) {
 			log(e);
 		}
-		return proposals;
+		return resolution;
 	}
 
-	/**
-	 * Create the list of suggestions. 
-	 * @param seamProject Seam project 
-	 * @param file File 
-	 * @param documentContent
-	 * @param prefix the prefix to search for
-	 * @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  
-	 *  for example:
-	 *   we have 'variableName.variableProperty', 'variableName.variableProperty1', 'variableName.variableProperty2'  
-	 *   prefix is 'variableName.variableProperty'
-	 *   Result is {'variableProperty'}
-	 * if 'false' then returns ends of variables that starts with prefix. It's useful for CA.
-	 *  for example:
-	 *   we have 'variableName.variableProperty', 'variableName.variableProperty1', 'variableName.variableProperty2'
-	 *   prefix is 'variableName.variableProperty'
-	 *   Result is {'1','2'}
-	 * @return the list of all possible suggestions
-	 * @throws BadLocationException if accessing the current document fails
-	 * @throws StringIndexOutOfBoundsException
-	 */
-	public List<TextProposal> getCompletions(IFile file, CharSequence prefix, 
-			int position, boolean returnEqualedVariablesOnly, List<Var> vars) throws BadLocationException, StringIndexOutOfBoundsException {
-		List<TextProposal> completions = new ArrayList<TextProposal>();
-
-		ELResolutionImpl resolution = resolveELOperand(file, parseOperand("" + prefix), returnEqualedVariablesOnly, vars, new ElVarSearcher(file, this)); //$NON-NLS-1$
-		completions.addAll(resolution.getProposals());
-
-		return completions;
-	}
-
 	public ELResolution resolveELOperand(ELExpression operand, ELContext context, boolean returnEqualedVariablesOnly) {
 		List<Var> vars = new ArrayList<Var>();
 		Var[] array = context.getVars();
@@ -184,6 +153,10 @@
 		return proposals;
 	}
 
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.common.el.core.resolver.ELCompletionEngine#resolveELOperand(org.eclipse.core.resources.IFile, org.jboss.tools.common.el.core.model.ELExpression, boolean, java.util.List, org.jboss.tools.common.el.core.resolver.ElVarSearcher)
+	 */
 	public ELResolutionImpl resolveELOperand(IFile file,
 			ELExpression operand, boolean returnEqualedVariablesOnly,
 			List<Var> vars, ElVarSearcher varSearcher)

Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamPromptingProvider.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamPromptingProvider.java	2009-09-16 21:01:18 UTC (rev 17627)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamPromptingProvider.java	2009-09-16 23:44:43 UTC (rev 17628)
@@ -17,8 +17,7 @@
 import java.util.TreeSet;
 
 import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.text.BadLocationException;
-import org.jboss.tools.common.el.core.resolver.Var;
+import org.jboss.tools.common.el.core.resolver.SimpleELContext;
 import org.jboss.tools.common.model.XModel;
 import org.jboss.tools.common.model.project.IPromptingProvider;
 import org.jboss.tools.common.text.TextProposal;
@@ -58,16 +57,14 @@
 			list.addAll(set);
 			return list;
 		} else if(MEMBERS.equals(id)) {
-			try {
-				List<TextProposal> proposals = engine.getCompletions(f, prefix, prefix.length(), false, new ArrayList<Var>());
-				List<String> suggestions = new ArrayList<String>();
-				if(proposals != null) for (TextProposal proposal: proposals) {
-					suggestions.add(proposal.getReplacementString());
-				}
-				return suggestions;
-			} catch (BadLocationException e) {
-				return EMPTY_LIST;
+			SimpleELContext context = new SimpleELContext();
+			context.setResource(f);
+			List<TextProposal> proposals = engine.getProposals(context, prefix);
+			List<String> suggestions = new ArrayList<String>();
+			if(proposals != null) for (TextProposal proposal: proposals) {
+				suggestions.add(proposal.getReplacementString());
 			}
+			return suggestions;
 		}
 		return null;
 	}

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-09-16 21:01:18 UTC (rev 17627)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java	2009-09-16 23:44:43 UTC (rev 17628)
@@ -59,6 +59,7 @@
 import org.jboss.tools.common.el.core.model.ELModel;
 import org.jboss.tools.common.el.core.model.ELUtil;
 import org.jboss.tools.common.el.core.resolver.ElVarSearcher;
+import org.jboss.tools.common.el.core.resolver.SimpleELContext;
 import org.jboss.tools.common.el.core.resolver.Var;
 import org.jboss.tools.common.model.ui.texteditors.xmleditor.XMLTextEditor;
 import org.jboss.tools.common.text.TextProposal;
@@ -436,7 +437,10 @@
 			List<Var> vars = varSearcher.findAllVars(viewer, offset);
 			
 			SeamELCompletionEngine fEngine= new SeamELCompletionEngine();
-			List<TextProposal> suggestions = fEngine.getCompletions(file, prefix, offset + proposalPrefix.length() - prefix.length(), false, vars);
+			SimpleELContext elContext = new SimpleELContext();
+			elContext.setResource(file);
+			elContext.setVars(vars);
+			List<TextProposal> suggestions = fEngine.getProposals(elContext, prefix);
 			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-09-16 21:01:18 UTC (rev 17627)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamELAttributeContentProposalProvider.java	2009-09-16 23:44:43 UTC (rev 17628)
@@ -19,12 +19,12 @@
 import org.eclipse.jface.fieldassist.ContentProposalAdapter;
 import org.eclipse.jface.fieldassist.IContentProposal;
 import org.eclipse.jface.fieldassist.IContentProposalProvider;
-import org.eclipse.jface.text.BadLocationException;
 import org.eclipse.jface.viewers.LabelProvider;
 import org.jboss.tools.common.el.core.model.ELInstance;
 import org.jboss.tools.common.el.core.model.ELInvocationExpression;
 import org.jboss.tools.common.el.core.model.ELModel;
 import org.jboss.tools.common.el.core.model.ELUtil;
+import org.jboss.tools.common.el.core.resolver.SimpleELContext;
 import org.jboss.tools.common.meta.XAttribute;
 import org.jboss.tools.common.model.XModelObject;
 import org.jboss.tools.common.model.ui.attribute.IAttributeContentProposalProvider;
@@ -32,7 +32,6 @@
 import org.jboss.tools.seam.core.ISeamProject;
 import org.jboss.tools.seam.core.SeamCorePlugin;
 import org.jboss.tools.seam.internal.core.el.SeamELCompletionEngine;
-import org.jboss.tools.seam.ui.SeamGuiPlugin;
 
 /**
  * @author Viacheslav Kabanovich
@@ -109,11 +108,9 @@
 			if(prefix == null) prefix = "";
 			
 			List<TextProposal> suggestions = null;
-			try {
-				suggestions = engine.getCompletions(file, prefix, position, false, null);
-			} catch (BadLocationException e) {
-				SeamGuiPlugin.getPluginLog().logError(e);
-			}
+			SimpleELContext context = new SimpleELContext();
+			context.setResource(file);
+			suggestions = engine.getProposals(context, prefix);
 			if(suggestions == null) {
 				return EMPTY;
 			}



More information about the jbosstools-commits mailing list