本文整理汇总了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());
}
示例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);
}
示例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);
}
}
示例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);
}
示例5: initializeGraphicalViewer
import org.eclipse.gef.GraphicalViewer; //导入方法依赖的package包/类
@Override
protected void initializeGraphicalViewer() {
super.initializeGraphicalViewer();
GraphicalViewer viewer = getGraphicalViewer();
viewer.setContents(modelWrapped);
}
示例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);
}
示例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();
}
示例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());
}
示例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);
}
示例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();
}