Skip to main content



      Home
Home » Eclipse Projects » GEF » Selection handles
Selection handles [message #74761] Mon, 07 April 2003 08:23 Go to next message
Eclipse UserFriend
I have simple container editpart (called ViewEditPart) that I use
as a RootEditParts contents (RootEditPart is FreeFormGraphicalRootEditPart).
Container editpart is kind a blank board where other editparts are. When I
change the RootEditParts contents with method setContents(), the selection
handles don't appear any more for editparts that are contained in
ViewEditPart.
The editparts do get activated but they don't respond to selections. Where
should
I start looking for bug? ViewEditPart uses ContainerPolicy, but I haven't
implemented
it's activate/deactivate - methods. Should I do something in these?
Re: Selection handles [message #74783 is a reply to message #74761] Mon, 07 April 2003 11:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Do your parts have a Resizable or NonResizableEditPolicy? Either or these
will add the relevant handles when the part is selected.

If you answered yes to the above, then it might be a hit-test problem.
These can be investigated by putting a breakpoint is
SelectionTool.mouseDown(MouseEvent), and stepping into
viewer.findObjectAt(...)

"Sami Lakka" <sami.lakka@tut.fi> wrote in message
news:b6rq7k$sa4$1@rogue.oti.com...
> I have simple container editpart (called ViewEditPart) that I use
> as a RootEditParts contents (RootEditPart is
FreeFormGraphicalRootEditPart).
> Container editpart is kind a blank board where other editparts are. When I
> change the RootEditParts contents with method setContents(), the selection
> handles don't appear any more for editparts that are contained in
> ViewEditPart.
> The editparts do get activated but they don't respond to selections. Where
> should
> I start looking for bug? ViewEditPart uses ContainerPolicy, but I haven't
> implemented
> it's activate/deactivate - methods. Should I do something in these?
>
>
>
>
>
Re: Selection handles [message #74835 is a reply to message #74783] Mon, 07 April 2003 14:52 Go to previous messageGo to next message
Eclipse UserFriend
I dugged in to the GEF code and found that
the problem is in mapVisualToEditPart-hashmap. This gets
cleared when FreeformGraphicalRootEditParts setContents-method
is called. But when new container editpart is set to the RootEditPart
the registerVisuals doesn't register editparts children to the
mapVisualToEditPart-hasmap.
I think the fix is quite simple for this; in registerVisuals-method iterate
the children and add them to hashmap.
I try this later.

- Sami

"Randy Hudson" <none@us.ibm.com> wrote in message
news:b6s6pg$8l5$1@rogue.oti.com...
> Do your parts have a Resizable or NonResizableEditPolicy? Either or these
> will add the relevant handles when the part is selected.
>
> If you answered yes to the above, then it might be a hit-test problem.
> These can be investigated by putting a breakpoint is
> SelectionTool.mouseDown(MouseEvent), and stepping into
> viewer.findObjectAt(...)
>
> "Sami Lakka" <sami.lakka@tut.fi> wrote in message
> news:b6rq7k$sa4$1@rogue.oti.com...
> > I have simple container editpart (called ViewEditPart) that I use
> > as a RootEditParts contents (RootEditPart is
> FreeFormGraphicalRootEditPart).
> > Container editpart is kind a blank board where other editparts are. When
I
> > change the RootEditParts contents with method setContents(), the
selection
> > handles don't appear any more for editparts that are contained in
> > ViewEditPart.
> > The editparts do get activated but they don't respond to selections.
Where
> > should
> > I start looking for bug? ViewEditPart uses ContainerPolicy, but I
haven't
> > implemented
> > it's activate/deactivate - methods. Should I do something in these?
> >
> >
> >
> >
> >
>
>
Re: Selection handles [message #74852 is a reply to message #74835] Mon, 07 April 2003 15:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

"Sami Lakka" <sami.lakka@tut.fi> wrote in message
news:b6sh3r$ind$1@rogue.oti.com...
> I dugged in to the GEF code and found that
> the problem is in mapVisualToEditPart-hashmap. This gets
> cleared when FreeformGraphicalRootEditParts setContents-method

What do you mean? What are setting the contents to? What were the contents
previously? If you have previous contents, which are getting removed, they
will all receive removeNotify() calls, which calls unregister(), which
removes the hashtable entry.

> is called. But when new container editpart is set to the RootEditPart

You should not be replacing the root. Could you please paste roughly the
code that you are executing?

> the registerVisuals doesn't register editparts children to the
> mapVisualToEditPart-hasmap.

If you replace the contents editpart, the root will call addChild(), which
calls addNotify(), which calls register(), which calls registerVisuals(),
which should map the figure->EditPart.

> I think the fix is quite simple for this; in registerVisuals-method
iterate
> the children and add them to hashmap.
> I try this later.
>
> - Sami
Re: Selection handles [message #74886 is a reply to message #74852] Tue, 08 April 2003 01:43 Go to previous messageGo to next message
Eclipse UserFriend
Ok,

in configureGraphicalViewer I create FreeformGraphicalRootEditPart. Its
contents is ViewEditPart that is a simple container editpart. ViewEditPart
is the
blank board in my application. The problem is that in my model I have
multiple
ViewEditParts, and I have to let the user select a correct view editpart to
show. So when user
edits view editpart the components get added to it and everything works out
fine. But when user
selects another view editpart, edits it, and then changes back to to the
original
vieweditpart, editparts are no longer in hashmap. This is because - like you
said - unregister is called
for every editpart that the view editpart contains. But when the
vieweditpart is "revived" (I set it
as FreeformGraphicalRootEditParts contents) the editparts that I have
created previously are not registered
again. The figures are shown but they are not mapped to editparts.

I haven't really looked in Logic-example but for to it seems that the
LogicDiagramEditPart is like
my ViewEditPart. I know that I could make this work with only one view
editpart
but my original model supports the idea that I use multiple view editparts.


protected void configureGraphicalViewer() {
super.configureGraphicalViewer();
GraphicalViewer viewer = getGraphicalViewer();
FreeformGraphicalRootEditPart part = new
FreeformGraphicalRootEditPart();
viewer.setRootEditPart(part);
}



// Rooteditparts contents is changed in here
public void selectionChanged(SelectionChangedEvent event) {
....
// Get the editpart that user wants to see (1) and set it as a contents
for rooteditpart (2)

if (element instanceof ViewAdapter) {
lViewAdapter adapter = (ViewAdapter) element;
ViewEditPart viewPart = (ViewEditPart)
model.getViewEditPart(adapter); // 1
GraphicalViewer viewer = getGraphicalViewer();
viewer.setContents(viewPart); // 2
}
}


Thank you for your help.

- Sami


"Randy Hudson" <none@us.ibm.com> wrote in message
news:b6si4o$jns$1@rogue.oti.com...
>
> "Sami Lakka" <sami.lakka@tut.fi> wrote in message
> news:b6sh3r$ind$1@rogue.oti.com...
> > I dugged in to the GEF code and found that
> > the problem is in mapVisualToEditPart-hashmap. This gets
> > cleared when FreeformGraphicalRootEditParts setContents-method
>
> What do you mean? What are setting the contents to? What were the
contents
> previously? If you have previous contents, which are getting removed,
they
> will all receive removeNotify() calls, which calls unregister(), which
> removes the hashtable entry.
>
> > is called. But when new container editpart is set to the RootEditPart
>
> You should not be replacing the root. Could you please paste roughly the
> code that you are executing?
>
> > the registerVisuals doesn't register editparts children to the
> > mapVisualToEditPart-hasmap.
>
> If you replace the contents editpart, the root will call addChild(), which
> calls addNotify(), which calls register(), which calls registerVisuals(),
> which should map the figure->EditPart.
>
> > I think the fix is quite simple for this; in registerVisuals-method
> iterate
> > the children and add them to hashmap.
> > I try this later.
> >
> > - Sami
>
>
>
Re: Selection handles [message #74957 is a reply to message #74886] Tue, 08 April 2003 10:49 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

> // Rooteditparts contents is changed in here
> public void selectionChanged(SelectionChangedEvent event) {
> ...
> // Get the editpart that user wants to see (1) and set it as a
contents
> for rooteditpart (2)
>
> if (element instanceof ViewAdapter) {
> lViewAdapter adapter = (ViewAdapter) element;
> ViewEditPart viewPart = (ViewEditPart)
> model.getViewEditPart(adapter); // 1
> GraphicalViewer viewer = getGraphicalViewer();
> viewer.setContents(viewPart); // 2

Please step into this method, and find out why addNotify is not being called
correctly, or out of order, whatever. If you find something strange, open a
bugzilla. This is supposed to work automatically.

> }
> }
>
>
Previous Topic:GEF Hello 6 tutorial does not compile
Next Topic:Deleting the source node during connection creation
Goto Forum:
  


Current Time: Sun Jun 08 15:29:42 EDT 2025

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

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

Back to the top