Delete in context menu won't work [message #209111] |
Sat, 11 February 2006 12:39 |
Eclipse User |
|
|
|
Originally posted by: dutz.c-ware.de
Hi,
I am having a very strange problem with my GEF editor. For example in my
connection editpart I configure everything to allow deletions using the
folowing code:
installEditPolicy(EditPolicy.CONNECTION_ROLE,
new ConnectionEditPolicy() {
protected Command getDeleteCommand(GroupRequest request) {
return new ConnectionDeleteCommand(getCastedModel());
}
});
If I comment this out, the "delete" Context-Menu entry disapears.
Unfortunately the entry is gay and can't be selected. Normally when I select
a new edit part the getDeleteCommand is called automatically in this case it
is not. What could be wrong here? So I have to toggle any switch? My Editor
is a MultipageEditor containing a GEF editor as one of its Pages.
Tanks in advance,
Chris
|
|
|
Re: Delete in context menu won't work [message #209211 is a reply to message #209111] |
Mon, 13 February 2006 09:36 |
Eclipse User |
|
|
|
Originally posted by: ingo.koch[nospam].sap.com
"Christofer Dutz" <dutz@c-ware.de> wrote in message
news:dsklut$ga1$1@utils.eclipse.org...
> Hi,
Hi!
>
> I am having a very strange problem with my GEF editor. For example in my
> connection editpart I configure everything to allow deletions using the
> folowing code:
>
> installEditPolicy(EditPolicy.CONNECTION_ROLE,
> new ConnectionEditPolicy() {
> protected Command getDeleteCommand(GroupRequest request) {
> return new ConnectionDeleteCommand(getCastedModel());
> }
> });
>
> If I comment this out, the "delete" Context-Menu entry disapears.
> Unfortunately the entry is gay and can't be selected.
What a pity... a severe loss for all women...:-)
>Normally when I select
> a new edit part the getDeleteCommand is called automatically in this case
it
> is not. What could be wrong here? So I have to toggle any switch? My
Editor
> is a MultipageEditor containing a GEF editor as one of its Pages.
>
....the usual problem with MPEs. Well, you have to propagate selection
changes in the multipage editor
to your gef sub editor:
1. MPE should implement ISelectionListener
2. add something like this to your MPE:
public void selectionChanged(IWorkbenchPart part, ISelection selection)
{
ISelectionListener listener = (ISelectionListener)myGEFEditor;
listener.selectionChanged(part, selection);
}
Your GEF editor should now update its selection actions.
> Tanks in advance,
> Chris
>
>
Regards, Ingo
|
|
|
Re: Delete in context menu won't work [message #209520 is a reply to message #209211] |
Wed, 15 February 2006 19:17 |
Eclipse User |
|
|
|
Originally posted by: dutz.c-ware.de
After 2 endles days of "no internet" becaue of isp-problems I finally couls
read yout tip. Thanks for your hint. It gave me a point in the right
direction.
What I had to do additionally was
1. to register the MultipageEditor as SelectionListener.
getSite().getWorkbenchWindow().getSelectionService().addSele ctionListener(this);
2. Implement the ISelectionListener allmost as you suggested:
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
if (this.equals(getSite().getPage().getActiveEditor())) {
if (netEditor.equals(getActiveEditor()))
netEditor.selectionChanged(getActiveEditor(), selection);
}
}
}
3. to override the selectionChanged method in my Editor.
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
super.selectionChanged(part, selection);
if (this.equals(part)) { // Propagated from MyMultiPageEditor.
updateActions(getSelectionActions());
}
}
Hope this helps anyone ...
Chris
"Ingo Koch" <ingo.koch[nospam]@sap.com> schrieb im Newsbeitrag
news:dspjvs$mji$1@utils.eclipse.org...
>
> "Christofer Dutz" <dutz@c-ware.de> wrote in message
> news:dsklut$ga1$1@utils.eclipse.org...
>> Hi,
>
> Hi!
>
>>
>> I am having a very strange problem with my GEF editor. For example in my
>> connection editpart I configure everything to allow deletions using the
>> folowing code:
>>
>> installEditPolicy(EditPolicy.CONNECTION_ROLE,
>> new ConnectionEditPolicy() {
>> protected Command getDeleteCommand(GroupRequest request) {
>> return new ConnectionDeleteCommand(getCastedModel());
>> }
>> });
>>
>> If I comment this out, the "delete" Context-Menu entry disapears.
>> Unfortunately the entry is gay and can't be selected.
>
> What a pity... a severe loss for all women...:-)
>
>>Normally when I select
>> a new edit part the getDeleteCommand is called automatically in this case
> it
>> is not. What could be wrong here? So I have to toggle any switch? My
> Editor
>> is a MultipageEditor containing a GEF editor as one of its Pages.
>>
>
> ...the usual problem with MPEs. Well, you have to propagate selection
> changes in the multipage editor
> to your gef sub editor:
> 1. MPE should implement ISelectionListener
> 2. add something like this to your MPE:
> public void selectionChanged(IWorkbenchPart part, ISelection selection)
> {
>
> ISelectionListener listener = (ISelectionListener)myGEFEditor;
> listener.selectionChanged(part, selection);
> }
>
> Your GEF editor should now update its selection actions.
>
>
>
>> Tanks in advance,
>> Chris
>>
>>
>
> Regards, Ingo
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.02064 seconds