private void doJSPELHyperlinkTestForELInTagBodyTest(
      String pageName, String template, String editorName) throws BadLocationException {
    IEditorPart editor = WorkbenchUtils.openEditor(pageName);
    assertTrue(editor instanceof JSPMultiPageEditor);
    JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
    ISourceViewer viewer = jspMultyPageEditor.getSourceEditor().getTextViewer();
    assertNotNull("Viewer couldn't be found for " + pageName, viewer);
    IDocument document = viewer.getDocument();
    IRegion reg =
        new FindReplaceDocumentAdapter(document).find(0, template, true, true, false, false);
    assertNotNull("Text: " + template + " not found", reg);

    IHyperlink[] links =
        elHyperlinkDetector.detectHyperlinks(
            viewer, new Region(reg.getOffset() + reg.getLength() - 1, 0), true);

    assertNotNull("Hyperlinks for EL:#{" + template + "} are not found", links);

    assertTrue("Hyperlinks for EL: #{" + template + "} are not found", links.length != 0);

    boolean found = false;
    for (IHyperlink link : links) {
      assertNotNull(link.toString());

      link.open();

      IEditorPart resultEditor =
          PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
      if (editorName.equals(resultEditor.getTitle())) {
        found = true;
        return;
      }
    }
    assertTrue("OpenOn have not opened " + editorName + " editor", found);
  }
コード例 #2
0
 public void init(String wizardId, String packName, String typeName) {
   wizard = (NewBatchArtifactWizard) WorkbenchUtils.findWizardByDefId(wizardId);
   wizard.init(BatchUIPlugin.getDefault().getWorkbench(), new StructuredSelection(jp));
   wizard.setOpenEditorAfterFinish(false);
   open();
   page = (NewTypeWizardPage) dialog.getSelectedPage();
   setTypeName(packName, typeName);
 }
コード例 #3
0
 public void init(String wizardId) {
   wizard = (NewBeansXMLCreationWizard) WorkbenchUtils.findWizardByDefId(wizardId);
   tck = ResourcesPlugin.getWorkspace().getRoot().getProject("tck");
   jp = EclipseUtil.getJavaProject(tck);
   wizard.init(CDIUIPlugin.getDefault().getWorkbench(), new StructuredSelection(jp));
   dialog =
       new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
   wizard.setOpenEditorAfterFinish(false);
   dialog.setBlockOnOpen(false);
   dialog.open();
 }
 public void testJSPELHyperlinkTestForELInTagBody()
     throws PartInitException, BadLocationException {
   try {
     for (int i = 0; i < PAGE_NAMES.length; i++) {
       for (int j = 0; j < TEXT_TO_FIND[i].length; j++) {
         doJSPELHyperlinkTestForELInTagBodyTest(
             PAGE_NAMES[i], TEXT_TO_FIND[i][j], RESULT_EDITORS[i][j]);
       }
     }
   } finally {
     WorkbenchUtils.closeAllEditors();
   }
 }
コード例 #5
0
  protected void tearDown() throws Exception {
    WorkbenchUtils.closeAllEditors();

    super.tearDown();

    earProject = null;
    earEjbProject = null;
    earEarProject = null;
    testProject = null;
    seamEarProject = null;
    seamEarEjbProject = null;
    seamTestProject = null;
  }
コード例 #6
0
    public void init(String wizardId, String packName, String typeName) {
      wizard = (NewElementWizard) WorkbenchUtils.findWizardByDefId(wizardId);
      tck = ResourcesPlugin.getWorkspace().getRoot().getProject("tck");
      jp = EclipseUtil.getJavaProject(tck);
      wizard.init(CDIUIPlugin.getDefault().getWorkbench(), new StructuredSelection(jp));
      if (wizard instanceof NewCDIElementWizard) {
        ((NewCDIElementWizard) wizard).setOpenEditorAfterFinish(false);
      } else if (wizard instanceof NewAnnotationLiteralCreationWizard) {
        ((NewAnnotationLiteralCreationWizard) wizard).setOpenEditorAfterFinish(false);
      }
      dialog =
          new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
      dialog.setBlockOnOpen(false);
      dialog.open();

      page = (NewTypeWizardPage) dialog.getSelectedPage();

      setTypeName(packName, typeName);
    }
コード例 #7
0
 public void init(String wizardId) {
   wizard = (NewJobXMLCreationWizard) WorkbenchUtils.findWizardByDefId(wizardId);
   wizard.init(BatchUIPlugin.getDefault().getWorkbench(), new StructuredSelection(jp));
   wizard.setOpenEditorAfterFinish(false);
   open();
 }