Bug 101558

Summary: [Tool] Inconsistent post-execute selection between CreationTool and ConnectionCreationTool
Product: [Tools] GEF Reporter: Ed Willink <ed>
Component: GEF-Legacy GEF (MVC)Assignee: gef-inbox <gef-inbox>
Status: NEW --- QA Contact:
Severity: minor    
Priority: P3    
Version: 3.0   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:

Description Ed Willink CLA 2005-06-23 17:00:14 EDT
In CreationTool performAction invokes selectAddedObject() so that the
newly created object is selected.

ConnectionCreationTool has no equivalent behaviour.

So in e.g. EDiagram new nodes are selected, but new links are not.

Copying the CreationTool code to ConnectionTool works fine.
? should it move up the hierarchy or just be copied?
Comment 1 Ed Willink CLA 2005-06-26 14:26:00 EDT
Related problems arise with a Redo of a Create or an Undo of a Delete not 
selecting the re-created part.

I seem to need an addSelectedObjectsWhenDone/Undone method in (derived)
commands to be able to find out what is available to select from an 
Undo/RedoAction. (Ok, it is solvable with instanceof and a get.)

I also note that the calculateEnabled method in DeleteAction is rather costly
in EDiagram where only transient links are not-deletable, so creating a
delete command and its delegate just on the off chance that a selection might
get deleted seems unnecessary. A canDelete() method in derived EditParts
saves the effort and works more consistently since run() always creates
a delete command anyway where it is sensitive to KEY_PERM_DELETE.

Comment 2 Randy Hudson CLA 2005-06-26 23:12:06 EDT
> I also note that the calculateEnabled method in DeleteAction is rather costly
> in EDiagram where only transient links are not-deletable, so creating a
> delete command and its delegate...

I don't know the example well, but the "delegate" should be created lazily on 
execute if there is any performance issue in the current implementation.