Search in sources :

Example 1 with EditPartFactory

use of org.eclipse.gef.EditPartFactory in project webtools.sourceediting by eclipse.

the class InternalXSDMultiPageEditor method configureGraphicalViewer.

protected void configureGraphicalViewer() {
    super.configureGraphicalViewer();
    graphicalViewer.getKeyHandler().put(KeyStroke.getPressed(SWT.F2, 0), getActionRegistry().getAction(GEFActionConstants.DIRECT_EDIT));
    // get edit part factory from extension
    EditPartFactory editPartFactory = getEditorModeManager().getCurrentMode().getEditPartFactory();
    graphicalViewer.setEditPartFactory(editPartFactory);
}
Also used : EditPartFactory(org.eclipse.gef.EditPartFactory)

Example 2 with EditPartFactory

use of org.eclipse.gef.EditPartFactory in project webtools.sourceediting by eclipse.

the class InternalXSDMultiPageEditor method editorModeChanged.

public void editorModeChanged(EditorMode newEditorMode) {
    // if (isInitializing)
    // return;
    EditPartFactory editPartFactory = newEditorMode.getEditPartFactory();
    if (editPartFactory != null) {
        graphicalViewer.setEditPartFactory(editPartFactory);
        if (graphicalViewer instanceof DesignViewGraphicalViewer) {
            DesignViewGraphicalViewer viewer = (DesignViewGraphicalViewer) graphicalViewer;
            IADTObject input = viewer.getInput();
            viewer.setInput(null);
            // viewer.getRootEditPart().refresh();
            // viewer.getRootEditPart().getContents().refresh();
            viewer.setInput(input);
            floatingToolbar.setEditPartFactory(editPartFactory);
            floatingToolbar.setModel(getModel());
            floatingToolbar.refresh(!(input instanceof IModel));
            Control control = graphicalViewer.getControl();
            if (control instanceof Composite) {
                Composite parent = ((Composite) control).getParent();
                parent.layout();
            }
        }
    }
    IContentProvider provider = newEditorMode.getOutlineProvider();
    if (provider != null) {
        ADTContentOutlinePage outline = (ADTContentOutlinePage) getContentOutlinePage();
        if (outline != null) {
            TreeViewer treeViewer = outline.getTreeViewer();
            if (treeViewer != null) {
                outline.getTreeViewer().setContentProvider(provider);
                outline.getTreeViewer().refresh();
            }
        }
    }
}
Also used : DesignViewGraphicalViewer(org.eclipse.wst.xsd.ui.internal.adt.design.DesignViewGraphicalViewer) IModel(org.eclipse.wst.xsd.ui.internal.adt.facade.IModel) Control(org.eclipse.swt.widgets.Control) Composite(org.eclipse.swt.widgets.Composite) IContentProvider(org.eclipse.jface.viewers.IContentProvider) IADTObject(org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject) TreeViewer(org.eclipse.jface.viewers.TreeViewer) EditPartFactory(org.eclipse.gef.EditPartFactory) ADTContentOutlinePage(org.eclipse.wst.xsd.ui.internal.adt.outline.ADTContentOutlinePage)

Example 3 with EditPartFactory

use of org.eclipse.gef.EditPartFactory in project webtools.sourceediting by eclipse.

the class ADTMultiPageEditor method createGraphPageComposite.

protected Composite createGraphPageComposite() {
    Composite parent = new Composite(getContainer(), SWT.FLAT);
    parent.setBackground(ColorConstants.white);
    parent.setLayout(new InternalLayout());
    floatingToolbar = new ADTFloatingToolbar(getModel());
    floatingToolbar.createControl(parent);
    floatingToolbar.getControl().setVisible(true);
    EditPartFactory editPartFactory = getEditorModeManager().getCurrentMode().getEditPartFactory();
    floatingToolbar.setEditPartFactory(editPartFactory);
    createViewModeToolbar(parent);
    return parent;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) EditPartFactory(org.eclipse.gef.EditPartFactory) ADTEditPartFactory(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.ADTEditPartFactory) ADTFloatingToolbar(org.eclipse.wst.xsd.ui.internal.adt.design.ADTFloatingToolbar)

Example 4 with EditPartFactory

use of org.eclipse.gef.EditPartFactory in project webtools.sourceediting by eclipse.

the class ConnectableEditPart method getExtendedFigureFactory.

public IExtendedFigureFactory getExtendedFigureFactory() {
    EditPartFactory factory = getViewer().getEditPartFactory();
    // $NON-NLS-1$
    Assert.isTrue(factory instanceof IExtendedFigureFactory, "EditPartFactory must be an instanceof of IExtendedFigureFactory");
    return (IExtendedFigureFactory) factory;
}
Also used : IExtendedFigureFactory(org.eclipse.wst.xsd.ui.internal.design.figures.IExtendedFigureFactory) EditPartFactory(org.eclipse.gef.EditPartFactory)

Example 5 with EditPartFactory

use of org.eclipse.gef.EditPartFactory 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)

Aggregations

EditPartFactory (org.eclipse.gef.EditPartFactory)8 Composite (org.eclipse.swt.widgets.Composite)3 IExtendedFigureFactory (org.eclipse.wst.xsd.ui.internal.design.figures.IExtendedFigureFactory)2 IDiagramEditorFactory (com.archimatetool.editor.diagram.IDiagramEditorFactory)1 ArchimateDiagramEditPartFactory (com.archimatetool.editor.diagram.editparts.ArchimateDiagramEditPartFactory)1 SketchEditPartFactory (com.archimatetool.editor.diagram.sketch.editparts.SketchEditPartFactory)1 IArchimateDiagramModel (com.archimatetool.model.IArchimateDiagramModel)1 ISketchModel (com.archimatetool.model.ISketchModel)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)1 RootEditPart (org.eclipse.gef.RootEditPart)1 FreeformGraphicalRootEditPart (org.eclipse.gef.editparts.FreeformGraphicalRootEditPart)1 GraphicalViewerImpl (org.eclipse.gef.ui.parts.GraphicalViewerImpl)1 ScrollingGraphicalViewer (org.eclipse.gef.ui.parts.ScrollingGraphicalViewer)1 IContentProvider (org.eclipse.jface.viewers.IContentProvider)1 TreeViewer (org.eclipse.jface.viewers.TreeViewer)1 FillLayout (org.eclipse.swt.layout.FillLayout)1 Control (org.eclipse.swt.widgets.Control)1 IXSDToolbarAction (org.eclipse.wst.xsd.ui.internal.actions.IXSDToolbarAction)1