当前位置: 首页>>代码示例>>Java>>正文


Java GraphicalViewerKeyHandler类代码示例

本文整理汇总了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);
}
 
开发者ID:snakerflow,项目名称:snaker-designer,代码行数:17,代码来源:SnakerFormDesignerEditor.java

示例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);
}
 
开发者ID:snakerflow,项目名称:snaker-designer,代码行数:19,代码来源:TaskFieldDesignerEditor.java

示例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);
}
 
开发者ID:McGill-DP-Group,项目名称:seg.jUCMNav,代码行数:32,代码来源:UcmEditor.java

示例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);

}
 
开发者ID:McGill-DP-Group,项目名称:seg.jUCMNav,代码行数:34,代码来源:GrlEditor.java

示例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));
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:8,代码来源:GraphicalEditorPage.java

示例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()));
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:13,代码来源:DwGraphicalFeatureModelEditor.java

示例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);
}
 
开发者ID:leondart,项目名称:FRaMED,代码行数:16,代码来源:ORMGraphicalEditor.java

示例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());
}
 
开发者ID:winture,项目名称:wt-studio,代码行数:16,代码来源:QueryDesignerEditor.java

示例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
}
 
开发者ID:winture,项目名称:wt-studio,代码行数:12,代码来源:PageDesignerEditor.java

示例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);
}
 
开发者ID:lunifera,项目名称:lunifera-sharky-m2m,代码行数:24,代码来源:ShapesEditor.java

示例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);
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:48,代码来源:GW4EEditor.java

示例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);
 
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:7,代码来源:ELTGraphicalEditor.java

示例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);
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:6,代码来源:DbToolGefEditor.java

示例14: PaletteTreeViewer

import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler; //导入依赖的package包/类
public PaletteTreeViewer() {
  super();
  setKeyHandler(new GraphicalViewerKeyHandler(this));
  setEditPartFactory(new PaletteTreeEditPartFactory());
  addDragSourceListener(new TreeViewerTransferDragListener(this));
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:7,代码来源:PaletteTreeViewer.java

示例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()));
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:63,代码来源:TriqDiagramBehavior.java


注:本文中的org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。