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


Java KeyHandler类代码示例

本文整理汇总了Java中org.eclipse.gef.KeyHandler的典型用法代码示例。如果您正苦于以下问题:Java KeyHandler类的具体用法?Java KeyHandler怎么用?Java KeyHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


KeyHandler类属于org.eclipse.gef包,在下文中一共展示了KeyHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configureGraphicalViewer

import org.eclipse.gef.KeyHandler; //导入依赖的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

示例2: configureGraphicalViewer

import org.eclipse.gef.KeyHandler; //导入依赖的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

示例3: DiagramEditorOutlinePage

import org.eclipse.gef.KeyHandler; //导入依赖的package包/类
/**
 * Creates a new GraphicsEditorOutlinePage. It is important, that this outline page uses the same handlers (ActionRegistry, KeyHandler, ZoomManagerAdapter,
 * ...) as the main editor, so that the behaviour is synchronized between them.
 *
 * @param diagramEditor
 *          the attached diagram editor
 * @since 0.9
 */
public DiagramEditorOutlinePage(IDiagramContainerUI diagramEditor) {
  super(new TriqOutlineTreeViewer(diagramEditor));
  _graphicalViewer = diagramEditor.getGraphicalViewer();
  _actionRegistry = diagramEditor.getAdapter(ActionRegistry.class);
  _editDomain = diagramEditor.getEditDomain();
  _keyHandler = diagramEditor.getAdapter(KeyHandler.class);
  _selectionSynchronizer = diagramEditor.getAdapter(SelectionSynchronizer.class);
  _diagramEditor = diagramEditor;
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:18,代码来源:DiagramEditorOutlinePage.java

示例4: createViewer

import org.eclipse.gef.KeyHandler; //导入依赖的package包/类
/**
 * Creates the viewer for the relations pane.
 *
 * @param inParent
 *            Composite
 * @return GraphicalViewer
 */
public GraphicalViewer createViewer(final Composite inParent) {
	final GraphicalViewer outViewer = new ScrollingGraphicalViewer();
	outViewer.createControl(inParent);

	// configure the viewer
	outViewer.getControl().setBackground(BG_COLOR);
	rootPart = new RelationsRootEditPart();
	outViewer.setRootEditPart(rootPart);

	final KeyHandler lKeyHandler = new BrowserKeyHandler(outViewer);
	lKeyHandler.put(KeyStroke.getPressed(SWT.CONTROL, SWT.NONE), new Action() {
		@Override
		public void run() {
			rootPart.makeMousOverPartClickable(true);
		}
	});
	lKeyHandler.put(KeyStroke.getReleased(SWT.CONTROL, SWT.CONTROL), new Action() {
		@Override
		public void run() {
			rootPart.makeMousOverPartClickable(false);
		}
	});
	outViewer.setKeyHandler(lKeyHandler);

	outViewer.setEditPartFactory(getEditPartFactory());

	return outViewer;
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:36,代码来源:GraphicalViewerCreator.java

示例5: configureKeyHandler

import org.eclipse.gef.KeyHandler; //导入依赖的package包/类
void configureKeyHandler() {
	KeyHandler keyHandler = new KeyHandler();
	IAction delete = actionRegistry.getAction(org.eclipse.ui.actions.ActionFactory.DELETE.getId());
	IAction zoomIn = actionRegistry.getAction(GEFActionConstants.ZOOM_IN);
	IAction zoomOut = actionRegistry.getAction(GEFActionConstants.ZOOM_OUT);
	keyHandler.put(KeyStroke.getPressed(SWT.DEL, 127, 0), delete);
	keyHandler.put(KeyStroke.getPressed('+', SWT.KEYPAD_ADD, 0), zoomIn);
	keyHandler.put(KeyStroke.getPressed('-', SWT.KEYPAD_SUBTRACT, 0), zoomOut);
	viewer.setKeyHandler(keyHandler);
}
 
开发者ID:GreenDelta,项目名称:olca-app,代码行数:11,代码来源:GraphConfig.java

示例6: configureGraphicalViewer

import org.eclipse.gef.KeyHandler; //导入依赖的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);
}
 
开发者ID:GreenDelta,项目名称:olca-app,代码行数:38,代码来源:SankeyDiagram.java

示例7: configureGraphicalViewer

import org.eclipse.gef.KeyHandler; //导入依赖的package包/类
/**
 * @generated NOT
 */
protected void configureGraphicalViewer() {
    super.configureGraphicalViewer();
    DiagramEditorContextMenuProvider provider = new DiagramEditorContextMenuProvider(
            this, getDiagramGraphicalViewer());
    getDiagramGraphicalViewer().setContextMenu(provider);
    getSite().registerContextMenu(ActionIds.DIAGRAM_EDITOR_CONTEXT_MENU,
            provider, getDiagramGraphicalViewer());

    // sets a key handler.
    IDiagramGraphicalViewer viewer = getDiagramGraphicalViewer();
    KeyHandler dcaseKeyHandler = new DcaseDiagramKeyHandler(viewer);
    dcaseKeyHandler.setParent(viewer.getKeyHandler());
    viewer.setKeyHandler(dcaseKeyHandler);
}
 
开发者ID:d-case,项目名称:d-case_editor,代码行数:18,代码来源:DcaseDiagramEditor.java

示例8: configureGraphicalViewer

import org.eclipse.gef.KeyHandler; //导入依赖的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

示例9: registerKeyHandler

import org.eclipse.gef.KeyHandler; //导入依赖的package包/类
private void registerKeyHandler() {
	GraphicalViewerKeyHandler graphicalViewerKeyHandler = new GraphicalViewerKeyHandler(getGraphicalViewer());
	KeyHandler parentKeyHandler = graphicalViewerKeyHandler.setParent(getCommonKeyHandler());
	getGraphicalViewer().setKeyHandler(parentKeyHandler);
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:6,代码来源:DbToolGefEditor.java

示例10: getCommonKeyHandler

import org.eclipse.gef.KeyHandler; //导入依赖的package包/类
public KeyHandler getCommonKeyHandler() {
	KeyHandler sharedKeyHandler = new KeyHandler();
	sharedKeyHandler.put(KeyStroke.getPressed(SWT.DEL, 127, 0), getActionRegistry().getAction(ActionFactory.DELETE.getId()));
	sharedKeyHandler.put(KeyStroke.getReleased((char)1, 97, SWT.CTRL), getActionRegistry().getAction(ActionFactory.SELECT_ALL.getId()));
	return sharedKeyHandler;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:7,代码来源:DbToolGefEditor.java

示例11: getKeyHandler

import org.eclipse.gef.KeyHandler; //导入依赖的package包/类
/**
 * @see EditPartViewer#getKeyHandler()
 */
public KeyHandler getKeyHandler() {
	return keyHandler;
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:7,代码来源:AbstractEditPartViewer.java

示例12: setKeyHandler

import org.eclipse.gef.KeyHandler; //导入依赖的package包/类
/**
 * @see EditPartViewer#setKeyHandler(KeyHandler)
 */
public void setKeyHandler(KeyHandler handler) {
	keyHandler = handler;
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:7,代码来源:AbstractEditPartViewer.java

示例13: setParent

import org.eclipse.gef.KeyHandler; //导入依赖的package包/类
public KeyHandler setParent( KeyHandler parent )
{
	return super.setParent( parent );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:5,代码来源:GraphicalViewerKeyHandler.java

示例14: GraphicsEditorOutlinePage

import org.eclipse.gef.KeyHandler; //导入依赖的package包/类
/**
 * Creates a new GraphicsEditorOutlinePage. It is important, that this
 * outline page uses the same handlers (ActionRegistry, KeyHandler,
 * ZoomManagerAdapter, ...) as the main editor, so that the behaviour is
 * synchronized between them.
 * 
 * @param viewer
 *            The viewer (typically a tree-viewer) for the hierarchical
 *            outline.
 * @param graphicalViewer
 *            The GraphicalViewer for the Thumbnail.
 * @param actionRegistry
 *            The ActionRegistry to find/register Actions.
 * @param editDomain
 *            The EditDomain to use for Commands.
 * @param keyHandler
 *            The KeyHandler to use.
 * @param zoomManagerAdapter
 *            The ZoomManagerAdapter to use for the Thumbnail-Display.
 * @param selectionSynchronizer
 *            The selection-synchronizer for the main-editor and this
 *            outline page.
 * @param configurationProviderHolder
 *            the configuration provider holder
 */
public GraphicsEditorOutlinePage(EditPartViewer viewer, GraphicalViewer graphicalViewer, ActionRegistry actionRegistry,
		EditDomain editDomain, KeyHandler keyHandler, Object zoomManagerAdapter, SelectionSynchronizer selectionSynchronizer,
		DiagramEditor diagramEditor) {
	super(viewer);
	_graphicalViewer = graphicalViewer;
	_actionRegistry = actionRegistry;
	_editDomain = editDomain;
	_keyHandler = keyHandler;
	_zoomManagerAdapter = zoomManagerAdapter;
	_selectionSynchronizer = selectionSynchronizer;
	_diagramEditor = diagramEditor;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:38,代码来源:GraphicsEditorOutlinePage.java

示例15: createKeyHandler

import org.eclipse.gef.KeyHandler; //导入依赖的package包/类
/**
 * KeyHandler를 생성한다.
 * 
 * @return
 */
protected KeyHandler createKeyHandler(GraphicalViewer viewer) {
    return new GraphicalViewerKeyHandler(viewer).setParent(getKeyHandler());
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:9,代码来源:AbstractDiagramEditor.java


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