use of org.eclipse.gef.editparts.FreeformGraphicalRootEditPart in project cubrid-manager by CUBRID.
the class ERSchemaEditDomain method mouseDown.
/**
* the button in the para of mouseEvent, that was pressed or released; 1 for
* the left click, 2 for the double left-click, and 3 for the right click,
* etc.
*/
public void mouseDown(MouseEvent mouseEvent, EditPartViewer viewer) {
ERSchemaEditor erschemaEditor = (ERSchemaEditor) this.getEditorPart();
Point location = new Point(mouseEvent.x, mouseEvent.y);
EditPart part = erschemaEditor.getGraphicalViewer().findObjectAt(location);
if (part != null && ((part instanceof SchemaDiagramPart) || (part instanceof FreeformGraphicalRootEditPart))) {
if (getDefaultTool().equals(getActiveTool())) {
setActiveTool(erDragTool);
// when click on "FreeformGraphicalRootEditPart", its on the
// extending space of "EXDefaultRangeModel"
}
}
if (mouseEvent.button == 3 && !getDefaultTool().equals(getActiveTool())) {
// mouseEvent.button == 3 : right click
setActiveTool(getDefaultTool());
}
super.mouseDown(mouseEvent, viewer);
if (part != null && part instanceof SchemaDiagramPart) {
erschemaEditor.setAllFiguresOrigin();
}
}
use of org.eclipse.gef.editparts.FreeformGraphicalRootEditPart in project dbeaver by dbeaver.
the class LockGraphicalView method createPartControl.
@Override
public void createPartControl(Composite parent) {
setEditDomain(new DefaultEditDomain(null));
setGraphicalViewer(new ScrollingGraphicalViewer());
getGraphicalViewer().createControl(parent);
getGraphicalViewer().setRootEditPart(new FreeformGraphicalRootEditPart());
getGraphicalViewer().setEditPartFactory(new LockGraphEditPartFactory());
getGraphicalViewer().setContextMenu(new ContextMenuProvider(graphicalViewer) {
@Override
public void buildContextMenu(IMenuManager menu) {
menu.add(viewer.getKillAction());
}
});
}
use of org.eclipse.gef.editparts.FreeformGraphicalRootEditPart in project archi by archimatetool.
the class DiagramUtils method createViewer.
/**
* Create a GraphicalViewerImpl to show the model. The Viewer has no Scroll Bars
* @param model
* @return A Graphical Viewer
*/
public static GraphicalViewerImpl createViewer(IDiagramModel model, Composite parent) {
EditPartFactory editPartFactory = null;
if (model instanceof IArchimateDiagramModel) {
editPartFactory = new ArchimateDiagramEditPartFactory();
} else if (model instanceof ISketchModel) {
editPartFactory = new SketchEditPartFactory();
} else {
// Extensions
IDiagramEditorFactory factory = DiagramEditorFactoryExtensionHandler.INSTANCE.getFactory(model);
if (factory != null) {
editPartFactory = factory.createEditPartFactory();
}
}
if (editPartFactory == null) {
// $NON-NLS-1$
throw new RuntimeException("Unsupported model type");
}
GraphicalViewerImpl viewer = new GraphicalViewerImpl();
viewer.createControl(parent);
viewer.setEditPartFactory(editPartFactory);
RootEditPart rootPart = new FreeformGraphicalRootEditPart();
viewer.setRootEditPart(rootPart);
viewer.setContents(model);
viewer.flush();
return viewer;
}
use of org.eclipse.gef.editparts.FreeformGraphicalRootEditPart in project archi by archimatetool.
the class DiagramUtilsTests method testCreateViewer_SketchModel.
@Test
public void testCreateViewer_SketchModel() {
IDiagramModel dm = model.getDiagramModels().get(1);
assertTrue(dm instanceof ISketchModel);
Shell shell = new Shell();
GraphicalViewerImpl viewer = DiagramUtils.createViewer(dm, shell);
assertNotNull(viewer);
assertTrue(viewer.getEditPartFactory() instanceof SketchEditPartFactory);
assertTrue(viewer.getRootEditPart() instanceof FreeformGraphicalRootEditPart);
assertSame(dm, viewer.getContents().getModel());
assertSame(shell, viewer.getControl().getShell());
shell.dispose();
}
use of org.eclipse.gef.editparts.FreeformGraphicalRootEditPart in project archi by archimatetool.
the class DiagramUtilsTests method testCreateViewer_ArchimateModel.
@Test
public void testCreateViewer_ArchimateModel() {
IDiagramModel dm = model.getDiagramModels().get(0);
assertTrue(dm instanceof IArchimateDiagramModel);
Shell shell = new Shell();
GraphicalViewerImpl viewer = DiagramUtils.createViewer(dm, shell);
assertNotNull(viewer);
assertTrue(viewer.getEditPartFactory() instanceof ArchimateDiagramEditPartFactory);
assertTrue(viewer.getRootEditPart() instanceof FreeformGraphicalRootEditPart);
assertSame(dm, viewer.getContents().getModel());
assertSame(shell, viewer.getControl().getShell());
shell.dispose();
}
Aggregations