Search in sources :

Example 6 with GraphicalViewerImpl

use of org.eclipse.gef.ui.parts.GraphicalViewerImpl in project archi by archimatetool.

the class DiagramUtilsTests method testGetDiagramExtents.

@Test
public void testGetDiagramExtents() {
    IDiagramModel dm = model.getDiagramModels().get(2);
    // x of furthest object in diagram, and its width
    int width = 720 + 193;
    // x of furthest object in diagram, and its height
    int height = 468 + 85;
    Shell shell = new Shell();
    GraphicalViewerImpl viewer = DiagramUtils.createViewer(dm, shell);
    shell.dispose();
    org.eclipse.draw2d.geometry.Rectangle rect = DiagramUtils.getDiagramExtents(viewer);
    assertEquals(new org.eclipse.draw2d.geometry.Rectangle(0, 0, width, height), rect);
}
Also used : Shell(org.eclipse.swt.widgets.Shell) IDiagramModel(com.archimatetool.model.IDiagramModel) GraphicalViewerImpl(org.eclipse.gef.ui.parts.GraphicalViewerImpl) Test(org.junit.Test)

Example 7 with GraphicalViewerImpl

use of org.eclipse.gef.ui.parts.GraphicalViewerImpl 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();
}
Also used : Shell(org.eclipse.swt.widgets.Shell) ArchimateDiagramEditPartFactory(com.archimatetool.editor.diagram.editparts.ArchimateDiagramEditPartFactory) IDiagramModel(com.archimatetool.model.IDiagramModel) GraphicalViewerImpl(org.eclipse.gef.ui.parts.GraphicalViewerImpl) FreeformGraphicalRootEditPart(org.eclipse.gef.editparts.FreeformGraphicalRootEditPart) IArchimateDiagramModel(com.archimatetool.model.IArchimateDiagramModel) Test(org.junit.Test)

Example 8 with GraphicalViewerImpl

use of org.eclipse.gef.ui.parts.GraphicalViewerImpl in project liferay-ide by liferay.

the class LayoutTplPreviewEditor method createGraphicalViewer.

protected void createGraphicalViewer(Composite parent) {
    GraphicalViewer viewer = new GraphicalViewerImpl();
    viewer.createControl(parent);
    setGraphicalViewer(viewer);
    configureGraphicalViewer();
    hookGraphicalViewer();
    initializeGraphicalViewer();
}
Also used : GraphicalViewer(org.eclipse.gef.GraphicalViewer) GraphicalViewerImpl(org.eclipse.gef.ui.parts.GraphicalViewerImpl)

Aggregations

GraphicalViewerImpl (org.eclipse.gef.ui.parts.GraphicalViewerImpl)8 IDiagramModel (com.archimatetool.model.IDiagramModel)6 Shell (org.eclipse.swt.widgets.Shell)6 Test (org.junit.Test)6 FreeformGraphicalRootEditPart (org.eclipse.gef.editparts.FreeformGraphicalRootEditPart)3 ArchimateDiagramEditPartFactory (com.archimatetool.editor.diagram.editparts.ArchimateDiagramEditPartFactory)2 SketchEditPartFactory (com.archimatetool.editor.diagram.sketch.editparts.SketchEditPartFactory)2 IArchimateDiagramModel (com.archimatetool.model.IArchimateDiagramModel)2 ISketchModel (com.archimatetool.model.ISketchModel)2 IDiagramEditorFactory (com.archimatetool.editor.diagram.IDiagramEditorFactory)1 EditPartFactory (org.eclipse.gef.EditPartFactory)1 GraphicalViewer (org.eclipse.gef.GraphicalViewer)1 RootEditPart (org.eclipse.gef.RootEditPart)1 Image (org.eclipse.swt.graphics.Image)1