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

getSelectedObjects should never return the empty list. If anything it should return your main editpart (your drawing).

try

    ActionRegistry registry = getActionRegistry();
    IAction action;
    action = new CopyAction(this);
    registry.registerAction(action);
    getSelectionActions().add(action.getID());




Jesper Eskilson wrote:
"Pratik Shah" <ppshah@xxxxxxxxxx> writes:


Yes, you'll have to write your own actions (in addition to the retarget
actions that you've already created) and add them to your Editor's
actionRegistry.  Make sure these actions have the same IDs as the retarget
actions.


The copy-action is now called properly, but I can't get a hold of the
selection. getSelectedObjects() returns the empty list.


My editor's createActions() looks like this:

protected void createActions()
{
super.createActions();
IActionBars bars = getEditorSite().getActionBars();
ActionRegistry registry = getActionRegistry();
IAction action;
action = new CopyAction(this);
registry.registerAction(action); bars.setGlobalActionHandler(CopyAction.ID, action);


        [...]

    }

I've tried following the logic-example, but to no avail.



--
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