Author: dgolovin
Date: 2008-10-17 02:21:15 -0400 (Fri, 17 Oct 2008)
New Revision: 10908
Added:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/WEB-INF/tldAttributeNameOpenOnTests.tld
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/ExtensionsPlugin.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/StructuredSelectionHelper.java
trunk/common/tests/org.jboss.tools.common.text.ext.test/src/org/jboss/tools/common/text/ext/test/OpenOnsTest.java
Log:
increase coverage and fix errors in ExtensionPlugin
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/ExtensionsPlugin.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/ExtensionsPlugin.java 2008-10-17
03:01:17 UTC (rev 10907)
+++
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/ExtensionsPlugin.java 2008-10-17
06:21:15 UTC (rev 10908)
@@ -16,6 +16,7 @@
import org.jboss.tools.common.log.BaseUIPlugin;
import org.jboss.tools.common.log.IPluginLog;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkDetector;
+import org.osgi.framework.BundleContext;
/**
@@ -35,6 +36,7 @@
*/
public ExtensionsPlugin() {
super();
+ plugin = this;
}
/**
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/StructuredSelectionHelper.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/StructuredSelectionHelper.java 2008-10-17
03:01:17 UTC (rev 10907)
+++
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/StructuredSelectionHelper.java 2008-10-17
06:21:15 UTC (rev 10908)
@@ -15,10 +15,10 @@
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.jboss.tools.common.text.ext.ExtensionsPlugin;
import org.jboss.tools.common.text.ext.IEditorWrapper;
import org.jboss.tools.common.text.ext.IMultiPageEditor;
@@ -37,7 +37,7 @@
public static StructuredTextEditor getStructuredTextEditor (IEditorPart editorPart) {
IEditorPart activeEditorPart = editorPart;
if (activeEditorPart == null) {
- IWorkbenchPage workbenchPage =
ExtensionsPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IWorkbenchPage workbenchPage =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
activeEditorPart = workbenchPage.getActiveEditor();
}
if (activeEditorPart instanceof IMultiPageEditor) {
Added:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/WEB-INF/tldAttributeNameOpenOnTests.tld
===================================================================
---
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/WEB-INF/tldAttributeNameOpenOnTests.tld
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/WEB-INF/tldAttributeNameOpenOnTests.tld 2008-10-17
06:21:15 UTC (rev 10908)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<!DOCTYPE taglib
+ PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
+ "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
+
+<taglib>
+ <tlib-version>1.0</tlib-version>
+ <jsp-version>1.2</jsp-version>
+ <short-name>test</short-name>
+ <
uri>http://org.jboss.org/tests</uri>
+ <description>
+ Test tld to test attribute name open-on
+ </description>
+
+ <validator>
+ <validator-class>
+ com.sun.faces.taglib.jsf_core.CoreValidator
+ </validator-class>
+ <description>
+ verify hiperlink to the class
+ </description>
+ </validator>
+
+ <listener>
+ <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
+ </listener>
+
+ <tag>
+ <name>actionListener</name>
+ <tag-class>com.sun.faces.taglib.jsf_core.ActionListenerTag</tag-class>
+ <tei-class>com.sun.faces.taglib.FacesTagExtraInfo</tei-class>
+ <body-content>empty</body-content>
+
+ <variable>
+ <name-from-attribute>attr1</name-from-attribute>
+ </variable>
+
+ <attribute>
+ <name>attr1</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+</taglib>
Property changes on:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/WEB-INF/tldAttributeNameOpenOnTests.tld
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/common/tests/org.jboss.tools.common.text.ext.test/src/org/jboss/tools/common/text/ext/test/OpenOnsTest.java
===================================================================
---
trunk/common/tests/org.jboss.tools.common.text.ext.test/src/org/jboss/tools/common/text/ext/test/OpenOnsTest.java 2008-10-17
03:01:17 UTC (rev 10907)
+++
trunk/common/tests/org.jboss.tools.common.text.ext.test/src/org/jboss/tools/common/text/ext/test/OpenOnsTest.java 2008-10-17
06:21:15 UTC (rev 10908)
@@ -509,5 +509,28 @@
String fileName = editor.getEditorInput().getName();
assertTrue("html_basic.tld".equals(fileName));
}
-
+
+ public static final String TLD_ATTRIBUTE_NAME_TEST_FILE = OPENON_TEST_PROJECT +
"/WebContent/WEB-INF/tldAttributeNameOpenOnTests.tld";
+
+ public void testTldAttributeNameOpenOn() throws CoreException, BadLocationException {
+ IEditorPart editor = WorkbenchUtils.openEditor(TLD_ATTRIBUTE_NAME_TEST_FILE);
+ assertTrue(editor instanceof DefaultMultipageEditor);
+ DefaultMultipageEditor tldEditor = (DefaultMultipageEditor) editor;
+ tldEditor.selectPageByName("Source");
+ ISourceViewer viewer = tldEditor.getSourceEditor().getTextViewer();
+
+ IRegion reg = new
FindReplaceDocumentAdapter(tldEditor.getSourceEditor().getTextViewer().getDocument()).find(0,
+ "attr1", true, true, false, false);
+ IHyperlink[] links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, reg,
false);
+ assertNotNull(links);
+ assertTrue(links.length!=0);
+ //assertNotNull(links[0].getHyperlinkText());
+ assertNotNull(links[0].toString());
+ links[0].open();
+ JobUtils.waitForIdle();
+ editor =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+
+ ITextSelection selection =
(ITextSelection)viewer.getSelectionProvider().getSelection();
+ assertEquals("<name>", selection.getText());
+ }
}