use of org.eclipse.gef.ui.actions.MatchWidthRetargetAction in project yamcs-studio by yamcs.
the class OPIEditorActionBarContributor method buildActions.
@Override
protected void buildActions() {
addRetargetAction(new UndoRetargetAction());
addRetargetAction(new RedoRetargetAction());
addRetargetAction(new DeleteRetargetAction());
addRetargetAction(new ZoomInRetargetAction());
addRetargetAction(new ZoomOutRetargetAction());
addRetargetAction(new MatchWidthRetargetAction());
addRetargetAction(new MatchHeightRetargetAction());
addRetargetAction(new AlignmentRetargetAction(PositionConstants.TOP));
addRetargetAction(new AlignmentRetargetAction(PositionConstants.MIDDLE));
addRetargetAction(new AlignmentRetargetAction(PositionConstants.BOTTOM));
addRetargetAction(new AlignmentRetargetAction(PositionConstants.LEFT));
addRetargetAction(new AlignmentRetargetAction(PositionConstants.CENTER));
addRetargetAction(new AlignmentRetargetAction(PositionConstants.RIGHT));
RetargetAction a = new RetargetAction(GEFActionConstants.TOGGLE_GRID_VISIBILITY, "Toggle Grid Visibility", IAction.AS_CHECK_BOX);
a.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(OPIBuilderPlugin.PLUGIN_ID, // $NON-NLS-1$
"icons/grid.png"));
addRetargetAction(a);
a = new RetargetAction(GEFActionConstants.TOGGLE_SNAP_TO_GEOMETRY, "Toggle Snap To Geometry", IAction.AS_CHECK_BOX);
a.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(OPIBuilderPlugin.PLUGIN_ID, "icons/snap2geometry.png"));
addRetargetAction(a);
a = new RetargetAction(GEFActionConstants.TOGGLE_RULER_VISIBILITY, "Toggle Ruler Visibility", IAction.AS_CHECK_BOX);
a.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(OPIBuilderPlugin.PLUGIN_ID, "icons/ruler.png"));
addRetargetAction(a);
for (DistributeType dt : DistributeType.values()) {
if (dt != DistributeType.HORIZONTAL_GAP) {
a = new RetargetAction(dt.getActionID(), dt.getLabel());
a.setImageDescriptor(dt.getImageDescriptor());
addRetargetAction(a);
}
}
// This is only for action displaying in toolbar
a = new RetargetAction(DistributeType.HORIZONTAL_GAP.getActionID(), DistributeType.HORIZONTAL_GAP.getLabel(), IAction.AS_DROP_DOWN_MENU);
a.setImageDescriptor(DistributeType.HORIZONTAL_GAP.getImageDescriptor());
a.setMenuCreator(new IMenuCreator() {
Menu menu;
@Override
public Menu getMenu(Menu parent) {
return null;
}
@Override
public Menu getMenu(Control parent) {
if (menu != null)
return menu;
MenuManager manager = new MenuManager();
for (DistributeType dt : DistributeType.values()) {
if (dt != DistributeType.HORIZONTAL_GAP)
manager.add(getAction(dt.getActionID()));
}
menu = manager.createContextMenu(parent);
return menu;
}
@Override
public void dispose() {
if (menu != null) {
menu.dispose();
menu = null;
}
}
});
addRetargetAction(a);
}
Aggregations