again on actionbarcontributor [message #207162] |
Wed, 11 January 2006 16:20 |
Vlad Ciubotariu Messages: 14 Registered: July 2009 |
Junior Member |
|
|
Following the logic design example I've added similar code to the shape
editor example. The newly added action shows up in the editor toolbar,
however
it never activates when I select shapes.
Any clues, please?
//ShapesEditorActionBarContributor
protected void buildActions() {
addRetargetAction(new DeleteRetargetAction());
addRetargetAction(new UndoRetargetAction());
addRetargetAction(new RedoRetargetAction());
addRetargetAction(new AlignmentRetargetAction(PositionConstants.CENTER));
}
/**
* Add actions to the given toolbar.
* @see
org.eclipse.ui.part.EditorActionBarContributor#contributeToT oolBar(org.eclipse.jface.action.IToolBarManager)
*/
public void contributeToToolBar(IToolBarManager toolBarManager) {
toolBarManager.add(getAction(ActionFactory.UNDO.getId()));
toolBarManager.add(getAction(ActionFactory.REDO.getId()));
toolBarManager.add(getAction(ActionFactory.DELETE.getId()));
toolBarManager.add(getAction(GEFActionConstants.ALIGN_CENTER ));
}
//ShapesEditor
protected void createActions() {
super.createActions();
ActionRegistry registry = getActionRegistry();
IAction action;
action = new AlignmentAction((IWorkbenchPart)this,
PositionConstants.CENTER);
//action.setId(GEFActionConstants.ALIGN_CENTER);
registry.registerAction(action);
getSelectionActions().add(action.getId());
}
|
|
|
Powered by
FUDForum. Page generated in 0.02315 seconds