Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to open editor inside composite?
How to open editor inside composite? [message #248446] Tue, 21 April 2009 00:05 Go to next message
Oleg Vazhnev is currently offline Oleg VazhnevFriend
Messages: 42
Registered: July 2009
Member
Hi all

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.DiagramGraphicalVie wer
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().getActi vePage();
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);


Thanks,
Oleg
Re: How to open editor inside composite? [message #248489 is a reply to message #248446] Tue, 21 April 2009 22:40 Go to previous messageGo to next message
Oleg Vazhnev is currently offline Oleg VazhnevFriend
Messages: 42
Registered: July 2009
Member
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
- Composite

And 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...

Thanks,
Oleg

Oleg Vazhnev wrote:
> Hi all
>
> 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.DiagramGraphicalVie wer
> 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().getActi vePage();
> 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);
>
>
> Thanks,
> Oleg
Re: How to open editor inside composite? [message #248508 is a reply to message #248489] Wed, 22 April 2009 09:56 Go to previous message
Oleg Vazhnev is currently offline Oleg VazhnevFriend
Messages: 42
Registered: July 2009
Member
Finally I understood how to do my task! :)
I don't need to use editor at all
I just have to use GraphicalViewerImpl
It so simple. Just 5 lines of code!
I've spent 3 days to write 5 lines of code :)

But now it works
For those who are interested it looks like that.
http://www.picamatic.com/view/3364352_bpel/
Previous Topic:[Announce] GEF 3.5.0 I200904211344 is available
Next Topic:[Zest] setText of connection with GraphViewer
Goto Forum:
  


Current Time: Fri Apr 26 17:06:09 GMT 2024

Powered by FUDForum. Page generated in 0.02605 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top