How to make a delete menu enabled? [message #180541] |
Fri, 06 May 2005 23:51 |
Eclipse User |
|
|
|
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 #180645 is a reply to message #180621] |
Mon, 09 May 2005 16:30 |
Eclipse User |
|
|
|
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
>>
>>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.02889 seconds