本文整理汇总了Java中org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler类的典型用法代码示例。如果您正苦于以下问题:Java GraphicalViewerKeyHandler类的具体用法?Java GraphicalViewerKeyHandler怎么用?Java GraphicalViewerKeyHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GraphicalViewerKeyHandler类属于org.eclipse.gef.ui.parts包,在下文中一共展示了GraphicalViewerKeyHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureGraphicalViewer
import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler; //导入依赖的package包/类
@Override
protected void configureGraphicalViewer() {
super.configureGraphicalViewer();
GraphicalViewer viewer = getGraphicalViewer();
viewer.setRootEditPart(new ScalableFreeformRootEditPart());
viewer.setEditPartFactory(new FormDesignerEditPartFactory(this));
ContextMenuProvider provider = new FormContextMenuProvider(viewer,
actionIds, getActionRegistry());
viewer.setContextMenu(provider);
viewer.setKeyHandler(new GraphicalViewerKeyHandler(viewer));
((FigureCanvas) viewer.getControl())
.setScrollBarVisibility(FigureCanvas.ALWAYS);
}
示例2: configureGraphicalViewer
import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler; //导入依赖的package包/类
@Override
protected void configureGraphicalViewer() {
super.configureGraphicalViewer();
GraphicalViewer viewer = getGraphicalViewer();
viewer.setRootEditPart(new ScalableFreeformRootEditPart());
viewer.setEditPartFactory(new TaskFieldEditPartFactory(
getParentEditor()));
ContextMenuProvider provider = new FormContextMenuProvider(viewer,
getParentEditor().getEditActionList(), getParentEditor()
.getActionRegistry());
viewer.setContextMenu(provider);
viewer.setKeyHandler(new GraphicalViewerKeyHandler(viewer));
((FigureCanvas) viewer.getControl())
.setScrollBarVisibility(FigureCanvas.ALWAYS);
}
示例3: configureGraphicalViewer
import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler; //导入依赖的package包/类
/**
* Configure the graphical viewer before it receives contents.
* <p>
* This is the place to choose an appropriate RootEditPart and EditPartFactory for your editor. The RootEditPart determines the behavior of the editor's
* "work-area". For example, GEF includes zoomable and scrollable root edit parts. The EditPartFactory maps model elements to edit parts (controllers).
* </p>
*
* @see org.eclipse.gef.ui.parts.GraphicalEditor#configureGraphicalViewer()
*/
protected void configureGraphicalViewer() {
super.configureGraphicalViewer();
ScrollingGraphicalViewer viewer = (ScrollingGraphicalViewer) getGraphicalViewer();
root = new UCMConnectionOnBottomRootEditPart(getParent());
// zoom management is delegated to us from our parent.
List zoomLevels = new ArrayList(3);
zoomLevels.add(ZoomManager.FIT_ALL);
zoomLevels.add(ZoomManager.FIT_WIDTH);
zoomLevels.add(ZoomManager.FIT_HEIGHT);
root.getZoomManager().setZoomLevelContributions(zoomLevels);
viewer.setRootEditPart(root);
registerContextMenuProvider(viewer);
viewer.setEditPartFactory(new GraphicalEditPartFactory((UCMmap) getModel()));
KeyHandler handler = new GraphicalViewerKeyHandler(viewer).setParent(getCommonKeyHandler());
viewer.setKeyHandler(handler);
getEditDomain().getPaletteViewer().setKeyHandler(handler);
}
示例4: configureGraphicalViewer
import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler; //导入依赖的package包/类
/**
* Configure the graphical viewer before it receives contents.
* <p>
* This is the place to choose an appropriate RootEditPart and EditPartFactory for your editor. The RootEditPart determines the behavior of the editor's
* "work-area". For example, GEF includes zoomable and scrollable root edit parts. The EditPartFactory maps model elements to edit parts (controllers).
* </p>
*
* @see org.eclipse.gef.ui.parts.GraphicalEditor#configureGraphicalViewer()
*/
protected void configureGraphicalViewer() {
super.configureGraphicalViewer();
ScrollingGraphicalViewer viewer = (ScrollingGraphicalViewer) getGraphicalViewer();
// Root editpart that include a zoom manager
root = new GrlConnectionOnBottomRootEditPart(getParent());
// zoom management is delegated to us from our parent.
List zoomLevels = new ArrayList(3);
zoomLevels.add(ZoomManager.FIT_ALL);
zoomLevels.add(ZoomManager.FIT_WIDTH);
zoomLevels.add(ZoomManager.FIT_HEIGHT);
root.getZoomManager().setZoomLevelContributions(zoomLevels);
viewer.setRootEditPart(root);
registerContextMenuProvider(viewer);
viewer.setEditPartFactory(new GrlGraphicalEditPartFactory((GRLGraph) getModel()));
KeyHandler handler = new GraphicalViewerKeyHandler(viewer).setParent(getCommonKeyHandler());
viewer.setKeyHandler(handler);
getEditDomain().getPaletteViewer().setKeyHandler(handler);
}
示例5: initializeGraphicalViewer
import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler; //导入依赖的package包/类
@Override
protected void initializeGraphicalViewer() {
super.initializeGraphicalViewer();
GraphicalViewer viewer=this.getGraphicalViewer();
viewer.setKeyHandler(new GraphicalViewerKeyHandler(viewer));
this.getActionRegistry().registerAction(new ToggleGridAction(viewer));
}
示例6: configureGraphicalViewer
import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler; //导入依赖的package包/类
/**
* Hook the evolution factory into the editor logic and override the standard edit part factory
*/
@Override
public void configureGraphicalViewer() {
super.configureGraphicalViewer();
GraphicalViewer viewer = getGraphicalViewer();
viewer.setEditPartFactory(new DwFeatureModelEditorEditPartFactory(viewer, this));
viewer.setContextMenu(new DwGraphicalFeatureModelEditorContextMenuProvider(getGraphicalViewer(), getActionRegistry()));
viewer.setKeyHandler(new GraphicalViewerKeyHandler(viewer).setParent(getCommonKeyHandler()));
}
示例7: configureKeyboardShortcuts
import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler; //导入依赖的package包/类
/**
* This method sets shortcuts for actions.
* */
private void configureKeyboardShortcuts() {
getGraphicalViewer().getKeyHandler();
GraphicalViewerKeyHandler keyHandler = new GraphicalViewerKeyHandler(
getGraphicalViewer());
keyHandler.put(KeyStroke.getPressed(SWT.F2, 0), getActionRegistry()
.getAction(GEFActionConstants.DIRECT_EDIT));
keyHandler.put(
KeyStroke.getPressed(SWT.CR, '\r', 0),
getActionRegistry().getAction(
CreateAttributeOperationAction.CREATE_A_M_ID));
getGraphicalViewer().setKeyHandler(keyHandler);
}
示例8: configureGraphicalViewer
import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler; //导入依赖的package包/类
@Override
protected void configureGraphicalViewer()
{
super.configureGraphicalViewer();
getGraphicalViewer().setRootEditPart(new ScalableFreeformRootEditPart());
getGraphicalViewer().setEditPartFactory(new PartFactory());
getGraphicalViewer().setKeyHandler(
new GraphicalViewerKeyHandler(getGraphicalViewer())
.setParent(getCommonKeyHandler()));
// configure the context menu provider
ContextMenuProvider cmProvider = new MyDiagramContextMenuProvider(getGraphicalViewer(),
getActionRegistry());
getGraphicalViewer().setContextMenu(cmProvider);
getSite().registerContextMenu(cmProvider, getGraphicalViewer());
}
示例9: configureGraphicalViewer
import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler; //导入依赖的package包/类
@Override
protected void configureGraphicalViewer() {
super.configureGraphicalViewer();
getGraphicalViewer()
.setRootEditPart(new ScalableFreeformRootEditPart());
getGraphicalViewer().setEditPartFactory(this.part);
getGraphicalViewer().setKeyHandler(
new GraphicalViewerKeyHandler(getGraphicalViewer())
.setParent(getCommonKeyHandler()));
// configure the context menu provider
}
示例10: configureGraphicalViewer
import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler; //导入依赖的package包/类
/**
* Configure the graphical viewer before it receives contents.
* <p>
* This is the place to choose an appropriate RootEditPart and EditPartFactory for your editor. The RootEditPart
* determines the behavior of the editor's "work-area". For example, GEF includes zoomable and scrollable root edit
* parts. The EditPartFactory maps model elements to edit parts (controllers).
* </p>
*
* @see org.eclipse.gef.ui.parts.GraphicalEditor#configureGraphicalViewer()
*/
protected void configureGraphicalViewer() {
super.configureGraphicalViewer();
GraphicalViewer viewer = getGraphicalViewer();
viewer.setEditPartFactory(new ShapesEditPartFactory());
viewer.setRootEditPart(new ScalableFreeformRootEditPart());
viewer.setKeyHandler(new GraphicalViewerKeyHandler(viewer));
// configure the context menu provider
ContextMenuProvider cmProvider = new ShapesEditorContextMenuProvider(viewer, getActionRegistry());
viewer.setContextMenu(cmProvider);
getSite().registerContextMenu(cmProvider, viewer);
}
示例11: configureGraphicalViewer
import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler; //导入依赖的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);
}
示例12: configureKeyboardShortcuts
import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler; //导入依赖的package包/类
private void configureKeyboardShortcuts() {
GraphicalViewerKeyHandler keyHandler = new GraphicalViewerKeyHandler(getGraphicalViewer());
keyHandler.put(KeyStroke.getPressed(SWT.F4,0), getActionRegistry().getAction(Constants.SUBJOB_OPEN));
getGraphicalViewer().setKeyHandler(keyHandler);
}
示例13: registerKeyHandler
import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler; //导入依赖的package包/类
private void registerKeyHandler() {
GraphicalViewerKeyHandler graphicalViewerKeyHandler = new GraphicalViewerKeyHandler(getGraphicalViewer());
KeyHandler parentKeyHandler = graphicalViewerKeyHandler.setParent(getCommonKeyHandler());
getGraphicalViewer().setKeyHandler(parentKeyHandler);
}
示例14: PaletteTreeViewer
import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler; //导入依赖的package包/类
public PaletteTreeViewer() {
super();
setKeyHandler(new GraphicalViewerKeyHandler(this));
setEditPartFactory(new PaletteTreeEditPartFactory());
addDragSourceListener(new TreeViewerTransferDragListener(this));
}
示例15: configureGraphicalViewer
import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler; //导入依赖的package包/类
/**
* Override this to enforce that connections can also be selected with a mouse drag marquee selection.
*/
@Override
protected void configureGraphicalViewer() {
ScrollingGraphicalViewer viewer = (ScrollingGraphicalViewer) getDiagramContainer().getGraphicalViewer();
ScalableRootEditPartAnimated rootEditPart = new ScalableRootEditPartAnimated(viewer, getConfigurationProvider()) {
@Override
protected GridLayer createGridLayer() {
return new org.eclipse.graphiti.ui.internal.util.draw2d.GridLayer((IConfigurationProviderInternal) getConfigurationProvider());
}
@Override
public DragTracker getDragTracker(Request req) {
GFMarqueeDragTracker trckr = new GFMarqueeDragTracker(this);
trckr.setMarqueeBehavior(GFMarqueeSelectionTool.BEHAVIOR_NODES_AND_CONNECTIONS);
return trckr;
}
};
// configure ZoomManager
viewer.setRootEditPart(rootEditPart); // support
// animation of the zoom
ZoomManager zoomManager = rootEditPart.getZoomManager();
List<String> zoomLevels = new ArrayList<>(3);
zoomLevels.add(ZoomManager.FIT_ALL);
zoomLevels.add(ZoomManager.FIT_WIDTH);
zoomLevels.add(ZoomManager.FIT_HEIGHT);
zoomManager.setZoomLevelContributions(zoomLevels);
IToolBehaviorProvider toolBehaviorProvider = getConfigurationProvider().getDiagramTypeProvider().getCurrentToolBehaviorProvider();
zoomManager.setZoomLevels(toolBehaviorProvider.getZoomLevels());
this.initActionRegistry(zoomManager);
// set the keyhandler.
viewer.setKeyHandler((new GraphicalViewerKeyHandler(viewer)).setParent(getCommonKeyHandler()));
// settings for grid and guides
Diagram diagram = getConfigurationProvider().getDiagram();
boolean snapToGrid = diagram.isSnapToGrid();
int horizontalGridUnit = diagram.getGridUnit();
int verticalGridUnit = diagram.getVerticalGridUnit();
if (verticalGridUnit == -1) {
// No vertical grid unit set (or old diagram before 0.8): use
// vertical grid unit
verticalGridUnit = horizontalGridUnit;
}
boolean gridVisisble = (horizontalGridUnit > 0) && (verticalGridUnit > 0);
viewer.setProperty(SnapToGrid.PROPERTY_GRID_VISIBLE, new Boolean(gridVisisble));
viewer.setProperty(SnapToGrid.PROPERTY_GRID_ENABLED, new Boolean(snapToGrid));
viewer.setProperty(SnapToGrid.PROPERTY_GRID_SPACING, new Dimension(horizontalGridUnit, verticalGridUnit));
viewer.setProperty(SnapToGeometry.PROPERTY_SNAP_ENABLED, toolBehaviorProvider.isShowGuides());
// context button manager
IConfigurationProviderInternal configurationProvider = (IConfigurationProviderInternal) this.getConfigurationProvider();
configurationProvider.setContextButtonManager(new ContextButtonManagerForPad(this, configurationProvider.getResourceRegistry()));
}