[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.gef] Re: implementing cut/copy/paste

Jesper Eskilson wrote:
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

Relax my friend. Did you try what I indicated in my post?

--
Respectfully,


CL Gilbert

"Verily, verily, I say unto you, He that entereth not by the door() into the sheepfold{}, but climbeth up some other *way, the same is a thief and a robber."

GnuPG Key Fingerprint:
82A6 8893 C2A1 F64E A9AD  19AE 55B2 4CD7 80D2 0A2D

For a free Java interface to Freechess.org see http://www.rigidsoftware.com/Chess/chess.html