Author: dazarov
Date: 2009-12-24 09:54:26 -0500 (Thu, 24 Dec 2009)
New Revision: 19572
Removed:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BeanHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPBeanHyperlinkPartitioner.java
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlink.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/plugin.xml
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ExpressionHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlinkPartitioner.java
trunk/seam/plugins/org.jboss.tools.seam.text.ext/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlinkPartitioner.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4758
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/plugin.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/plugin.xml 2009-12-24 14:23:54 UTC (rev
19571)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/plugin.xml 2009-12-24 14:54:26 UTC (rev
19572)
@@ -591,17 +591,6 @@
</hyperlinkPartitioner>
<hyperlinkPartitioner
-
id="org.jboss.tools.common.text.ext.jsf.hyperlink.JSPBeanHyperlinkPartitioner"
-
class="org.jboss.tools.jsf.text.ext.hyperlink.JSPBeanHyperlinkPartitioner">
- <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>
- </hyperlinkPartitioner>
-
- <hyperlinkPartitioner
id="org.jboss.tools.common.text.ext.jsf.hyperlink.JSPLoadBundleHyperlinkPartitioner"
class="org.jboss.tools.jsf.text.ext.hyperlink.JSPLoadBundleHyperlinkPartitioner">
<contentType id="org.eclipse.jst.jsp.core.jspsource">
@@ -814,17 +803,6 @@
</hyperlink>
<hyperlink
- class="org.jboss.tools.jsf.text.ext.hyperlink.BeanHyperlink"
- id="org.jboss.tools.common.text.ext.jsf.hyperlink.BeanHyperlink">
- <contenttypeidentifier id="org.eclipse.jst.jsp.core.jspsource">
- <partitiontype id="org.jboss.tools.common.text.ext.jsp.JSP_BEAN" />
- </contenttypeidentifier>
- <contenttypeidentifier id="org.eclipse.wst.html.core.htmlsource">
- <partitiontype id="org.jboss.tools.common.text.ext.jsp.JSP_BEAN" />
- </contenttypeidentifier>
- </hyperlink>
-
- <hyperlink
class="org.jboss.tools.jsf.text.ext.hyperlink.LoadBundleHyperlink"
id="org.jboss.tools.common.text.ext.jsf.hyperlink.LoadBundleHyperlink">
<contenttypeidentifier id="org.eclipse.jst.jsp.core.jspsource">
Deleted:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BeanHyperlink.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BeanHyperlink.java 2009-12-24
14:23:54 UTC (rev 19571)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BeanHyperlink.java 2009-12-24
14:54:26 UTC (rev 19572)
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * 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.jsf.text.ext.hyperlink;
-
-import java.text.MessageFormat;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IRegion;
-import org.jboss.tools.common.model.XModel;
-import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
-import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
-import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
-import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
-
-/**
- * @author Jeremy
- */
-public class BeanHyperlink extends AbstractHyperlink {
-
- /**
- * @see
com.ibm.sse.editor.AbstractHyperlink#doHyperlink(org.eclipse.jface.text.IRegion)
- */
- protected void doHyperlink(IRegion region) {
- XModel xModel = getXModel();
- if (xModel == null || region == null) {
- openFileFailed();
- return;
- }
- WebPromptingProvider provider = WebPromptingProvider.getInstance();
- region = JSPBeanHyperlinkPartitioner.getRegionPart(getDocument(), region.getOffset());
- if(region == null) {
- openFileFailed();
- return;
- }
- try {
- String beanName = getDocument().get(region.getOffset(), region.getLength());
- if(beanName == null) {
- openFileFailed();
- return;
- }
- provider.getList(xModel, WebPromptingProvider.JSF_BEAN_OPEN, beanName, null);
- } catch (BadLocationException x) {
- JSFExtensionsPlugin.log("", x); //$NON-NLS-1$
- openFileFailed();
- }
- }
-
- private String getBeanName(IRegion region) {
- if (region == null)
- return null;
- IRegion regionPart = JSPBeanHyperlinkPartitioner.getRegionPart(getDocument(),
region.getOffset());
- if(regionPart == null)
- return null;
- try {
- String beanName = getDocument().get(region.getOffset(), region.getLength());
- return beanName;
- } catch (BadLocationException x) {
- JSFExtensionsPlugin.log("", x); //$NON-NLS-1$
- return null;
- }
- }
-
- IRegion fLastRegion = null;
- /**
- * @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
- */
- protected IRegion doGetHyperlinkRegion(int offset) {
- fLastRegion = JSPBeanHyperlinkPartitioner.getWordRegion(getDocument(), offset);
- return fLastRegion;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see IHyperlink#getHyperlinkText()
- */
- public String getHyperlinkText() {
- String beanName = getBeanName(fLastRegion);
- if (beanName == null)
- return MessageFormat.format(Messages.OpenA, Messages.Bean);
-
- return MessageFormat.format(Messages.OpenBean, beanName);
- }
-
-}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ExpressionHyperlink.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ExpressionHyperlink.java 2009-12-24
14:23:54 UTC (rev 19571)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ExpressionHyperlink.java 2009-12-24
14:54:26 UTC (rev 19572)
@@ -10,12 +10,12 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PartInitException;
import org.jboss.tools.common.el.core.model.ELInvocationExpression;
import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.el.core.resolver.ELResolution;
@@ -23,6 +23,7 @@
import org.jboss.tools.common.el.core.resolver.ELSegment;
import org.jboss.tools.common.el.core.resolver.JavaMemberELSegment;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
+import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
import org.jboss.tools.jsf.text.ext.JSFTextExtMessages;
import
org.jboss.tools.jsf.text.ext.hyperlink.JSPExprHyperlinkPartitioner.ExpressionStructure;
@@ -60,13 +61,18 @@
IEditorPart part = null;
if(javaSegment != null){
- IResource resource = javaSegment.getJavaElement().getResource();
- if(resource != null && resource instanceof IFile)
- part = openFileInEditor((IFile)javaSegment.getJavaElement().getResource());
- if (part != null) {
- if (javaSegment.getJavaElement() != null)
+ if (javaSegment.getJavaElement() != null){
+ try{
+ part = JavaUI.openInEditor(javaSegment.getJavaElement());
+ }catch(JavaModelException ex){
+ JSFExtensionsPlugin.log(ex);
+ }catch(PartInitException ex){
+ JSFExtensionsPlugin.log(ex);
+ }
+ if (part != null) {
JavaUI.revealInEditor(part, javaSegment.getJavaElement());
- }
+ }
+ }
}
if (part == null)
openFileFailed();
Deleted:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPBeanHyperlinkPartitioner.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPBeanHyperlinkPartitioner.java 2009-12-24
14:23:54 UTC (rev 19571)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPBeanHyperlinkPartitioner.java 2009-12-24
14:54:26 UTC (rev 19572)
@@ -1,283 +0,0 @@
-/*******************************************************************************
- * 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.jsf.text.ext.hyperlink;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-
-import org.jboss.tools.common.model.XModel;
-import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
-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.IHyperlinkPartitionRecognizer;
-import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
-import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
-import org.jboss.tools.common.text.ext.util.Utils;
-import org.jboss.tools.jst.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
-import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
-import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
-
-/**
- * @author Jeremy
- */
-public class JSPBeanHyperlinkPartitioner extends AbstractHyperlinkPartitioner implements
IHyperlinkPartitionRecognizer {
- public static final String JSP_BEAN_PARTITION =
"org.jboss.tools.common.text.ext.jsp.JSP_BEAN"; //$NON-NLS-1$
-
- /**
- * @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();
- smw.init(document);
- try {
- 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 = JSP_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;
- } finally {
- smw.dispose();
- }
- }
-
- protected String getAxis(IDocument document, IHyperlinkRegion superRegion) {
- if (superRegion.getAxis() == null || superRegion.getAxis().length() == 0) {
- return JSPRootHyperlinkPartitioner.computeAxis(document, superRegion.getOffset()) +
"/"; //$NON-NLS-1$
- }
- 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 (BadLocationException x) {
- JSFExtensionsPlugin.log("", x); //$NON-NLS-1$
- return null;
- } finally {
- smw.dispose();
- }
- }
-
- public static IHyperlinkRegion getRegionPart(IDocument document, final int offset) {
- if(document == null) return null;
- StructuredModelWrapper smw = new StructuredModelWrapper();
- smw.init(document);
- try {
-
- 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 (BadLocationException x) {
- JSFExtensionsPlugin.log("", x); //$NON-NLS-1$
- 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) != ']') {
- 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) != ']')
- 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 (BadLocationException x) {
- JSFExtensionsPlugin.log("", x); //$NON-NLS-1$
- 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();
- smw.init(document);
- try {
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return false;
-
- Utils.findNodeForOffset(xmlDocument, region.getOffset());
-
- IHyperlinkRegion r = getRegion(document, region.getOffset());
- if (r == null) return false;
-
-
- String propText = document.get(r.getOffset(), r.getLength());
-
- WebPromptingProvider provider = WebPromptingProvider.getInstance();
-
- IFile file = smw.getFile();
- XModel xModel = AbstractHyperlink.getXModel(file);
- if (xModel == null) return false;
-
- List beanList = provider.getList(xModel, WebPromptingProvider.JSF_MANAGED_BEANS,
"", null); //$NON-NLS-1$
- String beanName = null;
- for (int i = 0; beanList != null && i < beanList.size(); i++) {
- String bn = (String)beanList.get(i);
- if (propText.trim().equals(bn) ||
- propText.trim().startsWith(bn + ".")) { //$NON-NLS-1$
- beanName = bn;
- break;
- }
- }
-
- if (beanName == null) return false;
-
- return true;
- } catch (BadLocationException x) {
- JSFExtensionsPlugin.log("", x); //$NON-NLS-1$
- return false;
- } finally {
- smw.dispose();
- }
- }
-
-}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlinkPartitioner.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlinkPartitioner.java 2009-12-24
14:23:54 UTC (rev 19571)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlinkPartitioner.java 2009-12-24
14:54:26 UTC (rev 19572)
@@ -11,8 +11,6 @@
package org.jboss.tools.jsf.text.ext.hyperlink;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jface.text.IDocument;
import org.jboss.tools.common.el.core.ELReference;
import org.jboss.tools.common.el.core.model.ELExpression;
@@ -28,7 +26,6 @@
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.util.StructuredModelWrapper;
-import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
import org.jboss.tools.jst.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
import org.jboss.tools.jst.web.kb.PageContextFactory;
Modified: trunk/seam/plugins/org.jboss.tools.seam.text.ext/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.text.ext/plugin.xml 2009-12-24 14:23:54 UTC
(rev 19571)
+++ trunk/seam/plugins/org.jboss.tools.seam.text.ext/plugin.xml 2009-12-24 14:54:26 UTC
(rev 19572)
@@ -282,41 +282,6 @@
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>
- <contenttypeidentifier id="org.jboss.tools.common.model.ui.xml">
- <partitiontype id="org.jboss.tools.seam.text.ext.SEAM_BEAN" />
- </contenttypeidentifier>
- <contenttypeidentifier
id="org.jboss.tools.seam.xml.ui.pages12xmlsource">
- <partitiontype id="org.jboss.tools.seam.text.ext.SEAM_BEAN" />
- </contenttypeidentifier>
- <contenttypeidentifier
id="org.jboss.tools.seam.xml.ui.page12xmlsource">
- <partitiontype id="org.jboss.tools.seam.text.ext.SEAM_BEAN" />
- </contenttypeidentifier>
- <contenttypeidentifier
id="org.jboss.tools.seam.xml.ui.pages20xmlsource">
- <partitiontype id="org.jboss.tools.seam.text.ext.SEAM_BEAN" />
- </contenttypeidentifier>
- <contenttypeidentifier
id="org.jboss.tools.seam.xml.ui.page20xmlsource">
- <partitiontype id="org.jboss.tools.seam.text.ext.SEAM_BEAN" />
- </contenttypeidentifier>
- <contenttypeidentifier
id="org.jboss.tools.seam.xml.ui.pages21xmlsource">
- <partitiontype id="org.jboss.tools.seam.text.ext.SEAM_BEAN" />
- </contenttypeidentifier>
- <contenttypeidentifier
id="org.jboss.tools.seam.xml.ui.page21xmlsource">
- <partitiontype id="org.jboss.tools.seam.text.ext.SEAM_BEAN" />
- </contenttypeidentifier>
- </hyperlink>
-
- <hyperlink
class="org.jboss.tools.seam.text.ext.hyperlink.SeamMessagesBeanHyperlink"
id="org.jboss.tools.seam.text.ext.hyperlink.SeamBeanHyperlink">
<contenttypeidentifier id="org.eclipse.jst.jsp.core.jspsource">
Deleted:
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 2009-12-24
14:23:54 UTC (rev 19571)
+++
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlink.java 2009-12-24
14:54:26 UTC (rev 19572)
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * 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.text.MessageFormat;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.ui.IEditorPart;
-import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
-import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
-
-/**
- * @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 (CoreException x) {
- // could not open editor
- openFileFailed();
- }
- }
-
- IRegion fLastRegion = null;
- /**
- * @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
- */
- protected IRegion doGetHyperlinkRegion(int offset) {
- fLastRegion = SeamBeanHyperlinkPartitioner.getWordRegion(getDocument(), offset);
- return fLastRegion;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see IHyperlink#getHyperlinkText()
- */
- public String getHyperlinkText() {
-
- String beanName;
- try {
- beanName = getDocument().get(fLastRegion.getOffset(), fLastRegion.getLength());
- } catch (BadLocationException e) {
- beanName = null;
- }
-
- if (beanName == null)
- return MessageFormat.format(Messages.NotFound, Messages.Bean);
-
- return MessageFormat.format(Messages.OpenBean, beanName);
- }
-}
\ No newline at end of file
Modified:
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 2009-12-24
14:23:54 UTC (rev 19571)
+++
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamBeanHyperlinkPartitioner.java 2009-12-24
14:54:26 UTC (rev 19572)
@@ -35,9 +35,9 @@
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.jst.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.jst.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
import org.jboss.tools.seam.core.ISeamContextVariable;
import org.jboss.tools.seam.core.ISeamMessages;
import org.jboss.tools.seam.core.ISeamProject;
@@ -54,7 +54,6 @@
* @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";
public static final String SEAM_MESSAGES_BEAN_PARTITION =
"org.jboss.tools.seam.text.ext.SEAM_MESSAGES_BEAN";
private ELParserFactory factory = ELParserUtil.getJbossFactory();
@@ -90,18 +89,6 @@
return region;
}
- List<IJavaElement> javaElements = findJavaElements(document, superRegion);
- if (javaElements != null && !javaElements.isEmpty()) {///
- 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;
- }
-
return null;
} finally {
smw.dispose();