类org.eclipse.ui.internal.ErrorEditorPart源码实例Demo

下面列出了怎么用org.eclipse.ui.internal.ErrorEditorPart的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: xtext-eclipse   文件: AbstractEditorTest.java
private XtextEditor getXtextEditor(IEditorPart openEditor) throws NoSuchFieldException, IllegalAccessException {
	XtextEditor xtextEditor = EditorUtils.getXtextEditor(openEditor);
	if (xtextEditor != null) {
		ISourceViewer sourceViewer = xtextEditor.getInternalSourceViewer();
		((ProjectionViewer) sourceViewer).doOperation(ProjectionViewer.EXPAND_ALL);
		return xtextEditor;
	} else if (openEditor instanceof ErrorEditorPart) {
		Field field = openEditor.getClass().getDeclaredField("error");
		field.setAccessible(true);
		throw new IllegalStateException("Couldn't open the editor.", ((Status) field.get(openEditor)).getException());
	} else {
		fail("Opened Editor with id:" + getEditorId() + ", is not an XtextEditor");
	}
	return null;
}
 
源代码2 项目: bonita-studio   文件: TestProcessZoo.java
protected void applyTestsOnProcess(final URL url) throws Throwable {
    final int beforeImport = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
            .getEditorReferences().length;
    final File file = new File(FileLocator.toFileURL(url).getFile());
    final ImportBosArchiveOperation ibao = new ImportBosArchiveOperation(repositoryAccessor);
    ibao.setArchiveFile(file.getAbsolutePath());
    ibao.setCurrentRepository(repositoryAccessor.getCurrentRepository());
    ibao.run(Repository.NULL_PROGRESS_MONITOR);

    for (final IRepositoryFileStore f : ibao.getFileStoresToOpen()) {
        f.open();
    }

    final IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    if (editor instanceof ErrorEditorPart) {
        final ErrorEditorPart errorEditor = (ErrorEditorPart) editor;
        final IStatus error = (IStatus) ErrorEditorPart.class.getField("error").get(errorEditor);
        throw error.getException();
    }
    final ProcessDiagramEditor processEditor = (ProcessDiagramEditor) editor;
    /* for mickeyprocessses .proc will overrided (as it is sorted) when they come so need */
    if (url.toString().contains("mickeyProcesses/") && url.toString().contains(".proc")) {
        assertEquals("Import should have opened another process editor but colsed another one for " + url, beforeImport,
                PlatformUI.getWorkbench()
                        .getActiveWorkbenchWindow().getActivePage().getEditorReferences().length);
    } else {
        assertEquals("Import should have opened another process editor for " + url, beforeImport + 1,
                PlatformUI.getWorkbench().getActiveWorkbenchWindow()
                        .getActivePage().getEditorReferences().length);
    }
    final AbstractProcess diagram = (AbstractProcess) processEditor.getDiagramEditPart().resolveSemanticElement();
    if (file.getAbsolutePath().endsWith(".bos")) {// Check unresolved dependencies for BAR Files
        final DependencyRepositoryStore store = repositoryAccessor.getRepositoryStore(DependencyRepositoryStore.class);
        for (final Element element : diagram.getElements()) {
            if (element instanceof AbstractProcess) {
                for (final Configuration config : ((AbstractProcess) element).getConfigurations()) {
                    for (final FragmentContainer fragmentContainer : config.getProcessDependencies()) {
                        for (final Fragment fragment : fragmentContainer.getFragments()) {
                            final String lib = fragment.getValue();
                            if (lib.endsWith(DependencyRepositoryStore.JAR_EXT)) {
                                assertNotNull("A lib is unresolved " + lib, store.getChild(lib, true));
                            }
                        }
                    }
                }
            }
        }
    }

    final RunProcessCommand runProcessCommand = new RunProcessCommand(true);
    runProcessCommand.execute(ProcessSelector.createExecutionEvent((AbstractProcess) diagram.getElements().get(0)));
    assertThat(runProcessCommand.getUrl()).isNotNull();
    assertNotNull("There should be an application deployed and running for " + url,
            runProcessCommand.getUrl().getContent());
}
 
 类所在包
 同包方法