Why is CompatibilityPart eating my PartInitException ? [message #1753320] |
Fri, 03 February 2017 18:53 |
Thomas Elskens Messages: 159 Registered: September 2014 Location: Brussels - Belgium |
Senior Member |
|
|
Hello,
I'm trying to integrate the subclipse plugin in my RCP application, but I have a problem when I try to open remote files with my home-made editors.
All these editors expect an IFileEditorInput, and not RemoteFileEditorInput.
So when the user double clicks on a file in the History View or in the remote repositories view, I would like he simple sees the raw text of the file.
Now this is something which is foreseen by the subclipse plugin : in the org.tigris.subversion.subclipse.ui.actions.OpenRemoteFileAction, the plugin looks for the default editor, tries to open it with a RemoteFileEditorInput. If the editor throws a PartInitException, subclipse simply invokes the default text editor and everything should work as a charm...
BUT, that may have worked fine in Eclipse 3.*, but now, in Eclipse 4.5 at least, all PartInitExceptions are catched by the Class CompatibilityPart, who opens an Error Message. Very ugly for my users...
I worked around this limitation by the following code in my Editor#init method, but it does not feel very clean :
if (editorInput instanceof RemoteFileEditorInput) {
try {
super.init(site, new NullEditorInput());
site.getPage().closeEditor(this, false);
} catch (Exception e) {
// this catches a bunch of NPE
} finally {
IWorkbenchPage page = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage();
try {
page.openEditor(editorInput,
"org.eclipse.ui.DefaultTextEditor");
} catch (PartInitException e) {
//
}
}
return;
Any ideas to cope in a better way with this problem ? Any input would be welcome!
Thomas Elskens
|
|
|
Powered by
FUDForum. Page generated in 0.02550 seconds