Search in sources :

Example 1 with IPrimaryEditPart

use of org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart in project statecharts by Yakindu.

the class ToggleShowDocumentationCommand method unwrap.

protected List<View> unwrap(ISelection selection) {
    List<View> result = new ArrayList<View>();
    IStructuredSelection structuredSelection = (IStructuredSelection) selection;
    for (@SuppressWarnings("unchecked") Iterator<GraphicalEditPart> iter = structuredSelection.iterator(); iter.hasNext(); ) {
        GraphicalEditPart next = iter.next();
        while (next != null && !(next instanceof IPrimaryEditPart)) {
            next = (GraphicalEditPart) next.getParent();
        }
        if (next != null && next.getModel() instanceof View)
            result.add((View) next.getModel());
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) View(org.eclipse.gmf.runtime.notation.View) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) IPrimaryEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart)

Example 2 with IPrimaryEditPart

use of org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart in project statecharts by Yakindu.

the class HighlightingSupportAdapter method lockEditorInternal.

private void lockEditorInternal() {
    setSanityCheckEnablementState(false);
    for (Object editPart : diagramWorkbenchPart.getDiagramGraphicalViewer().getEditPartRegistry().values()) {
        if (editPart instanceof IPrimaryEditPart) {
            IGraphicalEditPart graphicalEditPart = (IGraphicalEditPart) editPart;
            IFigure figure = getTargetFigure(graphicalEditPart);
            figureStates.put(figure, new ColorMemento(figure));
        }
    }
    locked = true;
}
Also used : IGraphicalEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) EObject(org.eclipse.emf.ecore.EObject) IPrimaryEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart) IFigure(org.eclipse.draw2d.IFigure)

Example 3 with IPrimaryEditPart

use of org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart in project statecharts by Yakindu.

the class DiagramPartitioningUtil method selectElementsInDiagram.

public static void selectElementsInDiagram(IDiagramWorkbenchPart diagramPart, List<EditPart> editParts) {
    diagramPart.getDiagramGraphicalViewer().deselectAll();
    EditPart firstPrimary = null;
    for (Iterator<EditPart> it = editParts.iterator(); it.hasNext(); ) {
        EditPart nextPart = it.next();
        diagramPart.getDiagramGraphicalViewer().appendSelection(nextPart);
        if (firstPrimary == null && nextPart instanceof IPrimaryEditPart) {
            firstPrimary = nextPart;
        }
    }
    if (!editParts.isEmpty()) {
        diagramPart.getDiagramGraphicalViewer().reveal(firstPrimary != null ? firstPrimary : (EditPart) editParts.get(0));
    }
}
Also used : IPrimaryEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart) EditPart(org.eclipse.gef.EditPart) IPrimaryEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart)

Aggregations

IPrimaryEditPart (org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart)3 ArrayList (java.util.ArrayList)1 IFigure (org.eclipse.draw2d.IFigure)1 EObject (org.eclipse.emf.ecore.EObject)1 EditPart (org.eclipse.gef.EditPart)1 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)1 IGraphicalEditPart (org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)1 View (org.eclipse.gmf.runtime.notation.View)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1