tags:

views:

630

answers:

1

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);
A: 

No, there's no good way to open editor in GEF viewer. Keep in mind: 1. "Editor" is Eclipse platform concept. I.e. it is not just a widget but a whole infrastructure. As you said - you would need IEditorSite and so on. 2. GEF figures are "lightweight". You whole GraphicalViewer is a single SWT widget and figures are drawn on it - they don't have OS widgets backing them.

So if you really need to nest an editor in GEF viewer you would have to place the SWT composite on top of viewer and manage its placement.

Eugene
javapowered
Actually... I don't need complete editor.I just need a picture of the given Resource.I.e. I have- Resource (or EditorInput)- Editor ID- CompositeAnd I need to write a picture of this Resource in this Composite.I don't need complete editor, just a picture for the user.Probably this is easier task...
javapowered