Deleting an editpart [message #77981] |
Tue, 06 May 2003 07:43  |
Eclipse User |
|
|
|
Hi,
I have followed the Logic example when trying to implement the delete
functionality. Unfortunatley I've encountered a problem:
I have a ContextMenuProvider implementation and in its buildContextMenu()
method I check if the deleteAction.isEnabled(). The answer is no, and I
cannot obviously delete the selected editPart!! The deleteAction.isEnabled()
method returns false if there is no DeleteCommand created, and the
DeleteCommand is not created if there is nothing selected in the view...but
I can see with my own eyes that an editpart really is selected. Where is the
selection event caught or registered?
On my editpart I have set an editpolicy with the EditPolicy.COMPONENT_ROLE.
When right clicking on an editpart the DeleteCommand is created but in the
same time the opposite is reality when I check the deleteAction.isEnabled()
in the ContextMenuProvider implementation. I'm confused.
What should I do to make sure that the DeleteCommand is created on right
click selection so that the deleteAction really is enabled?
Thanks in advance.
/Stefan
|
|
|
|
|
|
|
Re: Deleting an editpart [message #80596 is a reply to message #78607] |
Fri, 23 May 2003 03:51  |
Eclipse User |
|
|
|
The behavior I've experienced is a stack overflow which in turn crashes the
workbench.
I am now calling init only once and that has solved the problem.
Thanks
"Randy Hudson" <none@us.ibm.com> wrote in message
news:b9dq54$1mi$1@rogue.oti.com...
> calling init(site, input) more than once is not proper use of that API.
The
> behavior is undefined.
>
> "Stefan Junsved" <stefan.junsved@comactivity.net> wrote in message
> news:b9dc9i$lg7$1@rogue.oti.com...
> > Finally it works. The problem was that I didn't call the init(site,
input)
> > method on
> > the GEF editor when switching to that page. I do that now from the
> > pageChange() method in the MPE.
> >
> > "Randy Hudson" <none@us.ibm.com> wrote in message
> > news:b992pl$oqt$1@rogue.oti.com...
> > > The normal chain of events are:
> > >
> > > 1) User opens GraphicalEditor
> > > 2a) Editor registers GraphicalViewer as the selection provider into
the
> > > Selection Service.
> > > 2b) Editor adds itself as listener to selection service.
> > > 2c) Editor registers its internal DeleteAction as the global action
> > handler
> > > for "Delete"
> > > 3) User selected editpart
> > > 4) graphical editor receives notification from selection service, and
> > calls
> > > update() on the DeleteAction, which then calculates enablement.
> > >
> > > "Stefan Junsved" <stefan.junsved@comactivity.net> wrote in message
> > > news:b98va6$m2g$1@rogue.oti.com...
> > > > After some time of serious debugging I have come to the following
> > > > conclusion:
> > > >
> > > > First the Logic example. When initializing the logic editor it is
> > > registered
> > > > as an ISelectionChangedListener in the AbstractEditPartViewer class.
> > When
> > > > selections are made in the logic edtior, the AbstractEditPartViewer
> > loops
> > > > over its listeners and notifies them.
> > > >
> > > > My implementation. I have pretty much followed the logic example but
> my
> > > > implementation differs on one point. My "GEF editor" is one page
among
> > > many
> > > > in a MultiPageEditor. It seems as if the GEF editor in that page
isn't
> > > > registered as an ISelectionChangedListener. On the other hand I
think
> > that
> > > > the MultiPageEditor is. That should do it but it doesn't.
> > >
> > > Then it sounds like your nested graphicaleditor is not calling update
on
> > the
> > > DeleteAction.
> > >
> > > > My previous question has changed somewhat though I still have the
same
> > > > problem. Creating a delete command on a selection event in the GEF
> > editor
> > > > never happens since I haven't been able to register the editor at
all.
> > > >
> > > > /Stefan
> > > >
> > > > "Stefan Junsved" <stefan.junsved@comactivity.net> wrote in message
> > > > news:b9874o$1g6$1@rogue.oti.com...
> > > > > Hi,
> > > > >
> > > > > I have followed the Logic example when trying to implement the
> delete
> > > > > functionality. Unfortunatley I've encountered a problem:
> > > > >
> > > > > I have a ContextMenuProvider implementation and in its
> > > buildContextMenu()
> > > > > method I check if the deleteAction.isEnabled(). The answer is no,
> and
> > I
> > > > > cannot obviously delete the selected editPart!! The
> > > > deleteAction.isEnabled()
> > > > > method returns false if there is no DeleteCommand created, and the
> > > > > DeleteCommand is not created if there is nothing selected in the
> > > > view...but
> > > > > I can see with my own eyes that an editpart really is selected.
> Where
> > is
> > > > the
> > > > > selection event caught or registered?
> > > > >
> > > > > On my editpart I have set an editpolicy with the
> > > > EditPolicy.COMPONENT_ROLE.
> > > > > When right clicking on an editpart the DeleteCommand is created
but
> in
> > > the
> > > > > same time the opposite is reality when I check the
> > > > deleteAction.isEnabled()
> > > > > in the ContextMenuProvider implementation. I'm confused.
> > > > >
> > > > > What should I do to make sure that the DeleteCommand is created on
> > right
> > > > > click selection so that the deleteAction really is enabled?
> > > > >
> > > > > Thanks in advance.
> > > > >
> > > > > /Stefan
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.28868 seconds