Author: vrubezhny
Date: 2007-12-26 09:51:28 -0500 (Wed, 26 Dec 2007)
New Revision: 5449
Added:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamViewHyperlink.java
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamViewHyperlinkPartitioner.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/plugin.xml
Log:
http://jira.jboss.org/jira/browse/JBIDE-1437 Ctrl+Click/F3 navigation isn't supported
for s:button@view and s:link@view attributes
Issue is fixed
Modified: trunk/seam/plugins/org.jboss.tools.seam.text.ext/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.text.ext/plugin.xml 2007-12-26 14:29:51 UTC
(rev 5448)
+++ trunk/seam/plugins/org.jboss.tools.seam.text.ext/plugin.xml 2007-12-26 14:51:28 UTC
(rev 5449)
@@ -39,7 +39,7 @@
<hyperlinkPartitioner
id="org.jboss.tools.seam.text.ext.hyperlink.SeamViewHyperlinkPartitioner"
-
class="org.jboss.tools.jsf.text.ext.hyperlink.JSFJSPLinkHyperlinkPartitioner">
+
class="org.jboss.tools.seam.text.ext.hyperlink.SeamViewHyperlinkPartitioner">
<contentType id="org.eclipse.jst.jsp.core.jspsource">
<partitionType
id="org.jboss.tools.common.text.ext.xml.XML_ATTRIBUTE_VALUE">
<axis
path="*/[http://jboss.com/products/seam/taglib]:button/view/" />
@@ -77,6 +77,18 @@
<partitiontype id="org.jboss.tools.seam.text.ext.SEAM_BEAN" />
</contenttypeidentifier>
</hyperlink>
+
+ <hyperlink
+ class="org.jboss.tools.seam.text.ext.hyperlink.SeamViewHyperlink"
+ id="org.jboss.tools.seam.text.ext.hyperlink.SeamViewHyperlink">
+ <contenttypeidentifier id="org.eclipse.jst.jsp.core.jspsource">
+ <partitiontype id="org.jboss.tools.seam.text.ext.SEAM_VIEW_LINK" />
+ </contenttypeidentifier>
+ <contenttypeidentifier id="org.eclipse.wst.html.core.htmlsource">
+ <partitiontype id="org.jboss.tools.seam.text.ext.SEAM_VIEW_LINK" />
+ </contenttypeidentifier>
+ </hyperlink>
+
</extension>
<extension
@@ -89,4 +101,5 @@
</hyperlinkDetector>
</extension>
+
</plugin>
Added:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamViewHyperlink.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamViewHyperlink.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamViewHyperlink.java 2007-12-26
14:51:28 UTC (rev 5449)
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.project.IModelNature;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.text.ext.hyperlink.LinkHyperlink;
+import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
+import org.jboss.tools.seam.text.ext.SeamExtPlugin;
+
+public class SeamViewHyperlink extends LinkHyperlink {
+
+ protected String updateFilenameForModel(String filename, IProject project) {
+ if (filename == null ||
+ !filename.trim().startsWith("/"))
+ return null;
+ WebPromptingProvider provider = WebPromptingProvider.getInstance();
+
+ IModelNature n = EclipseResourceUtil.getModelNature(project);
+ XModel xModel = n == null ? null : n.getModel();
+
+ if (xModel != null) {
+ List list = provider.getList(xModel, WebPromptingProvider.JSF_GET_PATH, filename,
null);
+ if (list != null && list.size() > 0) {
+ for (Iterator i = list.iterator(); i.hasNext();) {
+ Object o = i.next();
+ if (o instanceof String) {
+ return (String)o;
+ }
+ }
+ }
+ }
+ return filename;
+ }
+
+ protected IFile getFileFromProject(String fileName) {
+ IFile documentFile = getFile();
+
+ try {
+ IProject project = documentFile.getProject();
+ return super.getFileFromProject(updateFilenameForModel(fileName, project));
+ } catch (Exception x) {
+ SeamExtPlugin.getPluginLog().logError(x);
+ return null;
+ }
+ }
+
+}
\ No newline at end of file
Property changes on:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamViewHyperlink.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamViewHyperlinkPartitioner.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamViewHyperlinkPartitioner.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamViewHyperlinkPartitioner.java 2007-12-26
14:51:28 UTC (rev 5449)
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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 org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.text.IDocument;
+import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
+import org.jboss.tools.common.text.ext.hyperlink.jsp.JSPLinkHyperlinkPartitioner;
+import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
+import org.jboss.tools.seam.internal.core.SeamProject;
+import org.jboss.tools.seam.text.ext.SeamExtPlugin;
+
+public class SeamViewHyperlinkPartitioner extends JSPLinkHyperlinkPartitioner {
+ public static final String SEAM_VIEW_LINK_PARTITION =
"org.jboss.tools.seam.text.ext.SEAM_VIEW_LINK";
+
+ private String[] SEAM_PROJECT_NATURES = {
+ SeamProject.NATURE_ID
+ };
+
+ /**
+ * @see
org.jboss.tools.common.text.ext.hyperlink.XMLLinkHyperlinkPartitioner#getPartitionType()
+ */
+ protected String getPartitionType() {
+ return SEAM_VIEW_LINK_PARTITION;
+ }
+
+ /**
+ * @see
org.jboss.tools.common.text.ext.hyperlink.XMLContextParamLinkHyperlinkPartitioner#recognizeNature(org.eclipse.jface.text.IDocument)
+ */
+ protected boolean recognizeNature(IDocument document) {
+ StructuredModelWrapper smw = new StructuredModelWrapper();
+ try {
+ smw.init(document);
+ IFile documentFile = smw.getFile();
+ IProject project = documentFile.getProject();
+
+ for (int i = 0; i < SEAM_PROJECT_NATURES.length; i++) {
+ if (project.getNature(SEAM_PROJECT_NATURES[i]) != null)
+ return true;
+ }
+ return false;
+ } catch (Exception x) {
+ SeamExtPlugin.getPluginLog().logError(x);
+ return false;
+ } 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) {
+ return recognizeNature(document) ? super.recognize(document, region) : false;
+ }
+
+}
Property changes on:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamViewHyperlinkPartitioner.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain