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


Java KeyHandler.put方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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


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