Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to make a delete menu enabled?
How to make a delete menu enabled? [message #180541] Fri, 06 May 2005 23:51 Go to next message
Eclipse UserFriend
Originally posted by: eri_cao_apex.yahoo.com

Hi,

I had a strange problem with enabling the delete context menu in a
GraphicalEditorWithFlyoutPalette. All editParts inside this editor install a
policy that creates deleteCommand for the EditPolicy.COMPONENT_ROLE. A
context menu of undo/redo/delete is set up with the graphicalViewer.

However, when a figure in this graphical viewer is selected and
right-clicked, the delete menu is not enabled. If I drag the figures around,
the undo/redo menu is enabled, but not for the delete menu.

I even override createActions() in the editor and create a customized
DeleteAction that returns true for the calculateEnabled() function. It still
doesn't change anything. One thing is that this
GraphicalEditorWithFlyoutPalette is in a page of a MultiPageEditorPart. I
don't know if that makes any difference. Does anyone know how GEF determine
if a context menu should be enabled or not? Any suggestions are very
welcome.

Thanks,

Eric
Re: How to make a delete menu enabled? [message #180621 is a reply to message #180541] Mon, 09 May 2005 15:05 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
Your editor's most probably not firing workbench selection changes properly.
When you switch to the page containing the GEF-based editor, the graphical
viewer should be set as the selection provider for the site. This is
probably not working for you because you're using a MPE. Look at
GraphicalEditor#hookGraphicalViewer().

"Eric Cao" <eri_cao_apex@yahoo.com> wrote in message
news:d5h0a5$7dp$1@news.eclipse.org...
> Hi,
>
> I had a strange problem with enabling the delete context menu in a
> GraphicalEditorWithFlyoutPalette. All editParts inside this editor install
a
> policy that creates deleteCommand for the EditPolicy.COMPONENT_ROLE. A
> context menu of undo/redo/delete is set up with the graphicalViewer.
>
> However, when a figure in this graphical viewer is selected and
> right-clicked, the delete menu is not enabled. If I drag the figures
around,
> the undo/redo menu is enabled, but not for the delete menu.
>
> I even override createActions() in the editor and create a customized
> DeleteAction that returns true for the calculateEnabled() function. It
still
> doesn't change anything. One thing is that this
> GraphicalEditorWithFlyoutPalette is in a page of a MultiPageEditorPart. I
> don't know if that makes any difference. Does anyone know how GEF
determine
> if a context menu should be enabled or not? Any suggestions are very
> welcome.
>
> Thanks,
>
> Eric
>
>
Re: How to make a delete menu enabled? [message #180645 is a reply to message #180621] Mon, 09 May 2005 16:30 Go to previous message
Eclipse UserFriend
Originally posted by: eri_cao_apex.yahoo.com

Thanks Pratik, it helps a lot.

It is working now. The selection firing part is ok, the problem is the
selection handling. In the GraphicalEditor#selectionChanged(...), it tries
to check if the current editor (GraphicalEditorWithFlyoutPalette) is the
same as the ActiveEditor(MPE), which always fails in this case. After I
override this method in the GraphicalEditorWithFlyoutPalette editor, it
makes the actions get updated properly, and the delete menu is enabled.

Cheers,

Eric


"Pratik Shah" <ppshah@us.ibm.com> wrote in message
news:d5nul5$9kc$1@news.eclipse.org...
> Your editor's most probably not firing workbench selection changes
> properly.
> When you switch to the page containing the GEF-based editor, the graphical
> viewer should be set as the selection provider for the site. This is
> probably not working for you because you're using a MPE. Look at
> GraphicalEditor#hookGraphicalViewer().
>
> "Eric Cao" <eri_cao_apex@yahoo.com> wrote in message
> news:d5h0a5$7dp$1@news.eclipse.org...
>> Hi,
>>
>> I had a strange problem with enabling the delete context menu in a
>> GraphicalEditorWithFlyoutPalette. All editParts inside this editor
>> install
> a
>> policy that creates deleteCommand for the EditPolicy.COMPONENT_ROLE. A
>> context menu of undo/redo/delete is set up with the graphicalViewer.
>>
>> However, when a figure in this graphical viewer is selected and
>> right-clicked, the delete menu is not enabled. If I drag the figures
> around,
>> the undo/redo menu is enabled, but not for the delete menu.
>>
>> I even override createActions() in the editor and create a customized
>> DeleteAction that returns true for the calculateEnabled() function. It
> still
>> doesn't change anything. One thing is that this
>> GraphicalEditorWithFlyoutPalette is in a page of a MultiPageEditorPart. I
>> don't know if that makes any difference. Does anyone know how GEF
> determine
>> if a context menu should be enabled or not? Any suggestions are very
>> welcome.
>>
>> Thanks,
>>
>> Eric
>>
>>
>
>
Previous Topic:A problem about DND in GEF TreeViewer
Next Topic:sharing objects between models
Goto Forum:
  


Current Time: Thu Apr 25 22:45:50 GMT 2024

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

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

Back to the top