use of org.eclipse.ui.PartInitException in project archi by archimatetool.
the class CheckForNewVersionAction method run.
@Override
public void run() {
try {
URL url = new URL(versionFile);
String newVersion = getOnlineVersion(url);
// Get this app's main version number
String thisVersion = System.getProperty(Application.APPLICATION_VERSIONID);
if (StringUtils.compareVersionNumbers(newVersion, thisVersion) > 0) {
boolean reply = MessageDialog.openQuestion(null, Messages.CheckForNewVersionAction_1, Messages.CheckForNewVersionAction_2 + " (" + newVersion + // $NON-NLS-1$ //$NON-NLS-2$
"). " + Messages.CheckForNewVersionAction_3);
if (reply) {
IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
IWebBrowser browser = support.getExternalBrowser();
if (browser != null) {
URL url2 = new URL(downloadPage);
browser.openURL(url2);
}
}
} else {
MessageDialog.openInformation(null, Messages.CheckForNewVersionAction_1, Messages.CheckForNewVersionAction_4);
}
} catch (MalformedURLException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
showErrorMessage(Messages.CheckForNewVersionAction_5);
return;
} catch (PartInitException ex) {
ex.printStackTrace();
}
}
use of org.eclipse.ui.PartInitException in project xtext-eclipse by eclipse.
the class ClassFileBasedOpenerContributor method collectSourceFileOpeners.
@Override
public boolean collectSourceFileOpeners(IEditorPart editor, IAcceptor<FileOpener> acceptor) {
if (!(editor instanceof XtextEditor) && editor.getEditorInput() != null) {
try {
IClassFile classFile = (IClassFile) editor.getEditorInput().getAdapter(IClassFile.class);
if (classFile == null) {
return false;
}
ITrace trace = traceForTypeRootProvider.getTraceToSource(classFile);
if (trace == null) {
return false;
}
for (ILocationInResource location : trace.getAllAssociatedLocations()) {
String name = location.getAbsoluteResourceURI().getURI().lastSegment();
IEditorDescriptor editorDescriptor = IDE.getEditorDescriptor(name);
acceptor.accept(createEditorOpener(editor.getEditorInput(), editorDescriptor.getId()));
return true;
}
} catch (PartInitException e) {
LOG.error(e.getMessage(), e);
}
}
return false;
}
use of org.eclipse.ui.PartInitException in project xtext-eclipse by eclipse.
the class MultiPageEditor method createXtextPage.
void createXtextPage() {
try {
Injector injector = org.eclipse.xtext.ui.tests.internal.TestsActivator.getInstance().getInjector("org.eclipse.xtext.ui.tests.TestLanguage");
editor = injector.getInstance(XtextEditor.class);
int index = addPage(editor, getEditorInput());
setPageText(index, editor.getTitle());
} catch (PartInitException e) {
ErrorDialog.openError(getSite().getShell(), "Error creating nested text editor", null, e.getStatus());
}
}
use of org.eclipse.ui.PartInitException in project xtext-eclipse by eclipse.
the class TypeResourceUnloaderTest method testCloseAndReopenEditor.
@Test
public void testCloseAndReopenEditor() throws InterruptedException, PartInitException, JavaModelException {
waitForEvent(new Procedure0() {
@Override
public void apply() {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeEditor(editor, false);
try {
editor = JavaUI.openInEditor(compilationUnit);
} catch (PartInitException e) {
fail(e.getMessage());
} catch (JavaModelException e) {
fail(e.getMessage());
}
}
});
assertNull(event);
}
use of org.eclipse.ui.PartInitException in project xtext-eclipse by eclipse.
the class GlobalURIEditorOpener method openDefaultEditor.
protected IEditorPart openDefaultEditor(URI uri, EReference crossReference, int indexInList, boolean select) {
Iterator<Pair<IStorage, IProject>> storages = mapper.getStorages(uri.trimFragment()).iterator();
if (storages != null && storages.hasNext()) {
try {
IStorage storage = storages.next().getFirst();
IEditorPart editor = null;
if (storage instanceof IFile) {
editor = openDefaultEditor((IFile) storage);
} else {
editor = openDefaultEditor(storage, uri);
}
selectAndReveal(editor, uri, crossReference, indexInList, select);
return editor;
} catch (WrappedException e) {
logger.error("Error while opening editor part for EMF URI '" + uri + "'", e.getCause());
} catch (PartInitException partInitException) {
logger.error("Error while opening editor part for EMF URI '" + uri + "'", partInitException);
}
}
return null;
}
Aggregations