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


Java GraphicalViewer.setRootEditPart方法代码示例

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


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

示例1: configureGraphicalViewer

import org.eclipse.gef.GraphicalViewer; //导入方法依赖的package包/类
@Override
protected void configureGraphicalViewer() {
	super.configureGraphicalViewer();
	getGraphicalViewer().getControl().setBackground(ColorConstants.button);

	GraphicalViewer graphicalViewer = getGraphicalViewer();
	MainDesignerRootEditPart rootEditPart = new MainDesignerRootEditPart();

	graphicalViewer.setRootEditPart(rootEditPart);
	// set EditPartFactory
	graphicalViewer.setEditPartFactory(new JasperDesignEditPartFactory());

	// set rulers providers
	RulerProvider provider = new ReportRulerProvider(new ReportRuler(true, RulerProvider.UNIT_PIXELS));
	graphicalViewer.setProperty(RulerProvider.PROPERTY_HORIZONTAL_RULER, provider);

	provider = new ReportRulerProvider(new ReportRuler(false, RulerProvider.UNIT_PIXELS));
	graphicalViewer.setProperty(RulerProvider.PROPERTY_VERTICAL_RULER, provider);

	Boolean isRulerVisible = jrContext.getPropertyBoolean(RulersGridPreferencePage.P_PAGE_RULERGRID_SHOWRULER);

	graphicalViewer.setProperty(RulerProvider.PROPERTY_RULER_VISIBILITY, isRulerVisible);

	createAdditionalActions();
	graphicalViewer.setKeyHandler(new JSSGraphicalViewerKeyHandler(graphicalViewer));
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:27,代码来源:CrosstabEditor.java

示例2: prepareZoomContributions

import org.eclipse.gef.GraphicalViewer; //导入方法依赖的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);
	}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:39,代码来源:ELTGraphicalEditor.java

示例3: configureGraphicalViewer

import org.eclipse.gef.GraphicalViewer; //导入方法依赖的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 DwFeatureModelEditPartFactory(viewer, this));
	viewer.setRootEditPart(new ScalableFreeformRootEditPart());
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:12,代码来源:DwGraphicalFeatureModelViewer.java

示例4: configureGraphicalViewer

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

示例5: run

