Author: dgolovin
Date: 2008-10-10 21:14:05 -0400 (Fri, 10 Oct 2008)
New Revision: 10781
Added:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/beanHyperlinkTests.jsp
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forward/
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forward/forwardHiperlinkPage2Tests.jsp
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forwardHiperlinkPage1Tests.jsp
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forwardHiperlinkTests.page.jsp
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/include/
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/include/includeHiperlinkPage2Tests.jsp
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/includeHiperlinkPage1Tests.jsp
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/includeHiperlinkTests.page.jsp
Modified:
trunk/common/tests/org.jboss.tools.common.text.ext.test/src/org/jboss/tools/common/text/ext/test/OpenOnsTest.java
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ResourcesUtils.java
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/WorkbenchUtils.java
Log:
add nJunit tests fro common.text.ext plugin
Added:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/beanHyperlinkTests.jsp
===================================================================
---
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/beanHyperlinkTests.jsp
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/beanHyperlinkTests.jsp 2008-10-11
01:14:05 UTC (rev 10781)
@@ -0,0 +1,5 @@
+<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h" %>
+<jsp:useBean id="b1"
class="org.jboss.tools.test.TestBean1"></jsp:useBean>
+<jsp:getProperty property="property1" name="b1"/>
+
Property changes on:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/beanHyperlinkTests.jsp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forward/forwardHiperlinkPage2Tests.jsp
===================================================================
---
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forward/forwardHiperlinkPage2Tests.jsp
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forward/forwardHiperlinkPage2Tests.jsp 2008-10-11
01:14:05 UTC (rev 10781)
@@ -0,0 +1 @@
+<!-- forward test page -->
Property changes on:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forward/forwardHiperlinkPage2Tests.jsp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forwardHiperlinkPage1Tests.jsp
===================================================================
---
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forwardHiperlinkPage1Tests.jsp
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forwardHiperlinkPage1Tests.jsp 2008-10-11
01:14:05 UTC (rev 10781)
@@ -0,0 +1 @@
+<!-- forward test page -->
\ No newline at end of file
Property changes on:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forwardHiperlinkPage1Tests.jsp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forwardHiperlinkTests.page.jsp
===================================================================
---
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forwardHiperlinkTests.page.jsp
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forwardHiperlinkTests.page.jsp 2008-10-11
01:14:05 UTC (rev 10781)
@@ -0,0 +1,2 @@
+<jsp:forward
page="forward/forwardHiperlinkPage2Tests.jsp"></jsp:forward>
+<jsp:forward page="forwardHiperlinkPage1Tests.jsp"></jsp:forward>
\ No newline at end of file
Property changes on:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forwardHiperlinkTests.page.jsp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/include/includeHiperlinkPage2Tests.jsp
===================================================================
---
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/include/includeHiperlinkPage2Tests.jsp
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/include/includeHiperlinkPage2Tests.jsp 2008-10-11
01:14:05 UTC (rev 10781)
@@ -0,0 +1 @@
+<!-- include test page -->
Property changes on:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/include/includeHiperlinkPage2Tests.jsp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/includeHiperlinkPage1Tests.jsp
===================================================================
---
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/includeHiperlinkPage1Tests.jsp
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/includeHiperlinkPage1Tests.jsp 2008-10-11
01:14:05 UTC (rev 10781)
@@ -0,0 +1 @@
+<!-- include test page -->
\ No newline at end of file
Property changes on:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/includeHiperlinkPage1Tests.jsp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/includeHiperlinkTests.page.jsp
===================================================================
---
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/includeHiperlinkTests.page.jsp
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/includeHiperlinkTests.page.jsp 2008-10-11
01:14:05 UTC (rev 10781)
@@ -0,0 +1,2 @@
+<jsp:forward
page="include/includeHiperlinkPage2Tests.jsp"></jsp:forward>
+<jsp:forward page="includeHiperlinkPage1Tests.jsp"></jsp:forward>
\ No newline at end of file
Property changes on:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/includeHiperlinkTests.page.jsp
___________________________________________________________________
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-10
18:50:50 UTC (rev 10780)
+++
trunk/common/tests/org.jboss.tools.common.text.ext.test/src/org/jboss/tools/common/text/ext/test/OpenOnsTest.java 2008-10-11
01:14:05 UTC (rev 10781)
@@ -35,14 +35,14 @@
public class OpenOnsTest extends TestCase {
- public static final String STYLE_OPENON_PROJECT = "HiperlinksTestProject";
+ public static final String OPENON_TEST_PROJECT = "HiperlinksTestProject";
public IProject project = null;
protected void setUp() {
project = ResourcesPlugin.getWorkspace().getRoot().getProject(
- STYLE_OPENON_PROJECT);
+ OPENON_TEST_PROJECT);
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false);
JobUtils.waitForIdle();
}
@@ -55,12 +55,10 @@
super("styleClass OpenOn tests");
}
- public static final String WEB_XML_FILE_PATH = "WebContent/WEB-INF/web.xml";
+ public static final String WEB_XML_FILE_PATH =
OPENON_TEST_PROJECT+"/WebContent/WEB-INF/web.xml";
public void testFilterNameOpenOn() throws PartInitException, BadLocationException {
- IFile webXml = project.getFile(WEB_XML_FILE_PATH);
- IEditorDescriptor descriptor = IDE.getEditorDescriptor(webXml);
- IEditorPart editor = WorkbenchUtils.openEditor(webXml, descriptor.getId());
+ IEditorPart editor = WorkbenchUtils.openEditor(WEB_XML_FILE_PATH);
editor = ((EditorPartWrapper)editor).getEditor();
JobUtils.waitForIdle();
DefaultMultipageEditor xmlMultyPageEditor = (DefaultMultipageEditor) editor;
@@ -84,9 +82,7 @@
}
public void testRoleNameOpenOn() throws PartInitException, BadLocationException {
- IFile webXml = project.getFile(WEB_XML_FILE_PATH);
- IEditorDescriptor descriptor = IDE.getEditorDescriptor(webXml);
- IEditorPart editor = WorkbenchUtils.openEditor(webXml, descriptor.getId());
+ IEditorPart editor = WorkbenchUtils.openEditor(WEB_XML_FILE_PATH);
editor = ((EditorPartWrapper)editor).getEditor();
JobUtils.waitForIdle();
DefaultMultipageEditor xmlMultyPageEditor = (DefaultMultipageEditor) editor;
@@ -108,9 +104,7 @@
}
public void testServletNameOpenOn() throws PartInitException, BadLocationException {
- IFile webXml = project.getFile(WEB_XML_FILE_PATH);
- IEditorDescriptor descriptor = IDE.getEditorDescriptor(webXml);
- IEditorPart editor = WorkbenchUtils.openEditor(webXml, descriptor.getId());
+ IEditorPart editor = WorkbenchUtils.openEditor(WEB_XML_FILE_PATH);
editor = ((EditorPartWrapper)editor).getEditor();
JobUtils.waitForIdle();
DefaultMultipageEditor xmlMultyPageEditor = (DefaultMultipageEditor) editor;
@@ -137,11 +131,10 @@
assertEquals("<servlet-name>", selection.getText());
}
- public static final String TAGLIB_URI_TEST_FILE =
"WebContent/tldUriHyperlinkTests.jsp";
+ public static final String TAGLIB_URI_TEST_FILE = OPENON_TEST_PROJECT +
"/WebContent/tldUriHyperlinkTests.jsp";
public void testTaglibUriFromJarOpenOn() throws BadLocationException {
- IEditorPart editor = WorkbenchUtils.openEditor(project
- .getFile(TAGLIB_URI_TEST_FILE), JSPMultiPageEditor.EDITOR_ID);
+ IEditorPart editor = WorkbenchUtils.openEditor(TAGLIB_URI_TEST_FILE);
assertTrue(editor instanceof JSPMultiPageEditor);
JobUtils.waitForIdle();
JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
@@ -155,17 +148,17 @@
//assertNotNull(links[0].getHyperlinkText());
assertNotNull(links[0].toString());
links[0].open();
+ JobUtils.waitForIdle();
editor =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
String fileName = editor.getEditorInput().getName();
System.out.println(fileName);
assertTrue("jsf_core.tld".equals(fileName));
}
- public static final String TAGLIB_URI_JSP_ROOT_TEST_FILE =
"WebContent/jspTagsHyperlinkTests.jsp";
+ public static final String TAGLIB_URI_JSP_ROOT_TEST_FILE = OPENON_TEST_PROJECT +
"/WebContent/jspTagsHyperlinkTests.jsp";
public void testTaglibUriFromJarinJspRootOpenOn() throws BadLocationException {
- IEditorPart editor = WorkbenchUtils.openEditor(project
- .getFile(TAGLIB_URI_JSP_ROOT_TEST_FILE), JSPMultiPageEditor.EDITOR_ID);
+ IEditorPart editor = WorkbenchUtils.openEditor(TAGLIB_URI_JSP_ROOT_TEST_FILE);
assertTrue(editor instanceof JSPMultiPageEditor);
JobUtils.waitForIdle();
JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
@@ -179,6 +172,8 @@
//assertNotNull(links[0].getHyperlinkText());
assertNotNull(links[0].toString());
links[0].open();
+ JobUtils.waitForIdle();
+
editor =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
String fileName = editor.getEditorInput().getName();
@@ -186,13 +181,12 @@
assertTrue("jsf_core.tld".equals(fileName));
}
- public static final String STYLE_TEST_FILE =
"WebContent/styleHyperlinkTests.jsp";
- public static final String CSS1_TEST_FILE =
"WebContent/stylesheet/style1.css";
- public static final String CSS2_TEST_FILE =
"WebContent/stylesheet/style2.css";
+ public static final String STYLE_TEST_FILE = OPENON_TEST_PROJECT +
"/WebContent/styleHyperlinkTests.jsp";
+ public static final String CSS1_TEST_FILE = OPENON_TEST_PROJECT +
"/WebContent/stylesheet/style1.css";
+ public static final String CSS2_TEST_FILE = OPENON_TEST_PROJECT +
"/WebContent/stylesheet/style2.css";
public void testStylesheetOpenOn() throws BadLocationException {
- IEditorPart editor = WorkbenchUtils.openEditor(project
- .getFile(STYLE_TEST_FILE), JSPMultiPageEditor.EDITOR_ID);
+ IEditorPart editor = WorkbenchUtils.openEditor(STYLE_TEST_FILE);
assertTrue(editor instanceof JSPMultiPageEditor);
JobUtils.waitForIdle();
JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
@@ -206,6 +200,7 @@
//assertNotNull(links[0].getHyperlinkText());
assertNotNull(links[0].toString());
links[0].open();
+ JobUtils.waitForIdle();
editor =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
String fileName = editor.getEditorInput().getName();
@@ -213,8 +208,7 @@
}
public void testStyleClassOpenOns() throws CoreException, BadLocationException {
- IEditorPart editor = WorkbenchUtils.openEditor(project
- .getFile(STYLE_TEST_FILE), JSPMultiPageEditor.EDITOR_ID);
+ IEditorPart editor = WorkbenchUtils.openEditor(STYLE_TEST_FILE);
assertTrue(editor instanceof JSPMultiPageEditor);
JobUtils.waitForIdle();
JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
@@ -228,6 +222,7 @@
//assertNotNull(links[0].getHyperlinkText());
assertNotNull(links[0].toString());
links[0].open();
+ JobUtils.waitForIdle();
editor =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
String fileName = editor.getEditorInput().getName();
@@ -241,6 +236,7 @@
//assertNotNull(links[0].getHyperlinkText());
assertNotNull(links[0].toString());
links[0].open();
+ JobUtils.waitForIdle();
editor =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
fileName = editor.getEditorInput().getName();
@@ -250,23 +246,24 @@
"style-class6", true, true, false, false);
links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, reg, false);
links[0].open();
+ JobUtils.waitForIdle();
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();
fileName = editor.getEditorInput().getName();
assertTrue("style2.css".equals(fileName));
}
- public static final String CLASS_TEST_FILE =
"WebContent/classHyperlinkTests.jsp";
- public static final String CLASS1_TEST_FILE =
"JavaSource/org/jboss/test/ChangeListenerInstance.java";
+ public static final String CLASS_TEST_FILE = OPENON_TEST_PROJECT +
"/WebContent/classHyperlinkTests.jsp";
+ public static final String CLASS1_TEST_FILE = OPENON_TEST_PROJECT +
"/JavaSource/org/jboss/test/ChangeListenerInstance.java";
public void testClassNameOpenOn() throws CoreException, BadLocationException {
- IEditorPart editor = WorkbenchUtils.openEditor(project
- .getFile(CLASS_TEST_FILE), JSPMultiPageEditor.EDITOR_ID);
+ IEditorPart editor = WorkbenchUtils.openEditor(CLASS_TEST_FILE);
assertTrue(editor instanceof JSPMultiPageEditor);
JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
ISourceViewer viewer = jspMultyPageEditor.getSourceEditor().getTextViewer();
@@ -279,6 +276,7 @@
//assertNotNull(links[0].getHyperlinkText());
assertNotNull(links[0].toString());
links[0].open();
+ JobUtils.waitForIdle();
editor =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
String fileName = editor.getEditorInput().getName();
@@ -286,8 +284,7 @@
}
public void testTaglibTagNameOpenOn() throws CoreException, BadLocationException {
- IEditorPart editor = WorkbenchUtils.openEditor(project
- .getFile(CLASS_TEST_FILE), JSPMultiPageEditor.EDITOR_ID);
+ IEditorPart editor = WorkbenchUtils.openEditor(CLASS_TEST_FILE);
assertTrue(editor instanceof JSPMultiPageEditor);
JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
ISourceViewer viewer = jspMultyPageEditor.getSourceEditor().getTextViewer();
@@ -301,11 +298,121 @@
assertNotNull(links[0].toString());
System.out.println(links[0].getClass().getName());
links[0].open();
+ JobUtils.waitForIdle();
editor =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
String fileName = editor.getEditorInput().getName();
assertTrue("jsf_core.tld".equals(fileName));
}
+ public static final String USE_BEAN_TEST_FILE = OPENON_TEST_PROJECT +
"/WebContent/beanHyperlinkTests.jsp";
+ public void testUseBeanClassOpenOn() throws CoreException, BadLocationException {
+ IEditorPart editor = WorkbenchUtils.openEditor(USE_BEAN_TEST_FILE);
+ assertTrue(editor instanceof JSPMultiPageEditor);
+ JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
+ ISourceViewer viewer = jspMultyPageEditor.getSourceEditor().getTextViewer();
+
+ IRegion reg = new
FindReplaceDocumentAdapter(jspMultyPageEditor.getSourceEditor().getTextViewer().getDocument()).find(0,
+ "org.jboss.tools.test.TestBean1", 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();
+
+ String fileName = editor.getEditorInput().getName();
+ assertTrue("TestBean1.java".equals(fileName));
+
+ reg = new
FindReplaceDocumentAdapter(jspMultyPageEditor.getSourceEditor().getTextViewer().getDocument()).find(reg.getOffset(),
+ "b1", true, true, false, false);
+ 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("<jsp:useBean id=\"b1\"
class=\"org.jboss.tools.test.TestBean1\">", selection.getText());
+ }
+
+ public static final String FORWARD_TEST_FILE = OPENON_TEST_PROJECT +
"/WebContent/forwardHiperlinkTests.jsp";
+
+
+ public void testJspForwardOpenOn() throws CoreException, BadLocationException {
+ IEditorPart editor = WorkbenchUtils.openEditor(FORWARD_TEST_FILE);
+ assertTrue(editor instanceof JSPMultiPageEditor);
+ JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
+ ISourceViewer viewer = jspMultyPageEditor.getSourceEditor().getTextViewer();
+
+ IRegion reg = new FindReplaceDocumentAdapter(viewer.getDocument()).find(0,
+ "forward/forwardHiperlinkPage2Tests.jsp", 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();
+
+ String fileName = editor.getEditorInput().getName();
+ assertTrue("forwardHiperlinkPage2Tests.jsp".equals(fileName));
+
+ reg = new
FindReplaceDocumentAdapter(jspMultyPageEditor.getSourceEditor().getTextViewer().getDocument()).find(0,
+ "forwardHiperlinkPage1Tests.jsp", true, true, false, false);
+ 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();
+ fileName = editor.getEditorInput().getName();
+ assertTrue("forwardHiperlinkPage1Tests.jsp".equals(fileName));
+ }
+
+ public static final String INCLUDE_TEST_FILE = OPENON_TEST_PROJECT +
"/WebContent/includeHiperlinkTests.page.jsp";
+
+
+ public void testJspIncludeOpenOn() throws CoreException, BadLocationException {
+ IEditorPart editor = WorkbenchUtils.openEditor(INCLUDE_TEST_FILE);
+ assertTrue(editor instanceof JSPMultiPageEditor);
+ JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
+ ISourceViewer viewer = jspMultyPageEditor.getSourceEditor().getTextViewer();
+
+ IRegion reg = new
FindReplaceDocumentAdapter(jspMultyPageEditor.getSourceEditor().getTextViewer().getDocument()).find(0,
+ "include/includeHiperlinkPage2Tests.jsp", 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();
+
+ String fileName = editor.getEditorInput().getName();
+ assertTrue("includeHiperlinkPage2Tests.jsp".equals(fileName));
+
+ reg = new
FindReplaceDocumentAdapter(jspMultyPageEditor.getSourceEditor().getTextViewer().getDocument()).find(0,
+ "includeHiperlinkPage1Tests.jsp", true, true, false, false);
+ 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();
+ fileName = editor.getEditorInput().getName();
+ assertTrue("includeHiperlinkPage1Tests.jsp".equals(fileName));
+ }
}
Modified:
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ResourcesUtils.java
===================================================================
---
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ResourcesUtils.java 2008-10-10
18:50:50 UTC (rev 10780)
+++
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ResourcesUtils.java 2008-10-11
01:14:05 UTC (rev 10781)
@@ -62,23 +62,6 @@
tplPrjLcStr = FileLocator.resolve(bundle.getEntry(templLocation))
.getFile();
IProject importedPrj = importProjectIntoWorkspace(tplPrjLcStr, new
Path(tplPrjLcStr).lastSegment());
-// IProject importedPrj = createEclipseProject(bundle,tplPrjLcStr,monitor);
-// ImportOperation op = new ImportOperation(importedPrj.getFullPath(),
-// new File(tplPrjLcStr),
-// FileSystemStructureProvider.INSTANCE,
-// new IOverwriteQuery() {
-// public String queryOverwrite(String pathString) {
-// return IOverwriteQuery.ALL;
-// }},
-// Arrays.asList(new File(tplPrjLcStr).listFiles()));
-//
-// op.setCreateContainerStructure(false);
-// if( Display.getCurrent() == null || Display.getCurrent().getActiveShell() == null )
{
-// op.setContext(new Shell());
-// } else {
-// op.setContext(Display.getCurrent().getActiveShell());
-// }
-// op.run(monitor);
return importedPrj;
}
Modified:
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/WorkbenchUtils.java
===================================================================
---
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/WorkbenchUtils.java 2008-10-10
18:50:50 UTC (rev 10780)
+++
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/WorkbenchUtils.java 2008-10-11
01:14:05 UTC (rev 10781)
@@ -18,10 +18,12 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.jface.preference.PreferenceManager;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
@@ -29,6 +31,7 @@
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PreferencesUtil;
+import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.wizards.IWizardDescriptor;
@@ -88,10 +91,10 @@
.getActiveShell(), project, pageId, new String[] {pageId}, null);
}
- public static IEditorPart openEditor(IFile inputFile, String editorId) {
+ public static IEditorPart openEditor(String inputFile) {
IEditorPart part = null;
try {
- part = getWorkbenchActivePage().openEditor(new FileEditorInput(inputFile), editorId);
+ part =
IDE.openEditor(getWorkbenchActivePage(),ResourcesPlugin.getWorkspace().getRoot().getFile(new
Path(inputFile)));
} catch (PartInitException e) {
e.printStackTrace();
}