本文整理匯總了Java中org.eclipse.ui.PartInitException類的典型用法代碼示例。如果您正苦於以下問題:Java PartInitException類的具體用法?Java PartInitException怎麽用?Java PartInitException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PartInitException類屬於org.eclipse.ui包,在下文中一共展示了PartInitException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: init
import org.eclipse.ui.PartInitException; //導入依賴的package包/類
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
if (!(input instanceof ProjectEditorInput)) {
throw new PartInitException(Messages.ProjectEditorDiffer_error_bad_input_type);
}
ProjectEditorInput in = (ProjectEditorInput) input;
Exception ex = in.getError();
if (ex != null) {
throw new PartInitException(in.getError().getLocalizedMessage(), ex);
}
setInput(input);
setSite(site);
setPartName(in.getName());
proj = new PgDbProject(in.getProject());
sp = new ProjectEditorSelectionProvider(proj.getProject());
// message box
if(!site.getPage().getPerspective().getId().equals(PERSPECTIVE.MAIN)){
askPerspectiveChange(site);
}
getSite().setSelectionProvider(sp);
}
示例2: openOutlineView
import org.eclipse.ui.PartInitException; //導入依賴的package包/類
protected void openOutlineView() throws PartInitException, InterruptedException {
outlineView = editor.getEditorSite().getPage().showView("org.eclipse.ui.views.ContentOutline");
executeAsyncDisplayJobs();
Object adapter = editor.getAdapter(IContentOutlinePage.class);
assertTrue(adapter instanceof OutlinePage);
outlinePage = new SyncableOutlinePage((OutlinePage) adapter);
outlinePage.resetSyncer();
try {
outlinePage.waitForUpdate(EXPECTED_TIMEOUT);
} catch (TimeoutException e) {
System.out.println("Expected timeout exceeded: " + EXPECTED_TIMEOUT);// timeout is OK here
}
treeViewer = outlinePage.getTreeViewer();
assertSelected(treeViewer);
assertExpanded(treeViewer);
assertTrue(treeViewer.getInput() instanceof IOutlineNode);
IOutlineNode rootNode = (IOutlineNode) treeViewer.getInput();
List<IOutlineNode> children = rootNode.getChildren();
assertEquals(1, children.size());
modelNode = children.get(0);
}
示例3: openXMLSequenceEditor
import org.eclipse.ui.PartInitException; //導入依賴的package包/類
public void openXMLSequenceEditor(IProject project) {
Sequence sequence = getObject();
IFile file = project.getFile("_private/"+sequence.getName()+".xml");
IWorkbenchPage activePage = PlatformUI
.getWorkbench()
.getActiveWorkbenchWindow()
.getActivePage();
if (activePage != null) {
try {
activePage.openEditor(new XMLSequenceEditorInput(file,sequence),
"com.twinsoft.convertigo.eclipse.editors.xml.XMLSequenceEditor");
}
catch(PartInitException e) {
ConvertigoPlugin.logException(e, "Error while loading the step editor '" + sequence.getName() + "'");
}
}
}
示例4: openInbuiltOperationClass
import org.eclipse.ui.PartInitException; //導入依賴的package包/類
private void openInbuiltOperationClass(String operationName, PropertyDialogButtonBar propertyDialogButtonBar) {
String operationClassName = null;
Operations operations = XMLConfigUtil.INSTANCE.getComponent(FilterOperationClassUtility.INSTANCE.getComponentName())
.getOperations();
List<TypeInfo> typeInfos = operations.getStdOperation();
for (int i = 0; i < typeInfos.size(); i++) {
if (typeInfos.get(i).getName().equalsIgnoreCase(operationName)) {
operationClassName = typeInfos.get(i).getClazz();
break;
}
}
propertyDialogButtonBar.enableApplyButton(true);
javaProject = FilterOperationClassUtility.getIJavaProject();
if (javaProject != null) {
try {
IType findType = javaProject.findType(operationClassName);
JavaUI.openInEditor(findType);
} catch (JavaModelException | PartInitException e) {
Status status = new Status(IStatus.ERROR, Activator.PLUGIN_ID,Messages.CLASS_NOT_EXIST,null);
StatusManager.getManager().handle(status, StatusManager.BLOCK);
logger.error(e.getMessage(), e);
}
} else {
WidgetUtility.errorMessage(Messages.SAVE_JOB_MESSAGE);
}
}
示例5: testRunFinished
import org.eclipse.ui.PartInitException; //導入依賴的package包/類
/**
* Called when all tests have finished
*
* @param result
* the summary of the test run, including all the tests that failed
*/
@Override
public void testRunFinished(Result result) throws Exception {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
IWorkbenchWindow[] windows = N4IDEXpectUIPlugin.getDefault().getWorkbench().getWorkbenchWindows();
try {
N4IDEXpectView view = (N4IDEXpectView) windows[0].getActivePage().showView(
N4IDEXpectView.ID);
view.notifySessionFinished();
} catch (PartInitException e) {
N4IDEXpectUIPlugin.logError("cannot refresh test view window", e);
}
}
});
}
示例6: testFinished
import org.eclipse.ui.PartInitException; //導入依賴的package包/類
/**
* Called when an atomic test has finished, whether the test succeeds or fails.
*
* @param description
* the description of the test that just ran
*/
@Override
public void testFinished(Description description) throws Exception {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
IWorkbenchWindow[] windows = N4IDEXpectUIPlugin.getDefault().getWorkbench().getWorkbenchWindows();
try {
N4IDEXpectView view = (N4IDEXpectView) windows[0].getActivePage().showView(
N4IDEXpectView.ID);
view.notifyFinishedExecutionOf(description);
} catch (PartInitException e) {
N4IDEXpectUIPlugin.logError("cannot refresh test view window", e);
}
}
});
}
示例7: openXMLTransactionEditor
import org.eclipse.ui.PartInitException; //導入依賴的package包/類
public void openXMLTransactionEditor(IProject project) {
Transaction transaction = (Transaction)this.getObject();
IFile file = project.getFile("_private/"+transaction.getName()+".xml");
IWorkbenchPage activePage = PlatformUI
.getWorkbench()
.getActiveWorkbenchWindow()
.getActivePage();
if (activePage != null) {
try {
activePage.openEditor(new XMLTransactionEditorInput(file,transaction),
"com.twinsoft.convertigo.eclipse.editors.xml.XMLTransactionEditor");
} catch(PartInitException e) {
ConvertigoPlugin.logException(e, "Error while loading the transaction editor '" + transaction.getName() + "'");
}
}
}
示例8: execute
import org.eclipse.ui.PartInitException; //導入依賴的package包/類
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelectionChecked(event);
IWorkbenchWindow[] windows = N4IDEXpectUIPlugin.getDefault().getWorkbench().getWorkbenchWindows();
try {
view = (N4IDEXpectView) windows[0].getActivePage().showView(
N4IDEXpectView.ID);
} catch (PartInitException e) {
N4IDEXpectUIPlugin.logError("cannot refresh test view window", e);
}
Description desc = (Description) selection.getFirstElement();
if (desc.isTest() && view.testsExecutionStatus.hasFailed(desc)) {
Throwable failureException = view.testsExecutionStatus.getFailure(desc).getException();
if (failureException instanceof ComparisonFailure) {
ComparisonFailure cf = (ComparisonFailure) failureException;
// display comparison view
displayComparisonView(cf, desc);
}
}
return null;
}
示例9: getConnectorEditor
import org.eclipse.ui.PartInitException; //導入依賴的package包/類
public IEditorPart getConnectorEditor(Connector connector) {
IEditorPart editorPart = null;
IWorkbenchPage activePage = getActivePage();
if (activePage != null) {
if (connector != null) {
IEditorReference[] editorRefs = activePage.getEditorReferences();
for (int i=0;i<editorRefs.length;i++) {
IEditorReference editorRef = (IEditorReference)editorRefs[i];
try {
IEditorInput editorInput = editorRef.getEditorInput();
if ((editorInput != null) && (editorInput instanceof ConnectorEditorInput)) {
if (((ConnectorEditorInput)editorInput).is(connector)) {
editorPart = editorRef.getEditor(false);
break;
}
}
}
catch(PartInitException e) {
//ConvertigoPlugin.logException(e, "Error while retrieving the connector editor '" + editorRef.getName() + "'");
}
}
}
}
return editorPart;
}
示例10: init
import org.eclipse.ui.PartInitException; //導入依賴的package包/類
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
super.init(site, input);
setSite(site);
setPartName(input.getName());
setInputWithNotify(input);
site.setSelectionProvider(this);
if (getEditorInput() instanceof FileEditorInput) {
FileEditorInput fei = (FileEditorInput) getEditorInput();
IFile file = fei.getFile();
gWGraph = ResourceManager.load(file);
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
gWGraph.initialize(getGraphicalViewer().getEditPartRegistry());
if (!ResourceManager.isEditable(file)) {
gWGraph.setReadOnly(true);
getGraphicalViewer().getControl().setEnabled(false);
String title = MessageUtil.getString("conversion");
String message = MessageUtil.getString("not_formatted_as_json_convert_it");
DialogManager.displayWarning(title, message);
}
}
});
}
}
示例11: run
import org.eclipse.ui.PartInitException; //導入依賴的package包/類
@Override
public void run() {
if (isEnabled()) {
try {
ITextEditor editor = (ITextEditor) IDE.openEditor(
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(),
segment.getParentFile(), EDITOR.SQL, true);
editor.setHighlightRange(segment.offset, segment.length, true);
editor.selectAndReveal(segment.offset, segment.length);
} catch (PartInitException e) {
Log.log(e);
ExceptionNotifier.notifyDefault(Messages.PgNavigatorActionProvider_failed_to_open_editor, e);
}
}
}
示例12: getApplicationComponentEditor
import org.eclipse.ui.PartInitException; //導入依賴的package包/類
public IEditorPart getApplicationComponentEditor() {
IEditorPart editorPart = null;
IWorkbenchPage activePage = getActivePage();
if (activePage != null) {
IEditorReference[] editorRefs = activePage.getEditorReferences();
for (int i=0;i<editorRefs.length;i++) {
IEditorReference editorRef = (IEditorReference)editorRefs[i];
try {
IEditorInput editorInput = editorRef.getEditorInput();
if ((editorInput != null) && (editorInput instanceof ApplicationComponentEditorInput)) {
editorPart = editorRef.getEditor(false);
break;
}
}
catch(PartInitException e) {
//ConvertigoPlugin.logException(e, "Error while retrieving the connector editor '" + editorRef.getName() + "'");
}
}
}
return editorPart;
}
示例13: testCloseEditor
import org.eclipse.ui.PartInitException; //導入依賴的package包/類
@Test
public void testCloseEditor() throws Exception {
IJavaProject project = ProjectHelper.getOrCreateSimpleGW4EProject(PROJECT_NAME, true, true);
IFile impl = (IFile) ResourceManager
.getResource(project.getProject().getFullPath().append("src/test/java/SimpleImpl.java").toString());
Display.getDefault().syncExec(() -> {
try {
IWorkbenchWindow iww = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
ResourceManager.closeEditor(impl, iww);
} catch (PartInitException e) {
ResourceManager.logException(e);
}});
Waiter.waitUntil(new EditorClosedCondition("SimpleImpl.java"));
}
示例14: focusMarker
import org.eclipse.ui.PartInitException; //導入依賴的package包/類
public static void focusMarker(final IMarker marker) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
try {
IDE.openEditor(
MarkerActivator.getDefault().getWorkbench().getWorkbenchWindows()[0].getActivePage(),
marker);
} catch (final PartInitException e1) {
e1.printStackTrace();
}
}
});
}
示例15: getOpenEditorOfMarker
import org.eclipse.ui.PartInitException; //導入依賴的package包/類
/**
* Note: it compares marker's resource file name and open editors' file name.
*
* @param marker
* @return if marker's editor is open, return editor, else return null
*/
public static IEditorPart getOpenEditorOfMarker(final IMarker marker) {
final IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
for (final IWorkbenchWindow iWorkbenchWindow : windows) {
final IWorkbenchPage[] pages = iWorkbenchWindow.getPages();
for (final IWorkbenchPage iWorkbenchPage : pages) {
final IEditorReference[] editors = iWorkbenchPage.getEditorReferences();
for (final IEditorReference iEditorReference : editors) {
try {
if (iEditorReference instanceof IFileEditorInput) {
final IFileEditorInput input = (IFileEditorInput) iEditorReference.getEditorInput();
final IFile file = input.getFile();
// TODO Caused by: java.lang.NullPointerException when delete marker on ecore editor.
if (file.getFullPath().equals(marker.getResource().getFullPath())) {
return iEditorReference.getEditor(false);
}
}
} catch (final PartInitException e) {
e.printStackTrace();
}
}
}
}
return null;
}