本文整理汇总了Java中org.eclipse.gef.ui.actions.ZoomOutAction类的典型用法代码示例。如果您正苦于以下问题:Java ZoomOutAction类的具体用法?Java ZoomOutAction怎么用?Java ZoomOutAction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ZoomOutAction类属于org.eclipse.gef.ui.actions包,在下文中一共展示了ZoomOutAction类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureToolBar
import org.eclipse.gef.ui.actions.ZoomOutAction; //导入依赖的package包/类
@Override
protected void configureToolBar(final IToolBarManager manager)
{
super.configureToolBar(manager);
final IDiagramOutputActionFactory factory = JiveUIPlugin.getDefault()
.getDiagramOutputActionFactory();
final ScalableRootEditPart root = (ScalableRootEditPart) viewer.getRootEditPart();
final IAction zoomIn = new ZoomInAction(root.getZoomManager());
final IAction zoomOut = new ZoomOutAction(root.getZoomManager());
final IUpdatableAction saveAs = factory.createDiagramExportAction(viewer);
final IUpdatableAction print = factory.createPrintAction(viewer);
addUpdatableAction(saveAs);
addUpdatableAction(print);
// reference: http://dev.eclipse.org/newslists/news.eclipse.platform/msg60866.html
// register action handlers for zoom in and zoom out:
final IHandlerService handlerService = (IHandlerService) getSite().getService(
IHandlerService.class);
handlerService.activateHandler(zoomIn.getActionDefinitionId(), new ActionHandler(zoomIn));
handlerService.activateHandler(zoomOut.getActionDefinitionId(), new ActionHandler(zoomOut));
manager.insertBefore(AbstractJiveView.GROUP_STEP_CONTROLS, new Separator(
AbstractGraphicalJiveView.ZOOM_CONTROLS_GROUP));
manager.appendToGroup(AbstractGraphicalJiveView.ZOOM_CONTROLS_GROUP, saveAs);
manager.appendToGroup(AbstractGraphicalJiveView.ZOOM_CONTROLS_GROUP, print);
manager.appendToGroup(AbstractGraphicalJiveView.ZOOM_CONTROLS_GROUP, zoomIn);
manager.appendToGroup(AbstractGraphicalJiveView.ZOOM_CONTROLS_GROUP, zoomOut);
}
示例2: prepareZoomContributions
import org.eclipse.gef.ui.actions.ZoomOutAction; //导入依赖的package包/类
private void prepareZoomContributions(GraphicalViewer viewer) {
ScalableFreeformRootEditPart root = new ScalableFreeformRootEditPart();
// set clipping strategy for connection layer
ConnectionLayer connectionLayer = (ConnectionLayer) root
.getLayer(LayerConstants.CONNECTION_LAYER);
connectionLayer
.setClippingStrategy(new ViewportAwareConnectionLayerClippingStrategy(
connectionLayer));
List<String> zoomLevels = new ArrayList<String>(3);
zoomLevels.add(ZoomManager.FIT_ALL);
zoomLevels.add(ZoomManager.FIT_WIDTH);
zoomLevels.add(ZoomManager.FIT_HEIGHT);
root.getZoomManager().setZoomLevelContributions(zoomLevels);
IAction zoomIn = new ZoomInAction(root.getZoomManager());
IAction zoomOut = new ZoomOutAction(root.getZoomManager());
viewer.setRootEditPart(root);
getActionRegistry().registerAction(zoomIn);
getActionRegistry().registerAction(zoomOut);
//zoom on key strokes: ctrl++ and ctrl--
IHandlerService service =
(IHandlerService)getEditorSite().getService(IHandlerService. class);
service.activateHandler(zoomIn.getActionDefinitionId(),
new ActionHandler(zoomIn));
service.activateHandler(zoomOut.getActionDefinitionId(),
new ActionHandler(zoomOut));
// Scroll-wheel Zoom
getGraphicalViewer().setProperty(
MouseWheelHandler.KeyGenerator.getKey(SWT.MOD1),
MouseWheelZoomHandler.SINGLETON);
}
示例3: registerZoomAction
import org.eclipse.gef.ui.actions.ZoomOutAction; //导入依赖的package包/类
private void registerZoomAction() {
List<String> zoomLevels = new ArrayList<String>(3);
zoomLevels.add(ZoomManager.FIT_ALL);
zoomLevels.add(ZoomManager.FIT_WIDTH);
zoomLevels.add(ZoomManager.FIT_HEIGHT);
rootEditPart.getZoomManager().setZoomLevelContributions(zoomLevels);
IAction zoomIn = new ZoomInAction(rootEditPart.getZoomManager());
IAction zoomOut = new ZoomOutAction(rootEditPart.getZoomManager());
getActionRegistry().registerAction(zoomIn);
getActionRegistry().registerAction(zoomOut);
addKeyHandler(zoomIn);
addKeyHandler(zoomOut);
}
示例4: configureGraphicalViewer
import org.eclipse.gef.ui.actions.ZoomOutAction; //导入依赖的package包/类
/**
* Register the zoom in and zoom out action to the zoom manager of the current graphical editor.
*/
@Override
public void configureGraphicalViewer() {
super.configureGraphicalViewer();
ZoomManager manager = (ZoomManager) getGraphicalViewer().getProperty(ZoomManager.class.toString());
getActionRegistry().registerAction(new ZoomInAction(manager));
getActionRegistry().registerAction(new ZoomOutAction(manager));
}
示例5: configureGraphicalViewer
import org.eclipse.gef.ui.actions.ZoomOutAction; //导入依赖的package包/类
protected void configureGraphicalViewer() {
super.configureGraphicalViewer();
GraphicalViewer viewer = getGraphicalViewer();
ScalableRootEditPart root = new ScalableRootEditPart();
viewer.setRootEditPart(root);
viewer.setEditPartFactory(new GraphEditPartFactory(viewer));
viewer.setContents("Loading graph... This can take several minutes");
ContextMenuProvider cmProvider = new RevisionGraphMenuProvider(viewer, this);
viewer.setContextMenu(cmProvider);
getSite().setSelectionProvider(viewer);
IEditorInput input = getEditorInput();
if(input instanceof FileEditorInput) {
FileEditorInput fileEditorInput = (FileEditorInput) input;
showGraphFor(fileEditorInput.getFile());
} else if(input instanceof RevisionGraphEditorInput) {
RevisionGraphEditorInput editorInput = (RevisionGraphEditorInput) input;
showGraphFor(editorInput);
}
// zoom stuff
ZoomManager zoomManager = ((ScalableRootEditPart) viewer.getRootEditPart()).getZoomManager();
IAction zoomIn = new ZoomInAction(zoomManager);
IAction zoomOut = new ZoomOutAction(zoomManager);
getActionRegistry().registerAction(zoomIn);
getActionRegistry().registerAction(zoomOut);
// keyboard
getSite().getKeyBindingService().registerAction(zoomIn); // FIXME, deprecated
getSite().getKeyBindingService().registerAction(zoomOut); // FIXME, deprecated
List zoomContributions = Arrays.asList(new String[] {
ZoomManager.FIT_ALL,
ZoomManager.FIT_HEIGHT,
ZoomManager.FIT_WIDTH });
zoomManager.setZoomLevelContributions(zoomContributions);
// mouse wheel
viewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.MOD1),
MouseWheelZoomHandler.SINGLETON);
}
示例6: hookZoom
import org.eclipse.gef.ui.actions.ZoomOutAction; //导入依赖的package包/类
protected void hookZoom( ScalableFreeformRootEditPart root )
{
List zoomLevels = new ArrayList( 3 );
zoomLevels.add( ZoomManager.FIT_ALL );
zoomLevels.add( ZoomManager.FIT_WIDTH );
zoomLevels.add( ZoomManager.FIT_HEIGHT );
root.getZoomManager( ).setZoomLevelContributions( zoomLevels );
IAction zoomIn = new ZoomInAction( root.getZoomManager( ) );
IAction zoomOut = new ZoomOutAction( root.getZoomManager( ) );
getActionRegistry( ).registerAction( zoomIn );
getActionRegistry( ).registerAction( zoomOut );
getSite( ).getKeyBindingService( ).registerAction( zoomIn );
getSite( ).getKeyBindingService( ).registerAction( zoomOut );
}
示例7: initViewerAction
import org.eclipse.gef.ui.actions.ZoomOutAction; //导入依赖的package包/类
/**
* 初始化Editor内容
* @param viewer
*/
private void initViewerAction(GraphicalViewer viewer) {
ScalableFreeformRootEditPart rootEditPart = new PagableFreeformRootEditPart(
this.diagram);
viewer.setRootEditPart(rootEditPart);
ZoomManager manager = rootEditPart.getZoomManager();
double[] zoomLevels = new double[] { 0.1, 0.25, 0.5, 0.75, 0.8, 1.0,
1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 10.0, 20.0 };
manager.setZoomLevels(zoomLevels);
List<String> zoomContributions = new ArrayList<String>();
zoomContributions.add(ZoomManager.FIT_ALL);
zoomContributions.add(ZoomManager.FIT_HEIGHT);
zoomContributions.add(ZoomManager.FIT_WIDTH);
manager.setZoomLevelContributions(zoomContributions);
ZoomInAction zoomInAction = new ZoomInAction(manager);
ZoomOutAction zoomOutAction = new ZoomOutAction(manager);
this.getActionRegistry().registerAction(zoomInAction);
this.getActionRegistry().registerAction(zoomOutAction);
this.addKeyHandler(zoomInAction);
this.addKeyHandler(zoomOutAction);
this.actionBarContributor = new BODiagramActionBarContributor();
this.actionBarContributor.init(this.getEditorSite().getActionBars(),
this.getSite().getPage());
IFigure gridLayer = rootEditPart.getLayer(LayerConstants.GRID_LAYER);
gridLayer.setForegroundColor(ColorResource.GRID_COLOR);
}
示例8: registerStaticActions
import org.eclipse.gef.ui.actions.ZoomOutAction; //导入依赖的package包/类
private void registerStaticActions() {
final ProductSystemGraphEditor editor = model.editor;
actionRegistry.registerAction(ActionFactory.buildSupplyChainMenu(editor));
actionRegistry.registerAction(ActionFactory.removeSupplyChain(editor));
actionRegistry.registerAction(ActionFactory.removeAllConnections(editor));
actionRegistry.registerAction(ActionFactory.mark(editor));
actionRegistry.registerAction(ActionFactory.unmark(editor));
actionRegistry.registerAction(ActionFactory.saveImage(editor));
actionRegistry.registerAction(ActionFactory.expandAll(editor));
actionRegistry.registerAction(ActionFactory.collapseAll(editor));
actionRegistry.registerAction(ActionFactory.maximizeAll(editor));
actionRegistry.registerAction(ActionFactory.minimizeAll(editor));
actionRegistry.registerAction(ActionFactory.layoutMenu(editor));
actionRegistry.registerAction(ActionFactory.searchProviders(editor));
actionRegistry.registerAction(ActionFactory.searchRecipients(editor));
actionRegistry.registerAction(ActionFactory.open(editor));
actionRegistry.registerAction(ActionFactory.openMiniatureView(editor));
actionRegistry.registerAction(ActionFactory.showOutline());
actionRegistry.registerAction(new ZoomInAction(getZoomManager()));
actionRegistry.registerAction(new ZoomOutAction(getZoomManager()));
DeleteAction delAction = new DeleteAction((IWorkbenchPart) editor) {
@Override
protected ISelection getSelection() {
return editor.getSite().getWorkbenchWindow().getSelectionService().getSelection();
}
};
actionRegistry.registerAction(delAction);
}
示例9: configureGraphicalViewer
import org.eclipse.gef.ui.actions.ZoomOutAction; //导入依赖的package包/类
@Override
protected void configureGraphicalViewer() {
ArrayList<String> zoomContributions;
// configure viewer
super.configureGraphicalViewer();
MenuManager menu = SankeyMenu.create(this);
getGraphicalViewer().setContextMenu(menu);
GraphicalViewer viewer = getGraphicalViewer();
viewer.setEditPartFactory(new SankeyEditPartFactory());
ScalableRootEditPart rootEditPart = new ScalableRootEditPart();
viewer.setRootEditPart(rootEditPart);
ZoomManager zoomManager = rootEditPart.getZoomManager();
// append zoom actions to action registry
getActionRegistry().registerAction(new ZoomInAction(zoomManager));
getActionRegistry().registerAction(new ZoomOutAction(zoomManager));
zoomContributions = new ArrayList<>();
zoomContributions.add(ZoomManager.FIT_ALL);
zoomContributions.add(ZoomManager.FIT_HEIGHT);
zoomContributions.add(ZoomManager.FIT_WIDTH);
zoomManager.setZoomLevelContributions(zoomContributions);
// create key handler
KeyHandler keyHandler = new KeyHandler();
keyHandler.put(KeyStroke.getPressed('+', SWT.KEYPAD_ADD, 0),
getActionRegistry().getAction(GEFActionConstants.ZOOM_IN));
keyHandler.put(KeyStroke.getPressed('-', SWT.KEYPAD_SUBTRACT, 0),
getActionRegistry().getAction(GEFActionConstants.ZOOM_OUT));
viewer.setKeyHandler(keyHandler);
viewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.NONE),
MouseWheelZoomHandler.SINGLETON);
}
示例10: configureGraphicalViewer
import org.eclipse.gef.ui.actions.ZoomOutAction; //导入依赖的package包/类
protected void configureGraphicalViewer() {
super.configureGraphicalViewer();
double[] zoomLevels;
List<String> zoomContributions;
GraphicalViewer viewer = getGraphicalViewer();
viewer.setEditPartFactory(gw4eEditPartFactory);
keyHandler = new KeyHandler();
keyHandler.put(KeyStroke.getPressed(SWT.DEL, 127, 0),
getActionRegistry().getAction(ActionFactory.DELETE.getId()));
keyHandler.put(KeyStroke.getPressed(SWT.F2, 0), getActionRegistry().getAction(GEFActionConstants.DIRECT_EDIT));
keyHandler.put(KeyStroke.getPressed('+', SWT.KEYPAD_ADD, 0),
getActionRegistry().getAction(GEFActionConstants.ZOOM_IN));
keyHandler.put(KeyStroke.getPressed('-', SWT.KEYPAD_SUBTRACT, 0),
getActionRegistry().getAction(GEFActionConstants.ZOOM_OUT));
getGraphicalViewer().setKeyHandler(new GraphicalViewerKeyHandler(getGraphicalViewer()).setParent(keyHandler));
ScalableRootEditPart rootEditPart = new ScalableRootEditPart();
viewer.setRootEditPart(rootEditPart);
ZoomManager manager = rootEditPart.getZoomManager();
getActionRegistry().registerAction(new ZoomInAction(manager));
getActionRegistry().registerAction(new ZoomOutAction(manager));
zoomLevels = new double[] { 0.25, 0.5, 0.75, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 10.0, 20.0 };
manager.setZoomLevels(zoomLevels);
zoomContributions = new ArrayList<String>();
zoomContributions.add(ZoomManager.FIT_ALL);
zoomContributions.add(ZoomManager.FIT_HEIGHT);
zoomContributions.add(ZoomManager.FIT_WIDTH);
manager.setZoomLevelContributions(zoomContributions);
getActionRegistry().registerAction(new ToggleGridAction(getGraphicalViewer()));
getActionRegistry().registerAction(new ToggleSnapToGeometryAction(getGraphicalViewer()));
getActionRegistry().registerAction(new ClearEdgeBendpointLayoutAction(this));
ContextMenuProvider provider = new ContextMenuProvider(this, viewer, getActionRegistry());
viewer.setContextMenu(provider);
}
示例11: configureGraphicalViewer
import org.eclipse.gef.ui.actions.ZoomOutAction; //导入依赖的package包/类
@Override
protected void configureGraphicalViewer() {
super.configureGraphicalViewer();
GraphicalViewer graphicalViewer = getGraphicalViewer();
MainDesignerRootEditPart rootEditPart = new MainDesignerRootEditPart();
graphicalViewer.setRootEditPart(rootEditPart);
// set EditPartFactory
graphicalViewer.setEditPartFactory(createEditParFactory());
graphicalViewer.setKeyHandler(new GraphicalViewerKeyHandler(graphicalViewer));
graphicalViewer.setContextMenu(createContextMenuProvider(graphicalViewer));
ZoomManager zoomManager = (ZoomManager) graphicalViewer.getProperty(ZoomManager.class.toString());
getActionRegistry().registerAction(new ZoomInAction(zoomManager));
getActionRegistry().registerAction(new ZoomOutAction(zoomManager));
getActionRegistry().registerAction(new ZoomActualAction(zoomManager));
graphicalViewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.MOD1), MouseWheelZoomHandler.SINGLETON);
graphicalViewer.setProperty("JRCONTEXT", jrContext);
}
示例12: createAdditionalActions
import org.eclipse.gef.ui.actions.ZoomOutAction; //导入依赖的package包/类
/**
* Creates the additional actions.
*/
protected void createAdditionalActions() {
GraphicalViewer graphicalViewer = getGraphicalViewer();
// Show Grid Action
Boolean isGridVisible = jrContext.getPropertyBoolean(RulersGridPreferencePage.P_PAGE_RULERGRID_SHOWGRID, true);
Boolean isSnapToGuides = jrContext.getPropertyBoolean(RulersGridPreferencePage.P_PAGE_RULERGRID_SNAPTOGUIDES, true);
Boolean isSnapToGrid = jrContext.getPropertyBoolean(RulersGridPreferencePage.P_PAGE_RULERGRID_SNAPTOGRID, true);
Boolean isSnapToGeometry = jrContext.getPropertyBoolean(RulersGridPreferencePage.P_PAGE_RULERGRID_SNAPTOGEOMETRY,
true);
int gspaceX = jrContext.getPropertyInteger(RulersGridPreferencePage.P_PAGE_RULERGRID_GRIDSPACEX, 10);
int gspaceY = jrContext.getPropertyInteger(RulersGridPreferencePage.P_PAGE_RULERGRID_GRIDSPACEY, 10);
graphicalViewer.setProperty(SnapToGrid.PROPERTY_GRID_ENABLED, isSnapToGrid.booleanValue());
graphicalViewer.setProperty(SnapToGrid.PROPERTY_GRID_VISIBLE, isGridVisible.booleanValue());
graphicalViewer.setProperty(SnapToGrid.PROPERTY_GRID_ORIGIN, new Point(30, 30));
graphicalViewer.setProperty(SnapToGrid.PROPERTY_GRID_SPACING, new Dimension(gspaceX, gspaceY));
graphicalViewer.setProperty(SnapToGuidesAction.ID, isSnapToGuides);
graphicalViewer.setProperty(SnapToGeometry.PROPERTY_SNAP_ENABLED, isSnapToGeometry.booleanValue());
IAction showGrid = new ShowGridAction(jrContext);
getActionRegistry().registerAction(showGrid);
SnapToGridAction snapGridAction = new SnapToGridAction(jrContext);
getActionRegistry().registerAction(snapGridAction);
SizeGridAction sizeGridAction = new SizeGridAction(jrContext);
getActionRegistry().registerAction(sizeGridAction);
// snap to geometry
IAction snapAction = new SnapToGeometryAction(jrContext);
getActionRegistry().registerAction(snapAction);
snapAction = new SnapToGuidesAction(jrContext);
getActionRegistry().registerAction(snapAction);
// show rullers
IAction showRulers = new ShowRullersAction(jrContext);
getActionRegistry().registerAction(showRulers);
// zoom manager actions
ZoomManager zoomManager = (ZoomManager) graphicalViewer.getProperty(ZoomManager.class.toString());
getActionRegistry().registerAction(new ZoomInAction(zoomManager));
getActionRegistry().registerAction(new ZoomOutAction(zoomManager));
getActionRegistry().registerAction(new ZoomActualAction(zoomManager));
graphicalViewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.MOD1), MouseWheelZoomHandler.SINGLETON);
// set context menu
graphicalViewer.setContextMenu(new AppContextMenuProvider(graphicalViewer, getActionRegistry()));
graphicalViewer.setProperty("JRCONTEXT", jrContext);
LayoutManager.addActions(getActionRegistry(), this, getSelectionActions());
JaspersoftStudioPlugin.getDecoratorManager().registerActions(getActionRegistry(), getSelectionActions(),
getGraphicalViewer(), this);
JaspersoftStudioPlugin.getEditorSettingsManager().registerActions(getActionRegistry(), jrContext);
}
示例13: initViewerAction
import org.eclipse.gef.ui.actions.ZoomOutAction; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected void initViewerAction(GraphicalViewer viewer) {
final ScalableFreeformRootEditPart rootEditPart = new PagableFreeformRootEditPart(diagram);
viewer.setRootEditPart(rootEditPart);
final ZoomManager manager = rootEditPart.getZoomManager();
final double[] zoomLevels = new double[] { 0.1, 0.25, 0.5, 0.75, 0.8, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 10.0, 20.0 };
manager.setZoomLevels(zoomLevels);
final List<String> zoomContributions = new ArrayList<>();
zoomContributions.add(ZoomManager.FIT_ALL);
zoomContributions.add(ZoomManager.FIT_HEIGHT);
zoomContributions.add(ZoomManager.FIT_WIDTH);
manager.setZoomLevelContributions(zoomContributions);
final ZoomInAction zoomInAction = new ZoomInAction(manager);
final ZoomOutAction zoomOutAction = new ZoomOutAction(manager);
final ZoomAdjustAction zoomAdjustAction = new ZoomAdjustAction(manager);
getActionRegistry().registerAction(zoomInAction);
getActionRegistry().registerAction(zoomOutAction);
getActionRegistry().registerAction(zoomAdjustAction);
addKeyHandler(zoomInAction);
addKeyHandler(zoomOutAction);
final IFigure gridLayer = rootEditPart.getLayer(LayerConstants.GRID_LAYER);
gridLayer.setForegroundColor(DesignResources.GRID_COLOR);
IAction action = new ToggleGridAction(viewer);
getActionRegistry().registerAction(action);
action = new ChangeBackgroundColorAction(this, diagram);
getActionRegistry().registerAction(action);
getSelectionActions().add(action.getId());
action = new ToggleMainColumnAction(this);
getActionRegistry().registerAction(action);
action = new LockEditAction(this);
getActionRegistry().registerAction(action);
action = new ExportToDBAction(this);
getActionRegistry().registerAction(action);
this.actionBarContributor = new ERDiagramActionBarContributor(zoomComboContributionItem);
}