Jesper Eskilson wrote:
"CL [dnoyeb] Gilbert" <Lamont_Gilbert@xxxxxxxxxxxxxxxxx> writes:
getSelectedObjects should never return the empty list.
Well, it does.
After some investigation, it appears that CopyAction's update() method is
never called, and thus the selection field is never set. I wonder why.
I'll keep investigating.
What seems to happen is this: when selectionChanged (in the
GraphicalEditor class) calls updateAction() on all selection-actions,
only the retarget-version of the action gets called -- they have the
same ID, so the action-registry can only hold one of them:
protected void updateActions(List actionIds)
{
ActionRegistry registry = getActionRegistry();
Iterator iter = actionIds.iterator();
while (iter.hasNext()) {
IAction action = registry.getAction(iter.next());
if (action instanceof UpdateAction)
((UpdateAction)action).update();
}
}
The parameter actionIds is here [ 'delete', 'copy' ] when called from
selectionChanged, and registry.getAction() returns a RetargetAction(),
not my CopyAction.
So, something is wrong in my action-registry. Pratik said that I should
create both retarget-actions and "normal" actions with the same ID, but
then they can't reside in the same action-registry. Or did I miss
something?
/Jesper