how to delete element in a MultiPageEditorPart [message #210616] |
Thu, 02 March 2006 08:33 |
Eclipse User |
|
|
|
Originally posted by: patricktessier.orange.fr
Hi,
I would like to use delete action with a multiPageEditorPart.
so
I have create EditorContextMenuProvider in which i have write:
action = getActionRegistry().getAction(ActionFactory.DELETE.getId());
if (action.isEnabled())
menu.appendToGroup(GEFActionConstants.GROUP_EDIT, action);
But the "action.isEnabled" return always false whereas in a simple editor
it runs.
What have to do?
Thanks
|
|
|
Re: how to delete element in a MultiPageEditorPart [message #210800 is a reply to message #210616] |
Mon, 06 March 2006 11:05 |
Eclipse User |
|
|
|
Originally posted by: ingo.koch[nospam].sap.com
You have to update the selection actions of your sub editor.
There?s already a thread in this newsgroup.
"Patrick" <patricktessier@orange.fr> wrote in message
news:0d487570ad37034882e303bb92583707$1@www.eclipse.org...
> Hi,
>
> I would like to use delete action with a multiPageEditorPart.
> so
> I have create EditorContextMenuProvider in which i have write:
>
>
> action = getActionRegistry().getAction(ActionFactory.DELETE.getId());
> if (action.isEnabled())
> menu.appendToGroup(GEFActionConstants.GROUP_EDIT, action);
>
> But the "action.isEnabled" return always false whereas in a simple editor
> it runs.
> What have to do?
>
> Thanks
>
|
|
|
Re: how to delete element in a MultiPageEditorPart [message #210806 is a reply to message #210800] |
Mon, 06 March 2006 11:09 |
Eclipse User |
|
|
|
Originally posted by: ingo.koch[nospam].sap.com
Here you go:
<cite>
What I had to do additionally was
1. to register the MultipageEditor as SelectionListener.
getSite().getWorkbenchWindow().getSelectionService().addSele ctionListener(th
is);
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());
}
}
"Ingo Koch" <ingo.koch[nospam]@sap.com> wrote in message
news:duh51k$uh2$1@eclipse.org...
> You have to update the selection actions of your sub editor.
> There?s already a thread in this newsgroup.
>
>
>
> "Patrick" <patricktessier@orange.fr> wrote in message
> news:0d487570ad37034882e303bb92583707$1@www.eclipse.org...
> > Hi,
> >
> > I would like to use delete action with a multiPageEditorPart.
> > so
> > I have create EditorContextMenuProvider in which i have write:
> >
> >
> > action = getActionRegistry().getAction(ActionFactory.DELETE.getId());
> > if (action.isEnabled())
> > menu.appendToGroup(GEFActionConstants.GROUP_EDIT, action);
> >
> > But the "action.isEnabled" return always false whereas in a simple
editor
> > it runs.
> > What have to do?
> >
> > Thanks
> >
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.02829 seconds