Hi all
My name is Oleg, I'm writing advanced feature - visual comparison of BPEL files. I would like to use regular editors in "compare" panes (left and right) As a first step I just want to open two editors (one for each file) Later I can 'hack' them a little, make new parts green, deleted parts red etc...
So my problem sounds pretty simple I have: - Composite - Resource which describes .bpel file And I gotta to open default editor for this Resource in this Composite.
I would appreciate any tips or suggestions!
What did I tried:
I've spent couple days trying to deeper understand GEF, but after all I didn't found any simple solution for my simple problem.
People from another project used:
org.eclipse.gmf.runtime.notation.Diagram
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramGraphicalViewer
diagramGraphicalViewer.setContents(diagram)
but my editor is GEF-based, not GMF-based.
As far as I understood I can't just open editor in composite I have to use a lot of "extra" stuff - EditorManager, Workbrenchs, some sites etc. etc.
After all I wrote some straightforward code but it doesn't work. Likely I wrote it in absolutely wrong way, but let me quote it just to make clear what do I actually need.
File file2open = new File(new Path("/p1/name2.bpel"), (Workspace) BPELPlugin.getPlugin().getWorkspace()) { };
BPELMultipageEditorPart editorPart = new BPELMultipageEditorPart();
FileEditorInput editorInput = new FileEditorInput(file2open);
EditorDescriptor editorDescriptor = null;
try {
editorDescriptor = (EditorDescriptor)IDE.getEditorDescriptor(file2open);
} catch (PartInitException e) {
e.printStackTrace();
}
WorkbenchPage workbrenchpage = (WorkbenchPage) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
EditorSite editorSite = new EditorSite(new EditorReference(workbrenchpage.getEditorManager(), editorInput, editorDescriptor), editorPart, workbrenchpage, editorDescriptor);
try {
editorPart.init(editorSite, editorInput);
} catch (PartInitException e) {
e.printStackTrace();
}
editorPart.createPartControl(mycomposite);