Author: vrubezhny
Date: 2009-04-14 14:31:03 -0400 (Tue, 14 Apr 2009)
New Revision: 14745
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink/
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink/RichfacesBundleHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink/RichfacesJSPBundleHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink/RichfacesJSPLoadBundleHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink/RichfacesLoadBundleHyperlink.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/META-INF/MANIFEST.MF
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/build.properties
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/plugin.xml
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/RichfacesExtensionsPlugin.java
Log:
JBIDE-4147 A hyperlink doesn't work for <a4j:loadBundle> RichFaces tag
New Bundle & Load Bundle hyperlinks and partitioners are added for bundles defined
using <a4j:loadBundle>
and <ajax:loadBundle> tags
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/META-INF/MANIFEST.MF
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/META-INF/MANIFEST.MF 2009-04-14
18:27:18 UTC (rev 14744)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/META-INF/MANIFEST.MF 2009-04-14
18:31:03 UTC (rev 14745)
@@ -8,10 +8,15 @@
Bundle-SymbolicName: org.jboss.tools.jsf.text.ext.richfaces; singleton:=true
Bundle-Localization: plugin
Require-Bundle:
- org.eclipse.ui,org.eclipse.core.runtime,
- org.eclipse.core.resources,org.eclipse.jface.text,
+ org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.jface.text,
org.jboss.tools.common.text.ext,
- org.jboss.tools.jsf.text.ext
-Export-Package: org.jboss.tools.jsf.text.ext.richfaces
+ org.jboss.tools.jsf.text.ext,
+ org.jboss.tools.jst.web;bundle-version="2.0.0"
+Export-Package: org.jboss.tools.jsf.text.ext.richfaces,
+ org.jboss.tools.jsf.text.ext.richfaces.hyperlink
Bundle-Version: 2.0.0
+
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/build.properties
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/build.properties 2009-04-14
18:27:18 UTC (rev 14744)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/build.properties 2009-04-14
18:31:03 UTC (rev 14745)
@@ -1,8 +1,9 @@
bin.includes = META-INF/,\
plugin.xml,\
- jsfextensions.jar,\
+ jsfrichfacesextensions.jar,\
about.html,\
plugin.properties
-jars.compile.order = jsfextensions.jar
-source.jsfextensions.jar = src/
-output.jsfextensions.jar = bin/
+jars.compile.order = jsfrichfacesextensions.jar
+output.jsfrichfacesextensions.jar = bin/
+src.includes = src/
+source.jsfrichfacesextensions.jar = src/
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/plugin.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/plugin.xml 2009-04-14
18:27:18 UTC (rev 14744)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/plugin.xml 2009-04-14
18:31:03 UTC (rev 14745)
@@ -169,5 +169,61 @@
</contentType>
</hyperlinkPartitioner>
+ <hyperlinkPartitioner
+
id="org.jboss.tools.jsf.text.ext.richfaces.hyperlink.RichfacesJSPLoadBundleHyperlinkPartitioner"
+
class="org.jboss.tools.jsf.text.ext.richfaces.hyperlink.RichfacesJSPLoadBundleHyperlinkPartitioner">
+ <contentType id="org.eclipse.jst.jsp.core.jspsource">
+ <partitionType
id="org.jboss.tools.common.text.ext.xml.XML_ATTRIBUTE_VALUE">
+ </partitionType>
+ </contentType>
+ <contentType id="org.eclipse.wst.html.core.htmlsource">
+ <partitionType
id="org.jboss.tools.common.text.ext.xml.XML_ATTRIBUTE_VALUE">
+ </partitionType>
+ </contentType>
+ </hyperlinkPartitioner>
+
+
+ <hyperlinkPartitioner
+
id="org.jboss.tools.jsf.text.ext.richfaces.hyperlink.RichfacesJSPBundleHyperlinkPartitioner"
+
class="org.jboss.tools.jsf.text.ext.richfaces.hyperlink.RichfacesJSPBundleHyperlinkPartitioner">
+ <contentType id="org.eclipse.jst.jsp.core.jspsource">
+ <partitionType
id="org.jboss.tools.common.text.ext.jsp.FACELETS_ATTRIBUTE_VALUE_WITH_EXPR"
/>
+ <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.FACELETS_ATTRIBUTE_VALUE_WITH_EXPR"
/>
+ <partitionType
id="org.jboss.tools.common.text.ext.jsp.JSP_EXPRESSION" />
+ </contentType>
+ </hyperlinkPartitioner>
+
</extension>
+
+ <extension
+ point="org.jboss.tools.common.text.ext.hyperlink"
+ id="org.jboss.tools.common.text.ext.jsf.richfaces.hyperlink"
+ name="org.jboss.tools.common.text.ext.jsf.richfaces.hyperlink">
+
+ <hyperlink
+ class="org.jboss.tools.jsf.text.ext.richfaces.hyperlink.RichfacesLoadBundleHyperlink"
+ id="org.jboss.tools.jsf.text.ext.richfaces.hyperlink.RichfacesLoadBundleHyperlink">
+ <contenttypeidentifier id="org.eclipse.jst.jsp.core.jspsource">
+ <partitiontype
id="org.jboss.tools.common.text.ext.jsp.JSP_RICHFACES_LOADBUNDLE" />
+ </contenttypeidentifier>
+ <contenttypeidentifier id="org.eclipse.wst.html.core.htmlsource">
+ <partitiontype
id="org.jboss.tools.common.text.ext.jsp.JSP_RICHFACES_LOADBUNDLE" />
+ </contenttypeidentifier>
+ </hyperlink>
+
+ <hyperlink
+ class="org.jboss.tools.jsf.text.ext.richfaces.hyperlink.RichfacesBundleHyperlink"
+ id="org.jboss.tools.jsf.text.ext.richfaces.hyperlink.RichfacesBundleHyperlink">
+ <contenttypeidentifier id="org.eclipse.jst.jsp.core.jspsource">
+ <partitiontype
id="org.jboss.tools.common.text.ext.jsp.JSP_RICHFACES_BUNDLE" />
+ </contenttypeidentifier>
+ <contenttypeidentifier id="org.eclipse.wst.html.core.htmlsource">
+ <partitiontype
id="org.jboss.tools.common.text.ext.jsp.JSP_RICHFACES_BUNDLE" />
+ </contenttypeidentifier>
+ </hyperlink>
+ </extension>
+
</plugin>
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/RichfacesExtensionsPlugin.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/RichfacesExtensionsPlugin.java 2009-04-14
18:27:18 UTC (rev 14744)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/RichfacesExtensionsPlugin.java 2009-04-14
18:31:03 UTC (rev 14745)
@@ -52,14 +52,6 @@
}
/**
- * This method is called when the plug-in is stopped
- */
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- plugin = null;
- }
-
- /**
* Returns the shared instance.
*/
public static RichfacesExtensionsPlugin getDefault() {
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink/RichfacesBundleHyperlink.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink/RichfacesBundleHyperlink.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink/RichfacesBundleHyperlink.java 2009-04-14
18:31:03 UTC (rev 14745)
@@ -0,0 +1,48 @@
+package org.jboss.tools.jsf.text.ext.richfaces.hyperlink;
+
+import java.util.ArrayList;
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.ui.IEditorPart;
+import org.jboss.tools.common.text.ext.util.TaglibManagerWrapper;
+import org.jboss.tools.jsf.text.ext.hyperlink.BundleHyperlink;
+import org.jboss.tools.jsf.text.ext.richfaces.RichfacesExtensionsPlugin;
+import org.jboss.tools.jst.web.tld.TaglibData;
+import org.jboss.tools.jst.web.tld.VpeTaglibManager;
+import org.jboss.tools.jst.web.tld.VpeTaglibManagerProvider;
+
+public class RichfacesBundleHyperlink extends BundleHyperlink {
+
+ protected String[] getLoadBundleTagPrefixes(IRegion region) {
+ ArrayList<String> prefixes = new ArrayList<String>();
+ TaglibManagerWrapper tmw = new TaglibManagerWrapper();
+ tmw.init(getDocument(), region.getOffset());
+ if(tmw.exists()) {
+ for (String uri : RichfacesJSPBundleHyperlinkPartitioner.LoadBundleURIs) {
+ String prefix = tmw.getPrefix(uri);
+ if (prefix != null)
+ prefixes.add(prefix);
+ }
+ } else {
+ VpeTaglibManager taglibManager = getTaglibManager();
+ if(taglibManager == null) return null;
+ TaglibData[] data = (TaglibData[])taglibManager.getTagLibs().toArray(new
TaglibData[0]);
+ for (int i = 0; i < data.length; i++) {
+ for (String uri : RichfacesJSPBundleHyperlinkPartitioner.LoadBundleURIs) {
+ if(uri.equals(data[i].getUri()))
+ prefixes.add(data[i].getPrefix());
+ }
+ }
+ }
+ return (String[])prefixes.toArray(new String[prefixes.size()]);
+ }
+
+ private VpeTaglibManager getTaglibManager() {
+ IEditorPart editor =
RichfacesExtensionsPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ if(editor instanceof VpeTaglibManagerProvider) {
+ return ((VpeTaglibManagerProvider)editor).getTaglibManager();
+ }
+ return null;
+ }
+
+}
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink/RichfacesJSPBundleHyperlinkPartitioner.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink/RichfacesJSPBundleHyperlinkPartitioner.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink/RichfacesJSPBundleHyperlinkPartitioner.java 2009-04-14
18:31:03 UTC (rev 14745)
@@ -0,0 +1,41 @@
+package org.jboss.tools.jsf.text.ext.richfaces.hyperlink;
+
+import java.util.ArrayList;
+
+import org.eclipse.jface.text.IDocument;
+import org.jboss.tools.common.text.ext.util.TaglibManagerWrapper;
+import org.jboss.tools.jsf.text.ext.hyperlink.JSPBundleHyperlinkPartitioner;
+
+public class RichfacesJSPBundleHyperlinkPartitioner extends JSPBundleHyperlinkPartitioner
{
+ public static final String JSP_RICHFACES_BUNDLE_PARTITION =
"org.jboss.tools.common.text.ext.jsp.JSP_RICHFACES_BUNDLE";
+
+ public final static String[] LoadBundleURIs = {
+ "http://richfaces.org/a4j",
+ "https://ajax4jsf.dev.java.net/ajax"
+ };
+
+ /**
+ * @Override
+ */
+ protected String getPartitionType() {
+ return JSP_RICHFACES_BUNDLE_PARTITION;
+ }
+
+ /**
+ * @Override
+ */
+ protected String[] getLoadBundleTagPrefixes(IDocument document, int offset) {
+ TaglibManagerWrapper tmw = new TaglibManagerWrapper();
+ tmw.init(document, offset);
+ if(!tmw.exists()) return null;
+
+ ArrayList<String> prefixes = new ArrayList<String>();
+ for (String uri : LoadBundleURIs) {
+ String prefix = tmw.getPrefix(uri);
+ if (prefix != null)
+ prefixes.add(prefix);
+ }
+ return (String[])prefixes.toArray(new String[prefixes.size()]);
+ }
+
+}
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink/RichfacesJSPLoadBundleHyperlinkPartitioner.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink/RichfacesJSPLoadBundleHyperlinkPartitioner.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink/RichfacesJSPLoadBundleHyperlinkPartitioner.java 2009-04-14
18:31:03 UTC (rev 14745)
@@ -0,0 +1,39 @@
+package org.jboss.tools.jsf.text.ext.richfaces.hyperlink;
+
+import java.util.ArrayList;
+
+import org.eclipse.jface.text.IDocument;
+import org.jboss.tools.common.text.ext.util.TaglibManagerWrapper;
+import org.jboss.tools.jsf.text.ext.hyperlink.JSPLoadBundleHyperlinkPartitioner;
+
+
+public class RichfacesJSPLoadBundleHyperlinkPartitioner extends
+ JSPLoadBundleHyperlinkPartitioner {
+
+ public static final String JSP_RICHFACES_LOADBUNDLE_PARTITION =
"org.jboss.tools.common.text.ext.jsp.JSP_RICHFACES_LOADBUNDLE";
+
+ /**
+ * @Override
+ */
+ protected String getPartitionType() {
+ return JSP_RICHFACES_LOADBUNDLE_PARTITION;
+ }
+
+ /**
+ * @Override
+ */
+ protected String[] getLoadBundleTagPrefixes(IDocument document, int offset) {
+ TaglibManagerWrapper tmw = new TaglibManagerWrapper();
+ tmw.init(document, offset);
+ if(!tmw.exists()) return null;
+
+ ArrayList<String> prefixes = new ArrayList<String>();
+ for (String uri : RichfacesJSPBundleHyperlinkPartitioner.LoadBundleURIs) {
+ String prefix = tmw.getPrefix(uri);
+ if (prefix != null)
+ prefixes.add(prefix);
+ }
+ return (String[])prefixes.toArray(new String[prefixes.size()]);
+ }
+
+}
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink/RichfacesLoadBundleHyperlink.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink/RichfacesLoadBundleHyperlink.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink/RichfacesLoadBundleHyperlink.java 2009-04-14
18:31:03 UTC (rev 14745)
@@ -0,0 +1,48 @@
+package org.jboss.tools.jsf.text.ext.richfaces.hyperlink;
+
+import java.util.ArrayList;
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.ui.IEditorPart;
+import org.jboss.tools.common.text.ext.util.TaglibManagerWrapper;
+import org.jboss.tools.jsf.text.ext.hyperlink.LoadBundleHyperlink;
+import org.jboss.tools.jsf.text.ext.richfaces.RichfacesExtensionsPlugin;
+import org.jboss.tools.jst.web.tld.TaglibData;
+import org.jboss.tools.jst.web.tld.VpeTaglibManager;
+import org.jboss.tools.jst.web.tld.VpeTaglibManagerProvider;
+
+public class RichfacesLoadBundleHyperlink extends LoadBundleHyperlink {
+
+ protected String[] getLoadBundleTagPrefixes(IRegion region) {
+ ArrayList<String> prefixes = new ArrayList<String>();
+ TaglibManagerWrapper tmw = new TaglibManagerWrapper();
+ tmw.init(getDocument(), region.getOffset());
+ if(tmw.exists()) {
+ for (String uri : RichfacesJSPBundleHyperlinkPartitioner.LoadBundleURIs) {
+ String prefix = tmw.getPrefix(uri);
+ if (prefix != null)
+ prefixes.add(prefix);
+ }
+ } else {
+ VpeTaglibManager taglibManager = getTaglibManager();
+ if(taglibManager == null) return null;
+ TaglibData[] data = (TaglibData[])taglibManager.getTagLibs().toArray(new
TaglibData[0]);
+ for (int i = 0; i < data.length; i++) {
+ for (String uri : RichfacesJSPBundleHyperlinkPartitioner.LoadBundleURIs) {
+ if(uri.equals(data[i].getUri()))
+ prefixes.add(data[i].getPrefix());
+ }
+ }
+ }
+ return (String[])prefixes.toArray(new String[prefixes.size()]);
+ }
+
+ private VpeTaglibManager getTaglibManager() {
+ IEditorPart editor =
RichfacesExtensionsPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ if(editor instanceof VpeTaglibManagerProvider) {
+ return ((VpeTaglibManagerProvider)editor).getTaglibManager();
+ }
+ return null;
+ }
+
+}