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


Java GraphicalViewer.setContents方法代码示例

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


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

示例1: initializeGraphicalViewer

import org.eclipse.gef.GraphicalViewer; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void initializeGraphicalViewer() {
    final GraphicalViewer viewer = getGraphicalViewer();
    viewer.setEditPartFactory(editPartFactory);

    initViewerAction(viewer);
    initDragAndDrop(viewer);

    viewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.MOD1), MouseWheelZoomHandler.SINGLETON);
    viewer.setProperty(SnapToGrid.PROPERTY_GRID_ENABLED, true);
    viewer.setProperty(SnapToGrid.PROPERTY_GRID_VISIBLE, true);
    viewer.setProperty(SnapToGeometry.PROPERTY_SNAP_ENABLED, true);

    final MenuManager menuMgr = new ERDiagramPopupMenuManager(getActionRegistry(), diagram);

    extensionLoader.addERDiagramPopupMenu(menuMgr, getActionRegistry());

    viewer.setContextMenu(menuMgr);

    viewer.setContents(diagram);

    outlineMenuMgr = new ERDiagramOutlinePopupMenuManager(diagram, getActionRegistry(), outlinePage.getOutlineActionRegistory(), outlinePage.getViewer());
}
 
开发者ID:roundrop,项目名称:ermasterr,代码行数:27,代码来源:ERDiagramEditor.java

示例2: initializeGraphicalViewer

import org.eclipse.gef.GraphicalViewer; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void initializeGraphicalViewer() {
	GraphicalViewer viewer = this.getGraphicalViewer();
	viewer.setEditPartFactory(editPartFactory);

	this.initViewerAction(viewer);
	this.initDragAndDrop(viewer);

	viewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.MOD1),
			MouseWheelZoomHandler.SINGLETON);
	viewer.setProperty(SnapToGrid.PROPERTY_GRID_ENABLED, true);
	viewer.setProperty(SnapToGrid.PROPERTY_GRID_VISIBLE, true);
	viewer.setProperty(SnapToGeometry.PROPERTY_SNAP_ENABLED, true);

	MenuManager menuMgr = new ERDiagramPopupMenuManager(
			this.getActionRegistry(), this.diagram, this);

	this.extensionLoader.addERDiagramPopupMenu(menuMgr,
			this.getActionRegistry());

	viewer.setContextMenu(menuMgr);

	viewer.setContents(diagram);
}
 
开发者ID:kozake,项目名称:ermaster-k,代码行数:28,代码来源:ERDiagramEditor.java

示例3: setRuler

import org.eclipse.gef.GraphicalViewer; //导入方法依赖的package包/类
private void setRuler(RulerProvider provider, int orientation) {
	Object ruler = null;
	if (isRulerVisible && provider != null)
		// provider.getRuler() might return null (at least the API does not prevent that)
		ruler = provider.getRuler();

	if (ruler == null) {
		// Ruler is not visible or is not present
		setRulerContainer(null, orientation);
		// Layout right-away to prevent an empty control from showing
		layout(true);
		return;
	}

	GraphicalViewer container = getRulerContainer(orientation);
	if (container == null) {
		container = createRulerContainer(orientation);
		setRulerContainer(container, orientation);
	}
	if (container.getContents() != ruler) {
		container.setContents(ruler);
		needToLayout = true;
		Display.getCurrent().asyncExec(runnable);
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:26,代码来源:JDRulerComposite.java

示例4: initializeGraphicalViewer

import org.eclipse.gef.GraphicalViewer; //导入方法依赖的package包/类
protected void initializeGraphicalViewer() {
	GraphicalViewer viewer = getGraphicalViewer();
	if (viewer == null)
		return;
	viewer.setContents(gWGraph);
	viewer.addSelectionChangedListener(GraphSelectionManager.ME);
	viewer.getControl().addMouseListener(GraphSelectionManager.ME);
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:9,代码来源:GW4EEditor.java

示例5: initializeGraphicalViewer

import org.eclipse.gef.GraphicalViewer; //导入方法依赖的package包/类
@Override
protected void initializeGraphicalViewer() {
	super.initializeGraphicalViewer();

	GraphicalViewer viewer = getGraphicalViewer();
	viewer.setContents(modelWrapped);
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:8,代码来源:DwGraphicalFeatureModelViewer.java

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

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

示例8: initializeGraphicalViewer

import org.eclipse.gef.GraphicalViewer; //导入方法依赖的package包/类
/**
 * @see org.eclipse.gef.ui.parts.GraphicalEditorWithFlyoutPalette#initializeGraphicalViewer()
 */
@Override
protected void initializeGraphicalViewer() {
    super.initializeGraphicalViewer();
    GraphicalViewer viewer = getGraphicalViewer();
    viewer.setContents(diagramEditDomain.getDiagram());
    viewer.addDropTargetListener(createDropTagertListener());
    
    this.recorder = new ChangeRecorder(getDiagram());
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:13,代码来源:AbstractDiagramEditor.java

示例9: prepareERDiagramPopupMenu

import org.eclipse.gef.GraphicalViewer; //导入方法依赖的package包/类
@Override
protected void prepareERDiagramPopupMenu(final GraphicalViewer viewer) {
    final MenuManager menuMgr = new ERVirtualDiagramPopupMenuManager(getActionRegistry(), vdiagram);
    extensionLoader.addERDiagramPopupMenu(menuMgr, getActionRegistry());
    viewer.setContextMenu(menuMgr);
    viewer.setContents(vdiagram);
}
 
开发者ID:dbflute-session,项目名称:erflute,代码行数:8,代码来源:VirtualDiagramEditor.java

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


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