actionbar and editor actions [message #207104] |
Tue, 10 January 2006 20:52 |
Vlad Ciubotariu Messages: 14 Registered: July 2009 |
Junior Member |
|
|
I'm playing with the shape example, trying to add an align action to the
toolbar. When I run the example the AlignmentAction doesn't become active.
I'm missing smth, can't figure what.
thanks
Added this code ShapesActionBarContributor
protected void buildActions() {
addRetargetAction(new DeleteRetargetAction());
addRetargetAction(new UndoRetargetAction());
addRetargetAction(new RedoRetargetAction());
aa1 = new AlignmentRetargetAction(PositionConstants.CENTER);
addRetargetAction(aa1);
}
/**
* 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(aa1);
//toolBarManager.add(aa2);
}
And also added this to the ShapeEditor
protected void createActions() {
ActionRegistry registry = getActionRegistry();
IAction action;
action = new AlignmentAction((IWorkbenchPart) this,
PositionConstants.CENTER);
registry.registerAction(action);
getSelectionActions().add(action.getId());
}
|
|
|
Powered by
FUDForum. Page generated in 0.02777 seconds