Author: vrubezhny
Date: 2007-08-16 15:24:10 -0400 (Thu, 16 Aug 2007)
New Revision: 3188
Added:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/.classpath
trunk/seam/plugins/org.jboss.tools.seam.text.ext/.project
trunk/seam/plugins/org.jboss.tools.seam.text.ext/build.properties
trunk/seam/plugins/org.jboss.tools.seam.text.ext/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/SeamExtPlugin.java
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlink.java
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlinkPartitioner.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-735 Open-Ons for Beans and Bean properties
don't work in Seam projects.
A new plugin is added for Seam text extensions
Added: trunk/seam/plugins/org.jboss.tools.seam.text.ext/.classpath
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.text.ext/.classpath
(rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.text.ext/.classpath 2007-08-16 19:24:10 UTC
(rev 3188)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/seam/plugins/org.jboss.tools.seam.text.ext/.project
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.text.ext/.project (rev
0)
+++ trunk/seam/plugins/org.jboss.tools.seam.text.ext/.project 2007-08-16 19:24:10 UTC (rev
3188)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.seam.text.ext</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>
Added: trunk/seam/plugins/org.jboss.tools.seam.text.ext/build.properties
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.text.ext/build.properties
(rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.text.ext/build.properties 2007-08-16 19:24:10
UTC (rev 3188)
@@ -0,0 +1,8 @@
+source.seamextensions.jar = src/
+output.seamextensions.jar = bin/
+bin.includes = plugin.xml,\
+ seamextensions.jar
+source.seamextensions.jar = src/
+src.includes = src/,\
+ plugin.xml,\
+ META-INF/
Added: trunk/seam/plugins/org.jboss.tools.seam.text.ext/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.text.ext/plugin.xml
(rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.text.ext/plugin.xml 2007-08-16 19:24:10 UTC
(rev 3188)
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+
+ <extension
+ point="org.jboss.tools.common.text.ext.hyperlinkPartitioner"
+ id="org.jboss.tools.seam.text.ext.hyperlinkPartitioner"
+ name="org.jboss.tools.seam.text.ext.hyperlinkPartitioner">
+
+ <hyperlinkPartitioner
+
id="org.jboss.tools.seam.text.ext.hyperlink.SeamBeanHyperlinkPartitioner"
+
class="org.jboss.tools.seam.text.ext.hyperlink.SeamBeanHyperlinkPartitioner">
+ <contentType id="org.eclipse.jst.jsp.core.jspsource">
+ <partitionType
id="org.jboss.tools.common.text.ext.jsp.JSP_EXPRESSION" />
+ </contentType>
+ <contentType id="org.eclipse.wst.html.core.htmlsource">
+ <partitionType
id="org.jboss.tools.common.text.ext.jsp.JSP_EXPRESSION" />
+ </contentType>
+ <contentType id="org.eclipse.core.runtime.xml">
+ <partitionType
id="org.jboss.tools.common.text.ext.jsp.JSP_EXPRESSION" />
+ </contentType>
+
+ <!-- org.jboss.tools.common.text.ext.xml.XML_ATTRIBUTE_VALUE -->
+ <!-- org.jboss.tools.common.text.ext.xml.XML_TEXT -->
+ </hyperlinkPartitioner>
+ <hyperlinkPartitioner
+
id="org.jboss.tools.common.text.ext.jsf.hyperlink.JSPExprHyperlinkPartitioner1"
+
class="org.jboss.tools.jsf.text.ext.hyperlink.JSPExprHyperlinkPartitioner">
+
+ <contentType id="org.eclipse.core.runtime.xml">
+ <partitionType
id="org.jboss.tools.common.text.ext.xml.XML_ATTRIBUTE_VALUE" />
+ <partitionType id="org.jboss.tools.common.text.ext.xml.XML_TEXT"
/>
+ </contentType>
+ </hyperlinkPartitioner>
+ </extension>
+
+ <extension
+ point="org.jboss.tools.common.text.ext.hyperlink"
+ id="org.jboss.tools.seam.text.ext.hyperlink"
+ name="org.jboss.tools.seam.text.ext.hyperlink">
+
+ <hyperlink
+ class="org.jboss.tools.seam.text.ext.hyperlink.SeamBeanHyperlink"
+ id="org.jboss.tools.seam.text.ext.hyperlink.SeamBeanHyperlink">
+ <contenttypeidentifier id="org.eclipse.jst.jsp.core.jspsource">
+ <partitiontype id="org.jboss.tools.seam.text.ext.SEAM_BEAN" />
+ </contenttypeidentifier>
+ <contenttypeidentifier id="org.eclipse.wst.html.core.htmlsource">
+ <partitiontype id="org.jboss.tools.seam.text.ext.SEAM_BEAN" />
+ </contenttypeidentifier>
+ <contenttypeidentifier id="org.eclipse.core.runtime.xml">
+ <partitiontype id="org.jboss.tools.seam.text.ext.SEAM_BEAN" />
+ </contenttypeidentifier>
+ </hyperlink>
+ </extension>
+
+</plugin>
Added:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/SeamExtPlugin.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/SeamExtPlugin.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/SeamExtPlugin.java 2007-08-16
19:24:10 UTC (rev 3188)
@@ -0,0 +1,57 @@
+package org.jboss.tools.seam.text.ext;
+
+import org.jboss.tools.common.log.BaseUIPlugin;
+import org.jboss.tools.common.log.IPluginLog;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class SeamExtPlugin extends BaseUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.seam.text.ext";
+
+ // The shared instance
+ private static SeamExtPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public SeamExtPlugin() {
+ }
+
+ /*
+ * (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 SeamExtPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @return IPluginLog object
+ */
+ public static IPluginLog getPluginLog() {
+ return getDefault();
+ }
+}
Added:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlink.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlink.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlink.java 2007-08-16
19:24:10 UTC (rev 3188)
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.text.ext.hyperlink;
+
+import java.util.List;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.ui.IEditorPart;
+import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
+import org.jboss.tools.seam.text.ext.SeamExtPlugin;
+
+/**
+ * @author Jeremy
+ */
+public class SeamBeanHyperlink extends AbstractHyperlink {
+
+ /**
+ * @see
com.ibm.sse.editor.AbstractHyperlink#doHyperlink(org.eclipse.jface.text.IRegion)
+ */
+ protected void doHyperlink(IRegion region) {
+ try {
+ List<IJavaElement> elements =
SeamBeanHyperlinkPartitioner.findJavaElements(getDocument(), region);
+
+ IEditorPart part = null;
+ if (elements != null) {
+ for (IJavaElement element : elements) {
+ part = JavaUI.openInEditor(element);
+ if (part != null) {
+ if (element != null)
+ JavaUI.revealInEditor(part, element);
+ break;
+ }
+ }
+ }
+
+ if (part == null) {
+ // could not open editor
+ openFileFailed();
+ }
+ } catch (Exception x) {
+ // could not open editor
+ openFileFailed();
+ }
+ }
+
+ /**
+ * @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
+ */
+ protected IRegion doGetHyperlinkRegion(int offset) {
+ IRegion region = SeamBeanHyperlinkPartitioner.getWordRegion(getDocument(), offset);
+ return region;
+ }
+
+}
\ No newline at end of file
Added:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlinkPartitioner.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlinkPartitioner.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlinkPartitioner.java 2007-08-16
19:24:10 UTC (rev 3188)
@@ -0,0 +1,307 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.text.ext.hyperlink;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
+import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
+import org.jboss.tools.common.text.ext.hyperlink.IHyperLinkPartitionPriority;
+import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkPartitionRecognizer;
+import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
+import org.jboss.tools.common.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
+import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
+import org.jboss.tools.common.text.ext.util.Utils;
+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.text.ext.SeamExtPlugin;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
+
+/**
+ * @author Jeremy
+ */
+public class SeamBeanHyperlinkPartitioner extends AbstractHyperlinkPartitioner implements
IHyperlinkPartitionRecognizer, IHyperLinkPartitionPriority {
+ public static final String SEAM_BEAN_PARTITION =
"org.jboss.tools.seam.text.ext.SEAM_BEAN";
+
+ private final SeamELCompletionEngine fEngine= new SeamELCompletionEngine();
+
+ /**
+ * @see
com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument,
com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
+ */
+ protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ StructuredModelWrapper smw = new StructuredModelWrapper();
+ try {
+ smw.init(document);
+ Document xmlDocument = smw.getDocument();
+ if (xmlDocument == null) return null;
+
+ Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
+ if (!recognize(document, superRegion)) return null;
+ IHyperlinkRegion r = getRegion(document, superRegion.getOffset());
+ if (r == null) return null;
+ r = getWordRegion(document, superRegion.getOffset());
+ if (r == null) return null;
+
+ String axis = getAxis(document, superRegion);
+ String contentType = superRegion.getContentType();
+ String type = SEAM_BEAN_PARTITION;
+ int length = r.getLength() - (superRegion.getOffset() - r.getOffset());
+ int offset = superRegion.getOffset();
+
+ IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType,
type);
+ return region;
+ } catch (Exception x) {
+ SeamExtPlugin.getPluginLog().logError(x);
+ return null;
+ } finally {
+ smw.dispose();
+ }
+ }
+
+ protected String getAxis(IDocument document, IHyperlinkRegion superRegion) {
+ if (superRegion.getAxis() == null || superRegion.getAxis().length() == 0) {
+ return JSPRootHyperlinkPartitioner.computeAxis(document, superRegion.getOffset()) +
"/";
+ }
+ return superRegion.getAxis();
+ }
+
+ public static IHyperlinkRegion getWordRegion (IDocument document, final int offset) {
+ StructuredModelWrapper smw = new StructuredModelWrapper();
+ try {
+ smw.init(document);
+ Document xmlDocument = smw.getDocument();
+ if (xmlDocument == null) return null;
+
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
+
+ if (n == null || !(n instanceof Attr || n instanceof Text)) return null;
+
+ int start = Utils.getValueStart(n);
+ int end = Utils.getValueEnd(n);
+ if(start < 0 || start > end || start > offset) return null;
+ String attrText = document.get(start, end - start);
+
+ StringBuffer sb = new StringBuffer(attrText);
+ //find start of bean property
+ int bStart = offset - start;
+ while (bStart >= 0) {
+ if (!Character.isJavaIdentifierPart(sb.charAt(bStart))) {
+ bStart++;
+ break;
+ }
+
+ if (bStart == 0) break;
+ bStart--;
+ }
+ // find end of bean property
+ int bEnd = offset - start;
+ while (bEnd < sb.length()) {
+ if (!Character.isJavaIdentifierPart(sb.charAt(bEnd)))
+ break;
+ bEnd++;
+ }
+
+ int propStart = bStart + start;
+ int propLength = bEnd - bStart;
+
+ if (propStart > offset || propStart + propLength < offset) return null;
+
+ IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null,
null);
+ return region;
+ } catch (Exception x) {
+ SeamExtPlugin.getPluginLog().logError(x);
+ return null;
+ } finally {
+ smw.dispose();
+ }
+ }
+
+ public static IHyperlinkRegion getRegionPart(IDocument document, final int offset) {
+ StructuredModelWrapper smw = new StructuredModelWrapper();
+ try {
+ smw.init(document);
+ Document xmlDocument = smw.getDocument();
+ if (xmlDocument == null) return null;
+
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
+
+ if (n == null || !(n instanceof Attr || n instanceof Text)) return null;
+
+ int start = Utils.getValueStart(n);
+ int end = Utils.getValueEnd(n);
+ if(start < 0 || start > end || start > offset) return null;
+ String attrText = document.get(start, end - start);
+
+ StringBuffer sb = new StringBuffer(attrText);
+ //find start of bean property
+ int bStart = offset - start;
+ while (bStart >= 0) {
+ if (!Character.isJavaIdentifierPart(sb.charAt(bStart)) &&
+ sb.charAt(bStart) != '.' && sb.charAt(bStart) != '['
&& sb.charAt(bStart) != ']') {
+ bStart++;
+ break;
+ }
+
+ if (bStart == 0) break;
+ bStart--;
+ }
+ // find end of bean property
+ int bEnd = offset - start;
+ while (bEnd < sb.length()) {
+ if (!Character.isJavaIdentifierPart(sb.charAt(bEnd)))
+ break;
+ bEnd++;
+ }
+
+ int propStart = bStart + start;
+ int propLength = bEnd - bStart;
+
+ if (propStart > offset || propStart + propLength < offset) return null;
+
+ IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null,
null);
+ return region;
+ } catch (Exception x) {
+ SeamExtPlugin.getPluginLog().logError(x);
+ return null;
+ } finally {
+ smw.dispose();
+ }
+ }
+ public static IHyperlinkRegion getRegion(IDocument document, final int offset) {
+ StructuredModelWrapper smw = new StructuredModelWrapper();
+ try {
+ smw.init(document);
+ Document xmlDocument = smw.getDocument();
+ if (xmlDocument == null) return null;
+
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
+
+ if (n == null || !(n instanceof Attr || n instanceof Text)) return null;
+
+ int start = Utils.getValueStart(n);
+ int end = Utils.getValueEnd(n);
+ if(start < 0 || end < start || start > offset) return null;
+
+ String attrText = document.get(start, end - start);
+
+ StringBuffer sb = new StringBuffer(attrText);
+ //find start of bean property
+ int bStart = offset - start;
+ while (bStart >= 0) {
+ if (!Character.isJavaIdentifierPart(sb.charAt(bStart)) &&
+ sb.charAt(bStart) != '.' && sb.charAt(bStart) != '['
&& sb.charAt(bStart) != ']'
+ && sb.charAt(bStart) != '(' && sb.charAt(bStart) !=
')') {
+ bStart++;
+ break;
+ }
+
+ if (bStart == 0) break;
+ bStart--;
+ }
+ // find end of bean property
+ int bEnd = offset - start;
+ while (bEnd < sb.length()) {
+ if (!Character.isJavaIdentifierPart(sb.charAt(bEnd)) &&
+ sb.charAt(bEnd) != '.' && sb.charAt(bEnd) != '[' &&
sb.charAt(bEnd) != ']'
+ && sb.charAt(bStart) != '(' && sb.charAt(bStart) !=
')') break;
+ bEnd++;
+ }
+
+ int propStart = bStart + start;
+ int propLength = bEnd - bStart;
+
+ if (propStart > offset || propStart + propLength < offset) return null;
+
+ IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength);
+ return region;
+ } catch (Exception x) {
+ SeamExtPlugin.getPluginLog().logError(x);
+ return null;
+ } finally {
+ smw.dispose();
+ }
+ }
+
+ /**
+ * @see
com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument,
com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
+ */
+ public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ StructuredModelWrapper smw = new StructuredModelWrapper();
+ try {
+ smw.init(document);
+ Document xmlDocument = smw.getDocument();
+ if (xmlDocument == null) return false;
+
+ Utils.findNodeForOffset(xmlDocument, region.getOffset());
+
+ List<IJavaElement> javaElements = findJavaElements(document, region);
+
+ return (javaElements != null && javaElements.size() > 0);
+ } catch (Exception x) {
+ SeamExtPlugin.getPluginLog().logError(x);
+ return false;
+ } finally {
+ smw.dispose();
+ }
+ }
+
+ public static List<IJavaElement> findJavaElements(IDocument document, IRegion
region) {
+ StructuredModelWrapper smw = new StructuredModelWrapper();
+ try {
+ smw.init(document);
+ Document xmlDocument = smw.getDocument();
+ if (xmlDocument == null) return null;
+
+ IHyperlinkRegion r = getRegion(document, region.getOffset());
+ if (r == null) return null;
+
+
+ String propText = document.get(r.getOffset(), r.getLength());
+
+
+ IFile file = smw.getFile();
+ IProject project = (file == null ? null : file.getProject());
+
+ ISeamProject seamProject = SeamCorePlugin.getSeamProject(project, true);
+ if (seamProject == null)
+ return null;
+
+ SeamELCompletionEngine engine= new SeamELCompletionEngine();
+
+ String prefix= engine.getJavaElementExpression(document.get(), region.getOffset(),
r);
+ prefix = (prefix == null ? "" : prefix);
+
+ List<IJavaElement> javaElements = engine.getJavaElementsForExpression(
+ seamProject, file, prefix);
+
+ return javaElements;
+ } catch (Exception x) {
+ SeamExtPlugin.getPluginLog().logError(x);
+ return null;
+ } finally {
+ smw.dispose();
+ }
+ }
+
+ public int getPriority() {
+ return 0; // to be first
+ }
+
+}
\ No newline at end of file