[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools.gef] Re: implementing cut/copy/paste
|
- From: Jesper Eskilson <jojo@xxxxxxxxxxxx>
- Date: Wed, 01 Dec 2004 14:52:49 +0100
- Newsgroups: eclipse.tools.gef
- Organization: EclipseCorner
- User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041118
Randy Hudson wrote:
The registry should hold onto actions maintained by the Editor instance.
RetargetActions should only be created by the ActionBarContributor, not each
editor instance.
The purpose of retarget actions is to map a single ActionBarContributor to
multiple editor instances within a given WorkbenchWindow. I think actionbar
contributors were designed as 1-per-window-per-editor-type to reduce flicker
and repainting when changing between multiple java CU editors. It also
reduces the number of native widgets created.
Ok, thanks. The mist is clearing a little now.
The problem was (I think) that I added the retarget-actions to the
editors registry instead of using addRetargetAction().
So, now I've changed my actionbar-contributor to do the following:
IWorkbenchWindow window =
PlatformUI.getWorkbench().getActiveWorkbenchWindow();
addRetargetAction((RetargetAction) ActionFactory.CUT.create(window));
addRetargetAction((RetargetAction) ActionFactory.COPY.create(window));
addRetargetAction((RetargetAction) ActionFactory.PASTE.create(window));
but now I get a ClassCastException() in
org.eclipse.ui.actions.RetargetAction.propagateChange(RetargetAction.java:195)
Apparently this mist didn't clear enough. :-)
/Jesper