Skip to main content



      Home
Home » Eclipse Projects » GEF » Deleting an editpart
Deleting an editpart [message #77981] Tue, 06 May 2003 07:43 Go to next message
Eclipse UserFriend
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 #78030 is a reply to message #77981] Tue, 06 May 2003 14:35 Go to previous messageGo to next message
Eclipse UserFriend
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.

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
>
>
Re: Deleting an editpart [message #78092 is a reply to message #78030] Tue, 06 May 2003 15:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.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
> >
> >
>
>
Re: Deleting an editpart [message #78506 is a reply to message #78092] Thu, 08 May 2003 06:41 Go to previous messageGo to next message
Eclipse UserFriend
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
> > >
> > >
> >
> >
>
>
Re: Deleting an editpart [message #78607 is a reply to message #78506] Thu, 08 May 2003 10:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.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
> > > >
> > > >
> > >
> > >
> >
> >
>
>
Re: Deleting an editpart [message #80596 is a reply to message #78607] Fri, 23 May 2003 03:51 Go to previous message
Eclipse UserFriend
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
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
Previous Topic:Org Chart/Hierarchical Tree Layout for 2.2
Next Topic:Move Bendpoints With ManhattanConnection Router
Goto Forum:
  


Current Time: Fri May 09 15:12:57 EDT 2025

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

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

Back to the top