Home » Eclipse Projects » GEF » GEF and MultiPageEditorPart
GEF and MultiPageEditorPart [message #168231] |
Mon, 14 February 2005 13:26  |
Eclipse User |
|
|
|
Originally posted by: sinleeh.hotmail.com
Dear All,
I am using GEF editor in as a page in the multiPageEditorPart. When
tackling a problem with MySelectionAction not being informed about
selection event, and with the clue provided by Randy Hudson,about
GraphicalEditor#selectionChanged (thanks Randy), I finally figured out
that the problem is about Workbench Event not reaching the correct editors.
I dealt with the issue of selectionChanged() by making my
MultiPageEditorPart rebroadcast the appropriate selection event with my
GEF Editor as the IWorkbenchPart.
Lately I have to overwrite commandStackChanged() from my GEF editor to my
MultiPageEditorPart to get the workbench to realize that I had made
changes to my GEF editor.
All these allow me to learn a lot about Eclipse Platform and GEF. That's
great. But for a newbie, I am wondering whether:
(1)Is there any convension for using GEF inside a MutliPageEditorPart.
Particularly with respect to the rebroadcast of events from
MultiPageEditorPart to GEF Editor and vice-versa.
(2)Does anyone know what other events I must be aware of that might need
rebroadcasting? It takes sometime to figure out the SelectionEvent case
and it would be nice to have a "watch out" list.
Thanking you all in advance and best regards,
sinleeh
|
|
|
Re: GEF and MultiPageEditorPart [message #168237 is a reply to message #168231] |
Mon, 14 February 2005 14:04   |
Eclipse User |
|
|
|
Sinleeh wrote:
> Dear All,
>
> I am using GEF editor in as a page in the multiPageEditorPart. When
> tackling a problem with MySelectionAction not being informed about
> selection event, and with the clue provided by Randy Hudson,about
What kind of clue?
/me is really interested as well ;)
> GraphicalEditor#selectionChanged (thanks Randy), I finally figured out
> that the problem is about Workbench Event not reaching the correct
> editors.
>
> I dealt with the issue of selectionChanged() by making my
> MultiPageEditorPart rebroadcast the appropriate selection event with my
> GEF Editor as the IWorkbenchPart.
>
> Lately I have to overwrite commandStackChanged() from my GEF editor to my
> MultiPageEditorPart to get the workbench to realize that I had made
> changes to my GEF editor.
>
> All these allow me to learn a lot about Eclipse Platform and GEF. That's
> great. But for a newbie, I am wondering whether:
> (1)Is there any convension for using GEF inside a MutliPageEditorPart.
> Particularly with respect to the rebroadcast of events from
> MultiPageEditorPart to GEF Editor and vice-versa.
> (2)Does anyone know what other events I must be aware of that might need
> rebroadcasting? It takes sometime to figure out the SelectionEvent case
> and it would be nice to have a "watch out" list.
>
> Thanking you all in advance and best regards,
> sinleeh
Hi,
I'm using GEF inside a MultiPageEditorPart as well and I'm having a whole
lot of similar problems.
When switching Editors, the Outline and Palette (as long as not used as
flyout palette) are not updated correctly - more exactly, the palette is
updated but as soon as I click on the palette it reverts to the first
palette created.
The paletteViewer is keeping/caching a map of editor palettes I believe, and
for editors inside a MultiPageEditorPart, the MultiPageEditorPart is used
as reference.
My current workaround is to use a flyout palette....
Also, the zoomManager's ComboBox in the ToolBar is not updated when I switch
between editors,....
Do you have a more complete list or code snippets of what you had to do, to
get it working?
I'm really thankful for any hints, b/c this is really annoying me for some
time now.
Thanks a lot!
Fabian
|
|
|
Re: GEF and MultiPageEditorPart [message #168358 is a reply to message #168237] |
Tue, 15 February 2005 11:20   |
Eclipse User |
|
|
|
Originally posted by: sinleeh.nowhere.com
Dear Fabian,
My project is not at such an advance stage as you yet so sorry I cannot
offer any help. I hope someone can help us both. Sooner or later I have to
deal with the same problem as yours. I am posting some code here, mainly
derived from LogicExample to solve the selection event problem. It might
not be the most elegant solution.
Fabian Wolf wrote:
> Sinleeh wrote:
>> Dear All,
>>
>> I am using GEF editor in as a page in the multiPageEditorPart. When
>> tackling a problem with MySelectionAction not being informed about
>> selection event, and with the clue provided by Randy Hudson,about
> What kind of clue?
> /me is really interested as well ;)
>> GraphicalEditor#selectionChanged (thanks Randy), I finally figured out
>> that the problem is about Workbench Event not reaching the correct
>> editors.
>>
GraphicalEditor#selectionChanged was the clue to the problem. The problem
was SelectionAction.getSelectedObjects() do not seems to contain the
selected object.
Basically, there is two problems here. First, the MultiPageEditorPart do
not listen to selection events. Second, UpdateActions() inside Graphical
Editor check for this.equals(getSite().getPage().getActiveEditor()). The
parameter section will always return MultiPageEditorPart.
To solve it, I added it as a selection listener to the workbench
following the style of the LogicEditor. After that, I did a quick check at
selectionChanged() in MyMultiPageEditorPart I see that I actually captured
the selection event. Then, I have to transmit the selection event to the
GraphicalEditor. To do this, I check that my GraphicalEditor is the active
page and if so, resent the selection event with the IWorkbenchPart set to
the GraphicalEditor.
Second, I overloaded selectionChanged(IWorkbenchPart, Iselection) in my
GraphicalEditor so that if this.equals(IWorkbenchPart) it calls
updateAction as well. In short:
In MyMultiPageEditor
//remember to add this editor as selection listener to the worbench!!
public void init(IEditorSite site, IEditorInput editorInput) {
//....
getSite().getWorkbenchWindow().getSelectionService().addSele ctionListener(this);
} //and remember to remove it from the selection service in dispose()
//Propergate selection event to MyGraphicalEditor if necesary
public void selectionChanged(IWorkbenchPart part, ISelection
selection) {
if (this.equals(getSite().getPage().getActiveEditor())){
if(MyGraphicalEditor.equals(getActiveEditor()))
MyGraphicalEditor.selectionChanged(getActiveEditor(),
selection);
}
}
In MyGraphicalEditor
public void selectionChanged(IWorkbenchPart part, ISelection
selection) {
super.selectionChanged(part, selection);
if(this.equals(part)) { //Propagated from MyMultiPageEditor.
updateActions(getSelectionActions());
}
}
[snip]
> Do you have a more complete list or code snippets of what you had to do, to
> get it working?
> I'm really thankful for any hints, b/c this is really annoying me for some
> time now.
Hopefully someone will have wade a magic wand and our problems are
solved!!!
As you can see, my solution only works for SelectionEvent. I'm sure there
are tons of other events that I have to listen properly too.
I currenly have problem with PrintAction() in the sense that it cannot
find anything to print. I thought it was a selection event problem but the
solution above did not solve it.
Best regards,
Sinleeh
|
|
|
Re: GEF and MultiPageEditorPart [message #168373 is a reply to message #168358] |
Tue, 15 February 2005 14:46   |
Eclipse User |
|
|
|
Sinleeh wrote:
> [...]
> Basically, there is two problems here. First, the MultiPageEditorPart do
> not listen to selection events. Second, UpdateActions() inside Graphical
> Editor check for this.equals(getSite().getPage().getActiveEditor()). The
> parameter section will always return MultiPageEditorPart.
>
> To solve it, I added it as a selection listener to the workbench
> following the style of the LogicEditor. After that, I did a quick check at
> selectionChanged() in MyMultiPageEditorPart I see that I actually captured
> the selection event. Then, I have to transmit the selection event to the
> GraphicalEditor. To do this, I check that my GraphicalEditor is the active
> page and if so, resent the selection event with the IWorkbenchPart set to
> the GraphicalEditor.
> [...]
> In MyGraphicalEditor
>
> public void selectionChanged(IWorkbenchPart part, ISelection
> selection) {
> super.selectionChanged(part, selection);
> if(this.equals(part)) { //Propagated from MyMultiPageEditor.
> updateActions(getSelectionActions());
> }
> }
> [snip]
Dear Sinleeh,
you were really helpful! Not that it solved my palette or outline
problems,.. but the part/quote above solved a problem with my Alignment
Retarget Actions that were not working (as posted to this group
<cuqtd4$6tc$1@www.eclipse.org>).
Those are now working! Thanks a lot!
Best regards,
Fabian
|
|
|
Re: GEF and MultiPageEditorPart [message #168524 is a reply to message #168373] |
Wed, 16 February 2005 10:16  |
Eclipse User |
|
|
|
Originally posted by: sinleeh.nowhere.com
Glad I could help. For your pallete/outline view problem, using the same
analogy, I probably check that the appropriate events are
transmitted/capture. Depending on implementation, looking at who calls
getAdapter() might help for the outline view.
Sorry I cannot help you here as my project haven't reach this stage
(pallete/outline view) yet. If you have a working solution for
PrintAction(), please share it coz I am having problems with it.
Thanks,
Sinleeh
|
|
|
Goto Forum:
Current Time: Mon May 12 15:21:45 EDT 2025
Powered by FUDForum. Page generated in 0.04169 seconds
|