import org.eclipse.gef.GraphicalViewer; //导入方法依赖的package包/类
private static void run(final Display display, final int x) {
    final Shell shell = new Shell(display);
    shell.setBounds(0, 0, 350, 350);

    shell.setLayout(new FillLayout(SWT.VERTICAL));

    // display.syncExec(new Runnable() {
    // public void run() {

    final ERDiagramEditPartFactory editPartFactory = new ERDiagramEditPartFactory();
    final GraphicalViewer viewer = new ScrollingGraphicalViewer();
    viewer.setControl(new FigureCanvas(shell));

    final ScalableFreeformRootEditPart rootEditPart = new PagableFreeformRootEditPart(diagram);
    viewer.setRootEditPart(rootEditPart);

    viewer.setEditPartFactory(editPartFactory);
    viewer.setContents(diagram);

    viewer.getContents().refresh();

    // }
    // });

    shell.pack();
    shell.open();
    int count = 0;
    while (count < x) {
        if (!display.readAndDispatch()) {
            try {
                Thread.sleep(1000);
                count++;
            } catch (final InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
    viewer.getContents().deactivate();
    // display.dispose();
}
 
开发者ID:roundrop,项目名称:ermasterr,代码行数:41,代码来源:NoWindowTest.java

示例6: configureGraphicalViewer

import org.eclipse.gef.GraphicalViewer; //导入方法依赖的package包/类
/**
 * @see org.eclipse.gef.ui.parts.GraphicalEditor#configureGraphicalViewer()
 */
protected void configureGraphicalViewer() {
    super.configureGraphicalViewer();
    GraphicalViewer viewer = getGraphicalViewer();
    viewer.setEditPartFactory(createDiagramEditPartFactory());
    viewer.setRootEditPart(createRootEditPart());
    viewer.setKeyHandler(createKeyHandler(viewer));
    viewer.setContextMenu(createContextMenuProvider(viewer, getActionRegistry()));

    // viewer.getKeyHandler().put(KeyStroke.getPressed(SWT.DEL, 127, 0),
    // getActionRegistry().getAction(GEFActionConstants.DELETE));
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:15,代码来源:AbstractDiagramEditor.java

示例7: configureGraphicalViewer

import org.eclipse.gef.GraphicalViewer; //导入方法依赖的package包/类
@Override
protected void configureGraphicalViewer() {
	super.configureGraphicalViewer();
	getGraphicalViewer().getControl().setBackground(ColorConstants.button);

	GraphicalViewer graphicalViewer = getGraphicalViewer();
	MainDesignerRootEditPart rootEditPart = new MainDesignerRootEditPart();

	graphicalViewer.setRootEditPart(rootEditPart);
	// set EditPartFactory
	graphicalViewer.setEditPartFactory(new JasperDesignEditPartFactory());

	// set rulers providers
	RulerProvider provider = new ReportRulerProvider(new ReportRuler(true,
			RulerProvider.UNIT_PIXELS));
	graphicalViewer.setProperty(RulerProvider.PROPERTY_HORIZONTAL_RULER,
			provider);

	provider = new ReportRulerProvider(new ReportRuler(false,
			RulerProvider.UNIT_PIXELS));
	graphicalViewer.setProperty(RulerProvider.PROPERTY_VERTICAL_RULER,
			provider);

	Boolean isRulerVisible = jrContext
			.getPropertyBoolean(RulersGridPreferencePage.P_PAGE_RULERGRID_SHOWRULER);

	graphicalViewer.setProperty(RulerProvider.PROPERTY_RULER_VISIBILITY,
			isRulerVisible);

	createAdditionalActions();
	graphicalViewer.setKeyHandler(new JSSGraphicalViewerKeyHandler(
			graphicalViewer));
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:34,代码来源:ListEditor.java

示例8: configureGraphicalViewer

import org.eclipse.gef.GraphicalViewer; //导入方法依赖的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: run

import org.eclipse.gef.GraphicalViewer; //导入方法依赖的package包/类
private static void run(Display display, int x) {
	Shell shell = new Shell(display);
	shell.setBounds(0, 0, 350, 350);

	shell.setLayout(new FillLayout(SWT.VERTICAL));

	// display.syncExec(new Runnable() {
	// public void run() {

	ERDiagramEditPartFactory editPartFactory = new ERDiagramEditPartFactory();
	GraphicalViewer viewer = new ScrollingGraphicalViewer();
	viewer.setControl(new FigureCanvas(shell));

	ScalableFreeformRootEditPart rootEditPart = new PagableFreeformRootEditPart(
			diagram);
	viewer.setRootEditPart(rootEditPart);

	viewer.setEditPartFactory(editPartFactory);
	viewer.setContents(diagram);

	viewer.getContents().refresh();

	// }
	// });

	shell.pack();
	shell.open();
	int count = 0;
	while (count < x) {
		if (!display.readAndDispatch()) {
			try {
				Thread.sleep(1000);
				count++;
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
	viewer.getContents().deactivate();
	// display.dispose();
}
 
开发者ID:kozake,项目名称:ermaster-k,代码行数:42,代码来源:NoWindowTest.java

示例10: configureGraphicalViewer

import org.eclipse.gef.GraphicalViewer; //导入方法依赖的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);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:26,代码来源:AGraphicEditor.java

示例11: initViewerAction

import org.eclipse.gef.GraphicalViewer; //导入方法依赖的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);
}
 
开发者ID:dbflute-session,项目名称:erflute,代码行数:49,代码来源:MainDiagramEditor.java


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