Author: vrubezhny
Date: 2011-08-02 07:43:54 -0400 (Tue, 02 Aug 2011)
New Revision: 33449
Removed:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleHyperlink.java
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/JSF2CCAttrsHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSF2CCAttrsHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPBundleHyperlinkPartitioner.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/src/org/jboss/tools/seam/text/ext/hyperlink/SeamELInJavaStringHyperlink.java
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamELInJavaStringHyperlinkDetector.java
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamMessagesBeanHyperlink.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.facelets/plugin.xml
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleBasenameHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ConverterHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ForIDHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLContextParamLinkHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlink.java
Log:
JBIDE-9288
Open On for bundle messages doesn't work for CDI projects with International Module
enabled
Deprecated hyperlink classes were removed
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleBasenameHyperlink.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleBasenameHyperlink.java 2011-08-02
11:17:09 UTC (rev 33448)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleBasenameHyperlink.java 2011-08-02
11:43:54 UTC (rev 33449)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Copyright (c) 2007-2011 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
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
@@ -19,23 +19,19 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
-import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.ide.IDE;
import org.jboss.tools.common.model.XModel;
-import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.project.IModelNature;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.model.util.FindObjectHelper;
import org.jboss.tools.common.model.util.XModelObjectLoaderUtil;
-import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
import org.jboss.tools.common.text.ext.hyperlink.ClassHyperlink;
import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
@@ -55,8 +51,6 @@
*/
public class BundleBasenameHyperlink extends ClassHyperlink {
private static final String FILESYSTEMS = "/FileSystems/"; //$NON-NLS-1$
- private static final String LIB = "/lib-"; //$NON-NLS-1$
- private static final String SEPARATOR = "/"; //$NON-NLS-1$
protected void doHyperlink(IRegion region) {
try {
@@ -336,31 +330,7 @@
return null;
}
}
-
- private IFile getFileToOpenOld(String fileName, String fileExt) {
- IFile documentFile = getFile();
- try {
- IProject project = documentFile.getProject();
-
- String name = fileName.replace('.','/')+ (fileExt != null ?
"." + fileExt : ""); //$NON-NLS-1$ //$NON-NLS-2$
-
- if(project == null || !project.isOpen()) return null;
- if(!project.hasNature(JavaCore.NATURE_ID)) return null;
- IJavaProject javaProject = JavaCore.create(project);
- IClasspathEntry[] es = javaProject.getResolvedClasspath(true);
- for (int i = 0; i < es.length; i++) {
- if(es[i].getEntryKind() != IClasspathEntry.CPE_SOURCE) continue;
- IFile file = (IFile)project.getFile(es[i].getPath().removeFirstSegments(1) +
"/" + name); //$NON-NLS-1$
- if(file != null && file.exists()) return file;
- }
- return null;
- } catch (CoreException x) {
- JSFExtensionsPlugin.log("", x); //$NON-NLS-1$
- return null;
- }
- }
-
IRegion fLastRegion = null;
/**
* @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
Deleted:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleHyperlink.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleHyperlink.java 2011-08-02
11:17:09 UTC (rev 33448)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleHyperlink.java 2011-08-02
11:43:54 UTC (rev 33449)
@@ -1,167 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.jsf.text.ext.hyperlink;
-
-import java.text.MessageFormat;
-import java.util.Properties;
-
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.hyperlink.IHyperlink;
-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;
-import org.jboss.tools.common.el.core.resolver.ELResolver;
-import org.jboss.tools.common.el.core.resolver.ELSegment;
-import org.jboss.tools.common.el.core.resolver.MessagePropertyELSegment;
-import org.jboss.tools.common.text.ext.hyperlink.XModelBasedHyperlink;
-import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
-import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
-import org.jboss.tools.common.text.ext.util.Utils;
-import
org.jboss.tools.jsf.text.ext.hyperlink.JSPExprHyperlinkPartitioner.ExpressionStructure;
-import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- * @author Jeremy
- */
-public class BundleHyperlink extends XModelBasedHyperlink {
-
- private static final String VIEW_TAGNAME = "view"; //$NON-NLS-1$
- private static final String LOCALE_ATTRNAME = "locale"; //$NON-NLS-1$
- private static final String PREFIX_SEPARATOR = ":"; //$NON-NLS-1$
-
- private String getPageLocale(IRegion region) {
- if(getDocument() == null || region == null) return null;
-
- StructuredModelWrapper smw = new StructuredModelWrapper();
- try {
- smw.init(getDocument());
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return null;
-
- Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
- if (!(n instanceof Attr) ) return null;
-
- Element el = ((Attr)n).getOwnerElement();
-
- Element jsfCoreViewTag = null;
- String nodeToFind = PREFIX_SEPARATOR + VIEW_TAGNAME;
-
- while (el != null) {
- if (el.getNodeName() != null && el.getNodeName().endsWith(nodeToFind)) {
- jsfCoreViewTag = el;
- break;
- }
- Node parent = el.getParentNode();
- el = (parent instanceof Element ? (Element)parent : null);
- }
-
- if (jsfCoreViewTag == null || !jsfCoreViewTag.hasAttribute(LOCALE_ATTRNAME)) return
null;
-
- String locale =
Utils.trimQuotes((jsfCoreViewTag.getAttributeNode(LOCALE_ATTRNAME)).getValue());
- if (locale == null || locale.length() == 0) return null;
- return locale;
- } finally {
- smw.dispose();
- }
- }
-
- IRegion fLastRegion = null;
-
- /**
- * @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
- */
- protected IRegion doGetHyperlinkRegion(int offset) {
- fLastRegion = JSPBundleHyperlinkPartitioner.getRegion(getDocument(), offset);
- return fLastRegion;
- }
-
- protected String getRequestMethod() {
- return requestProperties != null &&
requestProperties.getProperty(WebPromptingProvider.KEY) == null ?
- WebPromptingProvider.JSF_OPEN_BUNDLE : WebPromptingProvider.JSF_OPEN_KEY;
- }
-
- protected Properties getRequestProperties(IRegion region) {
- ELContext context = JSPExprHyperlinkPartitioner.getELContext(getDocument());
- if(context != null){
- ExpressionStructure eStructure = JSPExprHyperlinkPartitioner.getExpression(context,
getOffset());
- if(eStructure != null){
- ELInvocationExpression invocationExpression =
JSPExprHyperlinkPartitioner.getInvocationExpression(eStructure.reference,
eStructure.expression, getOffset());
- if(invocationExpression != null){
- for(ELResolver resolver : context.getElResolvers()){
- ELResolution resolution = resolver.resolve(context, invocationExpression,
getOffset());
- if(resolution==null) {
- continue;
- }
- ELSegment segment =
resolution.findSegmentByOffset(getOffset()-eStructure.reference.getStartPosition());
-
- if (segment != null && segment.isResolved() && segment instanceof
MessagePropertyELSegment) {
- MessagePropertyELSegment mpSegment = (MessagePropertyELSegment)segment;
- String bundleBasename = mpSegment.getBaseName();
- String property = mpSegment.isBundle() ? null :
trimQuotes(mpSegment.getToken().getText());
- String locale = getPageLocale(region);
-
- Properties p = new Properties();
- if (bundleBasename != null) {
- p.put(WebPromptingProvider.BUNDLE, bundleBasename);
- }
-
- if (property != null) {
- p.put(WebPromptingProvider.KEY, property);
- }
-
- if (locale != null) {
- p.setProperty(WebPromptingProvider.LOCALE, locale);
- }
-
- return p;
- }
- }
- }
- }
- }
- return null;
- }
-
- private String trimQuotes(String value) {
- if(value == null)
- return null;
-
- if(value.startsWith("'") || value.startsWith("\"")) {
//$NON-NLS-1$ //$NON-NLS-2$
- value = value.substring(1);
- }
-
- if(value.endsWith("'") || value.endsWith("\"")) {
//$NON-NLS-1$ //$NON-NLS-2$
- value = value.substring(0, value.length() - 1);
- }
- return value;
- }
-
-
- /**
- * Returns the text to be shown for Open action
- *
- * @see IHyperlink#getHyperlinkText()
- */
- public String getHyperlinkText() {
- Properties p = getRequestProperties(fLastRegion);
- String baseName = p == null ? null : p.getProperty(WebPromptingProvider.BUNDLE);
- String propertyName = p == null ? null : p.getProperty(WebPromptingProvider.KEY);
- if (baseName == null || propertyName == null)
- return MessageFormat.format(Messages.OpenA, Messages.BundleProperty);
-
- return MessageFormat.format(Messages.OpenBundleProperty, propertyName, baseName);
- }
-
-}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ConverterHyperlink.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ConverterHyperlink.java 2011-08-02
11:17:09 UTC (rev 33448)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ConverterHyperlink.java 2011-08-02
11:43:54 UTC (rev 33449)
@@ -58,7 +58,7 @@
}
private String getConverterID (IRegion region) {
- IRegion localRegion = getRegion(region.getOffset());
+ getRegion(region.getOffset());
String converterID = null;
if(getDocument() != null && region != null) {
try {
Deleted:
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 2011-08-02
11:17:09 UTC (rev 33448)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ExpressionHyperlink.java 2011-08-02
11:43:54 UTC (rev 33449)
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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 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;
-import org.jboss.tools.common.el.core.resolver.ELResolver;
-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;
-
-/**
- * @author Daniel
- */
-public class ExpressionHyperlink extends AbstractHyperlink{
- private JavaMemberELSegment javaSegment=null;
-
- protected IRegion doGetHyperlinkRegion(int offset) {
- javaSegment = null;
- ELContext context = JSPExprHyperlinkPartitioner.getELContext(getDocument());
- ExpressionStructure eStructure = JSPExprHyperlinkPartitioner.getExpression(context,
offset);
- ELInvocationExpression invocationExpression =
JSPExprHyperlinkPartitioner.getInvocationExpression(eStructure.reference,
eStructure.expression, offset);
- if(invocationExpression != null){
- for(ELResolver resolver : context.getElResolvers()){
- ELResolution resolution = resolver.resolve(context, invocationExpression, offset);
- if(resolution==null) {
- continue;
- }
- ELSegment segment =
resolution.findSegmentByOffset(offset-eStructure.reference.getStartPosition());
- if(segment != null){
- if(segment instanceof JavaMemberELSegment){
- javaSegment = (JavaMemberELSegment)segment;
- if(javaSegment.getJavaElement() != null){
- Region region = new
Region(eStructure.reference.getStartPosition()+segment.getSourceReference().getStartPosition(),
segment.getSourceReference().getLength());
-
- return region;
- }
- }
- }
- }
- }
- return null;
- }
-
- protected void doHyperlink(IRegion region) {
- IEditorPart part = null;
-
- if(javaSegment != 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();
- }
-
- public String getHyperlinkText() {
- return JSFTextExtMessages.OpenJavaElement;
- }
-
-}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ForIDHyperlink.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ForIDHyperlink.java 2011-08-02
11:17:09 UTC (rev 33448)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ForIDHyperlink.java 2011-08-02
11:43:54 UTC (rev 33449)
@@ -18,8 +18,6 @@
import org.eclipse.jface.text.Region;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
-import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
-import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.StructuredSelectionHelper;
Deleted:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSF2CCAttrsHyperlink.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSF2CCAttrsHyperlink.java 2011-08-02
11:17:09 UTC (rev 33448)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSF2CCAttrsHyperlink.java 2011-08-02
11:43:54 UTC (rev 33449)
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jsf.text.ext.hyperlink;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
-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;
-import org.jboss.tools.common.el.core.resolver.ELSegment;
-import org.jboss.tools.common.model.XModelObject;
-import org.jboss.tools.common.model.util.PositionHolder;
-import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
-import org.jboss.tools.common.text.ext.util.StructuredSelectionHelper;
-import org.jboss.tools.jsf.text.ext.JSFTextExtMessages;
-import
org.jboss.tools.jsf.text.ext.hyperlink.JSPExprHyperlinkPartitioner.ExpressionStructure;
-
-/**
- *
- * @author Victor V. Rubezhny
- *
- */
-public class JSF2CCAttrsHyperlink extends AbstractHyperlink {
- IRegion fLastRegion = null;
-
- @Override
- protected IRegion doGetHyperlinkRegion(int offset) {
- fLastRegion = JSF2CCAttrsHyperlinkPartitioner.getRegion(getDocument(), offset);
- return fLastRegion;
- }
-
- @Override
- protected void doHyperlink(IRegion region) {
- XModelObject attrObject = null;
- IRegion attrRegion = null;
-
- ELContext context = JSPExprHyperlinkPartitioner.getELContext(getDocument());
- if(context != null){
- ExpressionStructure eStructure = JSPExprHyperlinkPartitioner.getExpression(context,
getOffset());
- if(eStructure != null){
- ELInvocationExpression invocationExpression =
JSPExprHyperlinkPartitioner.getInvocationExpression(eStructure.reference,
eStructure.expression, getOffset());
- if(invocationExpression != null){
-
- ELResolution resolution = JSF2CCAttrsHyperlinkPartitioner.getResolution(context,
invocationExpression, getOffset()-eStructure.reference.getStartPosition(), getOffset());
- if (resolution == null)
- return;
-
- ELSegment segment =
resolution.findSegmentByOffset(getOffset()-eStructure.reference.getStartPosition());
- if(segment != null && segment.isResolved()){
- // Find text for the part of operand
- StringBuffer sbBuffer = new StringBuffer();
- for (ELSegment s : resolution.getSegments()) {
- sbBuffer.append(s.getToken().getText());
- if (s == segment) {
- break;
- }
- sbBuffer.append('.'); // Use default separator for ELs here
- }
-
- String text = sbBuffer.toString();
-
- attrObject = JSF2CCAttrsHyperlinkPartitioner.findJSF2CCAttributeXModelObject(text,
getFile());
- if (attrObject != null) {
- PositionHolder h = PositionHolder.getPosition(attrObject, null);
- h.update();
- if (h.getStart() == -1 || h.getEnd() == -1) {
- openFileFailed();
- return;
- }
- attrRegion = new Region(h.getStart(), h.getEnd() - h.getStart());
- }
- }
- }
- }
- }
- if (attrObject != null && attrRegion != null) {
- IFile file = (IFile)attrObject.getAdapter(IFile.class);
- if (file != null) {
- if (openFileInEditor(file) != null) {
- StructuredSelectionHelper.setSelectionAndRevealInActiveEditor(attrRegion);
- return;
- }
- }
- }
-
- openFileFailed();
- }
-
- @Override
- public String getHyperlinkText() {
- return JSFTextExtMessages.OpenJsf2CCAttribute;
- }
-
-}
Deleted:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSF2CCAttrsHyperlinkPartitioner.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSF2CCAttrsHyperlinkPartitioner.java 2011-08-02
11:17:09 UTC (rev 33448)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSF2CCAttrsHyperlinkPartitioner.java 2011-08-02
11:43:54 UTC (rev 33449)
@@ -1,191 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jsf.text.ext.hyperlink;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jface.text.IDocument;
-import org.jboss.tools.common.el.core.model.ELExpression;
-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;
-import org.jboss.tools.common.el.core.resolver.ELResolver;
-import org.jboss.tools.common.el.core.resolver.ELSegment;
-import org.jboss.tools.common.model.XModelObject;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
-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.jsf.text.ext.hyperlink.JSPExprHyperlinkPartitioner.ExpressionStructure;
-import org.jboss.tools.jst.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
-import org.w3c.dom.Document;
-
-/**
- *
- * @author Victor V. Rubezhny
- *
- */
-public class JSF2CCAttrsHyperlinkPartitioner extends AbstractHyperlinkPartitioner
implements IHyperlinkPartitionRecognizer {
- public static final String JSF2_CC_ATTRIBUTE_PARTITION =
"org.jboss.tools.common.text.ext.jsp.JSF2_CC_ATTRIBUTE"; //$NON-NLS-1$
-
- protected String getPartitionType() {
- return JSF2_CC_ATTRIBUTE_PARTITION;
- }
-
- /**
- * Recognizes the region as having JSF2 CC Attribute reference
- */
- 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());
-
- return (getRegion(document, region.getOffset()) != null);
- } finally {
- smw.dispose();
- }
- }
-
- @Override
- 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;
-
- String axis = getAxis(document, superRegion);
- String contentType = superRegion.getContentType();
- String type = getPartitionType();
- 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 getRegion(IDocument document, final int offset) {
- ELContext context = JSPExprHyperlinkPartitioner.getELContext(document);
- if(context != null){
- ExpressionStructure eStructure = JSPExprHyperlinkPartitioner.getExpression(context,
offset);
- if(eStructure != null){
- ELInvocationExpression invocationExpression =
JSPExprHyperlinkPartitioner.getInvocationExpression(eStructure.reference,
eStructure.expression, offset);
- if(invocationExpression != null){
- ELSegment segment = decide(context, eStructure.expression, invocationExpression,
offset-eStructure.reference.getStartPosition(), offset, getFile(document));
- if (segment != null) {
- IHyperlinkRegion region = new
HyperlinkRegion(eStructure.reference.getStartPosition() +
segment.getSourceReference().getStartPosition(), segment.getSourceReference().getLength(),
null, null, null);
- return region;
- }
- }
- }
- }
- return null;
- }
-
- static String[] vs = {"cc.attrs", "compositeComponent.attrs"};
-
- public static XModelObject findJSF2CCAttributeXModelObject(String varName, IFile file)
{
- XModelObject xModelObject = EclipseResourceUtil.createObjectForResource(file);
- if(xModelObject == null) return null;
- if(!"FileJSF2Component".equals(xModelObject.getModelEntity().getName()))
return null;
-
- IJavaProject javaProject = EclipseResourceUtil.getJavaProject(file.getProject());
- XModelObject is = xModelObject.getChildByPath("Interface");
- if(is != null && javaProject != null) {
- for (int i = 0; i < vs.length; i++) {
- if (vs[i].equals(varName)) return is;
- }
- XModelObject[] cs = is.getChildren("JSF2ComponentAttribute");
-
- for (int i = 0; i < cs.length; i++) {
- String name = cs[i].getAttributeValue("name");
- String[] names = {vs[0] + "." + name, vs[1] + "." + name};
- for (String n: names) {
- if (n.equals(varName)) return cs[i];
- }
- }
- }
- return null;
- }
-
- private static IFile getFile(IDocument document) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- try {
- smw.init(document);
- return smw.getFile();
- } finally {
- smw.dispose();
- }
- }
-
- private static ELSegment decide(ELContext context, ELExpression expression,
ELInvocationExpression invocationExpression, int offset, int globalOffset, IFile file){
- ELResolution resolution = getResolution(context, invocationExpression, offset,
globalOffset);
- if (resolution == null)
- return null;
-
- ELSegment segment = resolution.findSegmentByOffset(offset);
- if(segment != null && segment.isResolved()){
- // Find text for the part of operand
- StringBuffer sbBuffer = new StringBuffer();
- for (ELSegment s : resolution.getSegments()) {
- sbBuffer.append(s.getToken().getText());
- if (s == segment) {
- break;
- }
- sbBuffer.append('.'); // Use default separator for ELs here
- }
-
- String text = sbBuffer.toString();
- if (findJSF2CCAttributeXModelObject(text, file) != null) {
- return segment;
- }
- }
- return null;
- }
-
- static ELResolution getResolution(ELContext context, ELInvocationExpression
invocationExpression, int offset, int globalOffset) {
- for(ELResolver resolver : context.getElResolvers()){
- ELResolution resolution = resolver.resolve(context, invocationExpression,
globalOffset);
- if(resolution==null) {
- continue;
- }
- ELSegment segment = resolution.findSegmentByOffset(offset);
- if(segment != null && segment.isResolved()){
- return resolution;
- }
- }
- return null;
-
- }
-
-}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLContextParamLinkHyperlinkPartitioner.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLContextParamLinkHyperlinkPartitioner.java 2011-08-02
11:17:09 UTC (rev 33448)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLContextParamLinkHyperlinkPartitioner.java 2011-08-02
11:43:54 UTC (rev 33449)
@@ -124,11 +124,9 @@
int start = Utils.getValueStart(text);
if(start < 0) continue;
int end = Utils.getValueEnd(text);
- if (paramNameValue == null) {
- paramNameValue = Utils.trimQuotes(document.get(start, end - start));
- } else {
- paramNameValue += Utils.trimQuotes(document.get(start, end - start));
- }
+ if (paramNameValue == null)
+ paramNameValue = "";
+ paramNameValue += Utils.trimQuotes(document.get(start, end - start));
}
}
if (paramNameValue == null) return false;
Deleted:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPBundleHyperlinkPartitioner.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPBundleHyperlinkPartitioner.java 2011-08-02
11:17:09 UTC (rev 33448)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPBundleHyperlinkPartitioner.java 2011-08-02
11:43:54 UTC (rev 33449)
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.jsf.text.ext.hyperlink;
-
-import org.eclipse.jface.text.IDocument;
-import org.jboss.tools.common.el.core.model.ELExpression;
-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;
-import org.jboss.tools.common.el.core.resolver.ELResolver;
-import org.jboss.tools.common.el.core.resolver.ELSegment;
-import org.jboss.tools.common.el.core.resolver.MessagePropertyELSegment;
-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.jsf.text.ext.hyperlink.JSPExprHyperlinkPartitioner.ExpressionStructure;
-import org.jboss.tools.jst.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
-import org.jboss.tools.jst.text.ext.util.TaglibManagerWrapper;
-import org.w3c.dom.Document;
-
-/**
- * @author Jeremy
- */
-public class JSPBundleHyperlinkPartitioner extends AbstractHyperlinkPartitioner
implements IHyperlinkPartitionRecognizer {
- public static final String JSP_BUNDLE_PARTITION =
"org.jboss.tools.common.text.ext.jsp.JSP_BUNDLE"; //$NON-NLS-1$
-
- protected String getPartitionType() {
- return JSP_BUNDLE_PARTITION;
- }
-
- /**
- * @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;
-
- String axis = getAxis(document, superRegion);
- String contentType = superRegion.getContentType();
- String type = getPartitionType();
- 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 getRegion(IDocument document, final int offset) {
- ELContext context = JSPExprHyperlinkPartitioner.getELContext(document);
- if(context != null){
- ExpressionStructure eStructure = JSPExprHyperlinkPartitioner.getExpression(context,
offset);
- if(eStructure != null){
- ELInvocationExpression invocationExpression =
JSPExprHyperlinkPartitioner.getInvocationExpression(eStructure.reference,
eStructure.expression, offset);
- if(invocationExpression != null){
- ELSegment segment = decide(context, eStructure.expression, invocationExpression,
offset-eStructure.reference.getStartPosition(), offset);
- if (segment != null) {
- IHyperlinkRegion region = new
HyperlinkRegion(eStructure.reference.getStartPosition() +
segment.getSourceReference().getStartPosition(), segment.getSourceReference().getLength(),
null, null, null);
- return region;
- }
- }
- }
- }
- return null;
- }
-
- private static ELSegment decide(ELContext context, ELExpression expression,
ELInvocationExpression invocationExpression, int offset, int globalOffset){
- for(ELResolver resolver : context.getElResolvers()){
- ELResolution resolution = resolver.resolve(context, invocationExpression,
globalOffset);
- if(resolution==null) {
- continue;
- }
- ELSegment segment = resolution.findSegmentByOffset(offset);
- if(segment != null && segment.isResolved()){
- if (segment != null && segment.isResolved() && segment instanceof
MessagePropertyELSegment) {
- return segment;
- }
- }
- }
- return null;
- }
-
- /**
- * @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());
-
- return (getRegion(document, region.getOffset()) != null);
- } finally {
- smw.dispose();
- }
- }
-
- /**
- * @deprecated
- */
- protected String[] getLoadBundleTagPrefixes(IDocument document, int offset) {
- TaglibManagerWrapper tmw = new TaglibManagerWrapper();
- tmw.init(document, offset);
- if(!tmw.exists()) return null;
-
- return new String[] {tmw.getCorePrefix()};
- }
-}
\ No newline at end of file
Deleted:
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 2011-08-02
11:17:09 UTC (rev 33448)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlinkPartitioner.java 2011-08-02
11:43:54 UTC (rev 33449)
@@ -1,209 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.jsf.text.ext.hyperlink;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.jboss.tools.common.el.core.ELReference;
-import org.jboss.tools.common.el.core.model.ELExpression;
-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;
-import org.jboss.tools.common.el.core.resolver.ELResolver;
-import org.jboss.tools.common.el.core.resolver.ELSegment;
-import org.jboss.tools.common.el.core.resolver.JavaMemberELSegment;
-import org.jboss.tools.common.el.core.resolver.MessagePropertyELSegment;
-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.IExclusiblePartitionerRecognition;
-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;
-
-/**
- * @author Jeremy and Daniel
- */
-@SuppressWarnings("restriction")
-public class JSPExprHyperlinkPartitioner extends AbstractHyperlinkPartitioner implements
IHyperlinkPartitionRecognizer, IExclusiblePartitionerRecognition {
- public static final String JSP_EXPRESSION_PARTITION =
"org.jboss.tools.common.text.ext.jsp.JSP_EXPRESSION"; //$NON-NLS-1$
- public static final String EXPRESSION_PARTITION =
"org.jboss.tools.common.text.ext.jsp.EXPRESSION"; //$NON-NLS-1$
- public static final String DOT_EXPRESSION_PARTITION =
"org.jboss.tools.common.text.ext.jsp.DOT_EXPRESSION"; //$NON-NLS-1$
-
- private static final String DOT = ".";
-
- private boolean jspExpression = false;
-
- private boolean dotExpression = false;
-
- protected String getPartitionType() {
- if(dotExpression)
- return DOT_EXPRESSION_PARTITION;
-
- if(jspExpression)
- return EXPRESSION_PARTITION;
- else
- return JSP_EXPRESSION_PARTITION;
- }
-
- /**
- * @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) {
- IHyperlinkRegion r = getRegion(document, superRegion.getOffset());
- if (r == null) return null;
-
- String axis = getAxis(document, superRegion);
- String contentType = superRegion.getContentType();
- String type = getPartitionType();
- int length = r.getLength() - (superRegion.getOffset() - r.getOffset());
- int offset = superRegion.getOffset();
-
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType,
type);
- return region;
- }
-
- 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();
- }
-
- private IHyperlinkRegion getRegion(IDocument document, final int offset) {
- jspExpression = false;
- dotExpression = false;
- ELContext context = getELContext(document);
- if(context != null){
- ExpressionStructure eStructure = getExpression(context, offset);
- if(eStructure != null){
- ELInvocationExpression invocationExpression =
getInvocationExpression(eStructure.reference, eStructure.expression, offset);
- if(invocationExpression != null){
- jspExpression = decide(context, eStructure.expression, invocationExpression,
offset-eStructure.reference.getStartPosition(), offset);
- if(jspExpression){
- IHyperlinkRegion region = new
HyperlinkRegion(eStructure.reference.getStartPosition() +
invocationExpression.getStartPosition(), invocationExpression.getLength(), null, null,
null);
- return region;
- }
- dotExpression = checkDot(document, offset, context, eStructure.expression,
invocationExpression, offset-eStructure.reference.getStartPosition());
-
- IHyperlinkRegion region = new
HyperlinkRegion(eStructure.reference.getStartPosition() +
invocationExpression.getStartPosition(), eStructure.expression.getLength(), null, null,
null);
- return region;
- }
- }
- }
- return null;
- }
-
- public static ExpressionStructure getExpression(ELContext context, final int offset){
- ELReference[] references = context.getELReferences();
-
- for(ELReference reference : references){
- for(ELExpression expression : reference.getEl()){
- if (reference.getStartPosition()+expression.getStartPosition() <= offset
&& reference.getStartPosition()+expression.getEndPosition() > offset)
- return new ExpressionStructure(reference, expression);
- }
- }
- return null;
- }
-
- public static ELContext getELContext(IDocument document){
- StructuredModelWrapper smw = new StructuredModelWrapper();
- smw.init(document);
- try {
- IFile file = smw.getFile();
- ELContext context = PageContextFactory.getInstance().createPageContext(file);
- return context;
- } finally {
- smw.dispose();
- }
- }
-
- public static ELInvocationExpression getInvocationExpression(ELReference reference,
ELExpression expression, int offset){
- if(expression == null || reference == null)
- return null;
-
- for(ELInvocationExpression ie : expression.getInvocations()){
- if (reference.getStartPosition()+ie.getStartPosition() <= offset &&
reference.getStartPosition()+ie.getEndPosition() > offset) {
- return ie;
- }
- }
- return null;
- }
-
- public boolean decide(ELContext context, ELExpression expression, ELInvocationExpression
invocationExpression, int offset, int globalOffset){
- for(ELResolver resolver : context.getElResolvers()){
- ELResolution resolution = resolver.resolve(context, invocationExpression,
globalOffset);
- if(resolution==null) {
- continue;
- }
- ELSegment segment = resolution.findSegmentByOffset(offset);
- if(segment != null && segment.isResolved()){
- if(segment instanceof JavaMemberELSegment){
- JavaMemberELSegment javaSegment = (JavaMemberELSegment)segment;
- if(javaSegment.getJavaElement() != null){
- return true;
- }
- }
- if (segment instanceof MessagePropertyELSegment) {
- return false;
- }
- }
- }
- return false;
- }
-
- public boolean checkDot(IDocument document, int superOffset, ELContext context,
ELExpression expression, ELInvocationExpression invocationExpression, int offset){
- try{
- String text = document.get(superOffset, 1);
- if(DOT.equals(text)){
- if(decide(context, expression, invocationExpression, offset+1, superOffset+1))
- return true;
- else if(decide(context, expression, invocationExpression, offset-1, superOffset-1))
- return true;
- }
- }catch(BadLocationException ex){
- JSFExtensionsPlugin.log(ex);
- }
- return false;
- }
-
- /**
- * @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) {
- if(document == null || region == null) return false;
-
- return (getRegion(document, region.getOffset()) != null);
- }
-
- public boolean excludes(String partitionType, IDocument document, IHyperlinkRegion
superRegion) {
- return false;
- }
-
- public String getExclusionPartitionType() {
- return getPartitionType();
- }
-
- public static class ExpressionStructure{
- public ELReference reference;
- public ELExpression expression;
-
- public ExpressionStructure(ELReference reference, ELExpression expression){
- this.reference = reference;
- this.expression = expression;
- }
-
- }
-
-}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlink.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlink.java 2011-08-02
11:17:09 UTC (rev 33448)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlink.java 2011-08-02
11:43:54 UTC (rev 33449)
@@ -163,7 +163,6 @@
Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
- Node node = null;
if (n instanceof Attr) {
return ((Attr)n).getName();
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.facelets/plugin.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.facelets/plugin.xml 2011-08-02 11:17:09
UTC (rev 33448)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.facelets/plugin.xml 2011-08-02 11:43:54
UTC (rev 33449)
@@ -92,7 +92,7 @@
</contentType>
</hyperlinkPartitioner>
- <hyperlinkPartitioner
+ <!-- hyperlinkPartitioner
id="org.jboss.tools.common.text.ext.jsf.facelets.hyperlink.FaceletsAttributeValueWithExprHyperlinkPartitioner"
class="org.jboss.tools.jsf.text.ext.facelets.hyperlink.FaceletsAttributeValueWithExprHyperlinkPartitioner">
<contentType id="org.eclipse.jst.jsp.core.jspsource">
@@ -165,9 +165,9 @@
<axis
path="*/[http://java.sun.com/jsf/facelets]:param/value/"
/>
</partitionType>
</contentType>
- </hyperlinkPartitioner>
+ </hyperlinkPartitioner -->
- <hyperlinkPartitioner
+ <!-- hyperlinkPartitioner
id="org.jboss.tools.common.text.ext.jsf.facelets.hyperlink.FaceletsAttributeValueWithNoExprHyperlinkPartitioner"
class="org.jboss.tools.jsf.text.ext.facelets.hyperlink.FaceletsAttributeValueWithNoExprHyperlinkPartitioner">
<contentType id="org.eclipse.jst.jsp.core.jspsource">
@@ -195,7 +195,7 @@
<axis
path="*/[http://java.sun.com/jsf/facelets]:component/hotkey/" />
</partitionType>
</contentType>
- </hyperlinkPartitioner>
+ </hyperlinkPartitioner -->
<hyperlinkPartitioner
id="org.jboss.tools.jsf.text.ext.facelets.hyperlink.FaceletsCSSClassHyperlinkPartitioner"
Deleted:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamELInJavaStringHyperlink.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamELInJavaStringHyperlink.java 2011-08-02
11:17:09 UTC (rev 33448)
+++
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamELInJavaStringHyperlink.java 2011-08-02
11:43:54 UTC (rev 33449)
@@ -1,152 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.seam.text.ext.hyperlink;
-
-import java.text.MessageFormat;
-import java.util.Map;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.hyperlink.IHyperlink;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PartInitException;
-import org.jboss.tools.common.model.XModelObject;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.common.model.util.FindObjectHelper;
-import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
-import org.jboss.tools.seam.core.ISeamMessages;
-import org.jboss.tools.seam.text.ext.SeamExtPlugin;
-
-public class SeamELInJavaStringHyperlink implements IHyperlink {
-
- private final IRegion fRegion;
- private final IJavaElement[] fElements;
- private final Map<String, ISeamMessages> fMessages;
- /**
- * Creates a new Seam EL in Java string hyperlink.
- */
- SeamELInJavaStringHyperlink(IRegion region, IJavaElement[] elements) {
- Assert.isNotNull(region);
- Assert.isNotNull(elements);
-
- fRegion = region;
- fElements = elements;
- fMessages = null;
- }
-
- /**
- * Creates a new Seam EL in Java string hyperlink for messages.
- */
- SeamELInJavaStringHyperlink(IRegion region, Map<String, ISeamMessages> messages)
{
- Assert.isNotNull(region);
- Assert.isNotNull(messages);
-
- fRegion = region;
- fElements = null;
- fMessages = messages;
- }
-
- /*
- * @see org.eclipse.jdt.internal.ui.javaeditor.IHyperlink#getHyperlinkRegion()
- * @since 3.1
- */
- public IRegion getHyperlinkRegion() {
- return fRegion;
- }
-
- /*
- * @see org.eclipse.jdt.internal.ui.javaeditor.IHyperlink#open()
- * @since 3.1
- */
- public void open() {
- if (fMessages != null && fElements == null) {
- openMessages();
- } else if (fElements != null && fMessages == null) {
- try {
- IEditorPart part = null;
- for (int i = 0; fElements != null && i < fElements.length; i++) {
- part = JavaUI.openInEditor(fElements[i]);
- if (part != null) {
- if (fElements[i] != null)
- JavaUI.revealInEditor(part, fElements[i]);
- break;
- }
- }
-
- } catch (PartInitException e) {
- SeamExtPlugin.getPluginLog().logError(e);
- } catch (JavaModelException e) {
- // Ignore. It is probably because of Java element is not found
- }
- }
- }
-
- private void openMessages() {
- Map <String, ISeamMessages> messages = fMessages;
- if (messages == null || messages.isEmpty()) {
- // Nothing to open
- return;
- }
-
- for (String property : messages.keySet()) {
- ISeamMessages messagesComponent = messages.get(property);
- Map <String, IResource> resources = messagesComponent.getResourcesMap();
- if (resources == null || resources.isEmpty())
- continue;
-
- for (String bundle : resources.keySet()) {
- IResource resource = resources.get(bundle);
- XModelObject xmo = EclipseResourceUtil.getObjectByResource(resource);
- if (xmo == null)
- continue;
-
- XModelObject xmoChild = xmo.getChildByPath(property);
- if (xmoChild == null)
- continue;
-
- int result = FindObjectHelper.findModelObject(xmoChild,
FindObjectHelper.IN_EDITOR_ONLY);
- if (result == 0) {
- // Success
- return;
- }
- }
- }
- // could not open editor
-
- }
-
- /*
- * @see org.eclipse.jdt.internal.ui.javaeditor.IHyperlink#getTypeLabel()
- * @since 3.1
- */
- public String getTypeLabel() {
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see IHyperlink#getHyperlinkText()
- */
- public String getHyperlinkText() {
- if (fElements == null || fElements.length == 0)
- return MessageFormat.format(Messages.OpenA, Messages.Bean);
-
- return MessageFormat.format(Messages.Open, fElements[0].getElementName());
- }
-
-
-}
Deleted:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamELInJavaStringHyperlinkDetector.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamELInJavaStringHyperlinkDetector.java 2011-08-02
11:17:09 UTC (rev 33448)
+++
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamELInJavaStringHyperlinkDetector.java 2011-08-02
11:43:54 UTC (rev 33449)
@@ -1,249 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008-2011 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.seam.text.ext.hyperlink;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
-import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
-import org.eclipse.jdt.internal.ui.text.FastJavaPartitionScanner;
-import org.eclipse.jdt.internal.ui.text.JavaWordFinder;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.hyperlink.AbstractHyperlinkDetector;
-import org.eclipse.jface.text.hyperlink.IHyperlink;
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.jboss.tools.common.el.core.model.ELArgumentInvocation;
-import org.jboss.tools.common.el.core.model.ELExpression;
-import org.jboss.tools.common.el.core.model.ELInvocationExpression;
-import org.jboss.tools.common.el.core.model.ELPropertyInvocation;
-import org.jboss.tools.common.text.ext.util.Utils;
-import org.jboss.tools.seam.core.ISeamContextVariable;
-import org.jboss.tools.seam.core.ISeamMessages;
-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;
-
-public class SeamELInJavaStringHyperlinkDetector extends
- AbstractHyperlinkDetector {
-
- public IHyperlink[] detectHyperlinks(ITextViewer textViewer,
- IRegion region, boolean canShowMultipleHyperlinks) {
- ITextEditor textEditor= (ITextEditor)getAdapter(ITextEditor.class);
- if (region == null /*|| canShowMultipleHyperlinks*/ || !(textEditor instanceof
JavaEditor))
- return null;
-
- int offset= region.getOffset();
-
- IJavaElement input= EditorUtility.getEditorInputJavaElement(textEditor, false);
- if (input == null)
- return null;
-
- IDocument document=
textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput());
- IRegion wordRegion = JavaWordFinder.findWord(document, offset);
-
- if (wordRegion == null)
- return null;
-
- int[] range = null;
- FastJavaPartitionScanner scanner = new FastJavaPartitionScanner();
- scanner.setRange(document, 0, document.getLength());
- while(true) {
- IToken token = scanner.nextToken();
- if(token == null || token.isEOF()) break;
- int start = scanner.getTokenOffset();
- int end = start + scanner.getTokenLength();
- if(start <= offset && end >= offset) {
- range = new int[]{start, end};
- break;
- }
- if(start > offset) break;
- }
-
- if (!checkStartPosition(document, offset))
- return null;
-
- IFile file = null;
-
- try {
- IResource resource = input.getCorrespondingResource();
- if (resource instanceof IFile)
- file = (IFile) resource;
- } catch (JavaModelException e) {
- // Ignore. It is probably because of Java element's resource is not found
- }
-
- if(range == null) range = new int[]{0, document.getLength()};
-
- Map<String, ISeamMessages> messages = findMessagesComponents(document, file,
wordRegion, range[0], range[1]);
- if (messages != null && !messages.isEmpty())
- return new IHyperlink[] {new SeamELInJavaStringHyperlink(wordRegion, messages)};
-
- IJavaElement[] elements = findJavaElements(document, file, wordRegion, range[0],
range[1]);
- if (elements != null && elements.length > 0)
- return new IHyperlink[] {new SeamELInJavaStringHyperlink(wordRegion, elements)};
-
- return null;
- }
-
- public static IJavaElement[] findJavaElements(IDocument document, IFile file, IRegion
region, int start, int end) {
-
- 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, region.getOffset(), region,
start, end);
- prefix = (prefix == null ? "" : prefix);
-
- List<IJavaElement> javaElements = null;
-
- try {
- javaElements = engine.getJavaElementsForExpression(
- seamProject, file, prefix, region.getOffset());
- } catch (StringIndexOutOfBoundsException e) {
- SeamExtPlugin.getPluginLog().logError(e);
- } catch (BadLocationException e) {
- SeamExtPlugin.getPluginLog().logError(e);
- }
-
- return javaElements == null ? new IJavaElement[0] : javaElements.toArray(new
IJavaElement[0]);
- }
-
- public static Map<String, ISeamMessages> findMessagesComponents(IDocument
document, IFile file, IRegion region, int start, int end) {
- 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, region.getOffset(), region,
start, end);
- prefix = (prefix == null ? "" : prefix);
-
- ELExpression exp = engine.parseOperand(prefix);
- if (exp == null)
- return null; // No EL Operand found
-
- Map<ELInvocationExpression, List<ISeamContextVariable>> map = new
HashMap<ELInvocationExpression, List<ISeamContextVariable>>();
-
- exp.getModel().shift(region.getOffset() - exp.getFirstToken().getStart());
-
- if ( !(exp instanceof ELInvocationExpression) &&
- !(exp instanceof ELPropertyInvocation) &&
- !(exp instanceof ELArgumentInvocation))
- return null;
-
- String propertyName = null;
- if (exp instanceof ELPropertyInvocation) {
- propertyName = ((ELPropertyInvocation)exp).getMemberName();
- } else if (exp instanceof ELArgumentInvocation) {
- propertyName = Utils.trimQuotes(
- ((ELArgumentInvocation)exp).getArgument().getArgument().getText());
-
- }
-
- if (propertyName == null)
- return null;
-
-// ScopeType scope = SeamELCompletionEngine.getScope(seamProject, file);
-
- ELInvocationExpression expr = (ELInvocationExpression)exp;
-
- ELInvocationExpression left = expr;
-
- if (expr.getLeft() != null) {
- while (left != null) {
- List<ISeamContextVariable> resolvedVars = new
ArrayList<ISeamContextVariable>();
- resolvedVars = engine.resolveVariables(seamProject, file, left,
- left == expr, true);
- if (resolvedVars != null && !resolvedVars.isEmpty()) {
- map.put(left, resolvedVars);
- break;
- }
- left = (ELInvocationExpression) left.getLeft();
- }
- }
-
-
- // At the moment map contains the resolved EL parts mapped to their vars
- // And now we need to extract SeamXmlFactory vars to the real ones
- // and filter out all non-SeamMessagesComponent vars
- // Next we need to map the SeamMessagesComponent vars to properties
- Map<String, ISeamMessages> messages = new HashMap<String,
ISeamMessages>();
- if (map != null && !map.isEmpty()) {
- for (ELInvocationExpression l : map.keySet()) {
- List<ISeamContextVariable> variables = map.get(l);
- for (ISeamContextVariable variable : variables) {
- ISeamMessages messagesVariable =
SeamELCompletionEngine.getSeamMessagesComponentVariable(variable);
- if (messagesVariable != null) {
- messages.put(propertyName, messagesVariable);
- }
- }
- }
- }
-
- return messages;
-
-
- }
-
- /*
- * Checks if the EL start starting characters are present
- * @param viewer
- * @param offset
- * @return
- * @throws BadLocationException
- */
- private boolean checkStartPosition(IDocument document, int offset) {
- try {
- while (--offset >= 0) {
- if ('}' == document.getChar(offset))
- return false;
-
-
- if ('"' == document.getChar(offset) &&
- (offset - 1) >= 0 && '\\' != document.getChar(offset - 1)) {
- return false;
- }
-
-
- if ('{' == document.getChar(offset) &&
- (offset - 1) >= 0 &&
- ('#' == document.getChar(offset - 1) ||
- '$' == document.getChar(offset - 1))) {
- return true;
- }
- }
- } catch (BadLocationException e) {
- SeamExtPlugin.getPluginLog().logError(e);
- }
- return false;
- }
-
-}
Deleted:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamMessagesBeanHyperlink.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamMessagesBeanHyperlink.java 2011-08-02
11:17:09 UTC (rev 33448)
+++
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamMessagesBeanHyperlink.java 2011-08-02
11:43:54 UTC (rev 33449)
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.Map;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IRegion;
-import org.jboss.tools.common.model.XModelObject;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.common.model.util.FindObjectHelper;
-import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
-import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
-import org.jboss.tools.seam.core.ISeamMessages;
-
-/**
- * @author Jeremy
- */
-
-public class SeamMessagesBeanHyperlink extends AbstractHyperlink {
-
- /**
- * @see
com.ibm.sse.editor.AbstractHyperlink#doHyperlink(org.eclipse.jface.text.IRegion)
- */
- protected void doHyperlink(IRegion region) {
- Map <String, ISeamMessages> messages =
SeamBeanHyperlinkPartitioner.findMessagesComponents(getDocument(), region);
- if (messages == null || messages.isEmpty()) {
- // Nothing to open
- openFileFailed();
- return;
- }
-
- for (String property : messages.keySet()) {
- ISeamMessages messagesComponent = messages.get(property);
- Map <String, IResource> resources = messagesComponent.getResourcesMap();
- if (resources == null || resources.isEmpty())
- continue;
-
- for (String bundle : resources.keySet()) {
- IResource resource = resources.get(bundle);
- XModelObject xmo = EclipseResourceUtil.getObjectByResource(resource);
- if (xmo == null)
- continue;
-
- XModelObject xmoChild = xmo.getChildByPath(property);
- if (xmoChild == null)
- continue;
-
- int result = FindObjectHelper.findModelObject(xmoChild,
FindObjectHelper.IN_EDITOR_ONLY);
- if (result == 0) {
- // Success
- return;
- }
- }
- }
- // could not open editor
- openFileFailed();
- }
-
- IRegion fLastRegion = null;
- /**
- * @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
- */
- protected IRegion doGetHyperlinkRegion(int offset) {
- fLastRegion = SeamBeanHyperlinkPartitioner.getMessagesPropertyRegion(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