Search in sources :

Example 1 with RootEditPart

use of org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootEditPart in project webtools.sourceediting by eclipse.

the class XSDGraphViewerDialog method createDialogArea.

protected Control createDialogArea(Composite parent) {
    viewer = new ScrollingGraphicalViewer();
    Composite c = (Composite) super.createDialogArea(parent);
    if (isHighContrast) {
        c.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    } else {
        c.setBackground(ColorConstants.white);
    }
    c.setLayout(new FillLayout());
    RootEditPart root = new RootEditPart();
    viewer.setRootEditPart(root);
    viewer.createControl(c);
    // The graphical viewer tool tip processing creates an extra shell which
    // interferes with the PopupDialog's deactivation logic.
    removeMouseListeners(viewer.getControl());
    if (isHighContrast) {
        viewer.getControl().setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    } else {
        viewer.getControl().setBackground(ColorConstants.white);
    }
    EditPartFactory editPartFactory = new XSDEditPartFactory(new TypeVizFigureFactory());
    viewer.setEditPartFactory(editPartFactory);
    RootContentEditPart rootContentEditPart = new RootContentEditPart();
    rootContentEditPart.setModel(model);
    viewer.setContents(rootContentEditPart);
    getShell().addControlListener(moveListener);
    return c;
}
Also used : ScrollingGraphicalViewer(org.eclipse.gef.ui.parts.ScrollingGraphicalViewer) Composite(org.eclipse.swt.widgets.Composite) XSDEditPartFactory(org.eclipse.wst.xsd.ui.internal.design.editparts.XSDEditPartFactory) EditPartFactory(org.eclipse.gef.EditPartFactory) FillLayout(org.eclipse.swt.layout.FillLayout) RootContentEditPart(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootContentEditPart) TypeVizFigureFactory(org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.TypeVizFigureFactory) RootEditPart(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootEditPart) XSDEditPartFactory(org.eclipse.wst.xsd.ui.internal.design.editparts.XSDEditPartFactory)

Example 2 with RootEditPart

use of org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootEditPart in project webtools.sourceediting by eclipse.

the class CommonMultiPageEditor method configureGraphicalViewer.

protected void configureGraphicalViewer() {
    graphicalViewer.getControl().setBackground(ColorConstants.listBackground);
    // Set the root edit part
    // ScalableFreeformRootEditPart root = new ScalableFreeformRootEditPart();
    RootEditPart root = new RootEditPart();
    ZoomManager zoomManager = root.getZoomManager();
    List zoomLevelContributions = new ArrayList(3);
    zoomLevelContributions.add(ZoomManager.FIT_ALL);
    zoomLevelContributions.add(ZoomManager.FIT_WIDTH);
    zoomLevelContributions.add(ZoomManager.FIT_HEIGHT);
    zoomManager.setZoomLevelContributions(zoomLevelContributions);
    double[] zoomLevels = { .10, .25, .5, .75, 1.0, 1.25, 1.5, 2.0, 2.5, 3, 4, 5 };
    zoomManager.setZoomLevels(zoomLevels);
    IAction zoomIn = new ZoomInAction(zoomManager);
    IAction zoomOut = new ZoomOutAction(zoomManager);
    getActionRegistry().registerAction(zoomIn);
    getActionRegistry().registerAction(zoomOut);
    getSite().getKeyBindingService().registerAction(zoomIn);
    getSite().getKeyBindingService().registerAction(zoomOut);
    // ConnectionLayer connectionLayer = (ConnectionLayer) root.getLayer(LayerConstants.CONNECTION_LAYER);
    // connectionLayer.setConnectionRouter(new BendpointConnectionRouter());
    // connectionLayer.setConnectionRouter(new ShortestPathConnectionRouter(connectionLayer));
    // connectionLayer.setVisible(false);
    // Zoom
    zoomManager.setZoom(1.0);
    // Scroll-wheel Zoom
    graphicalViewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.CTRL), MouseWheelZoomHandler.SINGLETON);
    graphicalViewer.setRootEditPart(root);
    graphicalViewer.setEditPartFactory(getEditPartFactory());
}
Also used : IAction(org.eclipse.jface.action.IAction) ZoomOutAction(org.eclipse.gef.ui.actions.ZoomOutAction) ZoomManager(org.eclipse.gef.editparts.ZoomManager) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) ZoomInAction(org.eclipse.gef.ui.actions.ZoomInAction) RootEditPart(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootEditPart)

Aggregations

RootEditPart (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootEditPart)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 EditPartFactory (org.eclipse.gef.EditPartFactory)1 ZoomManager (org.eclipse.gef.editparts.ZoomManager)1 ZoomInAction (org.eclipse.gef.ui.actions.ZoomInAction)1 ZoomOutAction (org.eclipse.gef.ui.actions.ZoomOutAction)1 ScrollingGraphicalViewer (org.eclipse.gef.ui.parts.ScrollingGraphicalViewer)1 IAction (org.eclipse.jface.action.IAction)1 FillLayout (org.eclipse.swt.layout.FillLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 RootContentEditPart (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootContentEditPart)1 TypeVizFigureFactory (org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.TypeVizFigureFactory)1 XSDEditPartFactory (org.eclipse.wst.xsd.ui.internal.design.editparts.XSDEditPartFactory)1