Search in sources :

Example 36 with IGraphicalEditPart

use of org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart 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 37 with IGraphicalEditPart

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

the class HighlightingSupportAdapter method highlight.

public void highlight(List<? extends EObject> semanticElements, HighlightingParameters parameters) {
    synchronized (semanticElements) {
        for (EObject semanticElement : semanticElements) {
            IGraphicalEditPart editPartForSemanticElement = getEditPartForSemanticElement(semanticElement);
            if (editPartForSemanticElement != null) {
                IFigure figure = getTargetFigure(editPartForSemanticElement);
                if (parameters != null) {
                    figure.setForegroundColor(parameters.foregroundFadingColor);
                    figure.setBackgroundColor(parameters.backgroundFadingColor);
                    figure.invalidate();
                } else {
                    flashingFigures.clear();
                    ColorMemento memento = figureStates.get(figure);
                    if (memento != null)
                        memento.restore();
                }
            }
        }
    }
}
Also used : IGraphicalEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) EObject(org.eclipse.emf.ecore.EObject) IFigure(org.eclipse.draw2d.IFigure)

Example 38 with IGraphicalEditPart

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

the class HighlightingSupportAdapter method getEditPartForSemanticElement.

private IGraphicalEditPart getEditPartForSemanticElement(EObject semanticElement) {
    IGraphicalEditPart result = object2editPart.get(semanticElement);
    if (result != null)
        return result;
    result = EditPartUtils.findEditPartForSemanticElement(diagramWorkbenchPart.getDiagramGraphicalViewer().getRootEditPart(), semanticElement);
    object2editPart.put(semanticElement, result);
    return result;
}
Also used : IGraphicalEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)

Example 39 with IGraphicalEditPart

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

the class HighlightingSupportAdapter method flash.

public void flash(List<? extends EObject> semanticElements, HighlightingParameters parameters) {
    synchronized (semanticElements) {
        for (EObject semanticElement : semanticElements) {
            IGraphicalEditPart editPartForSemanticElement = getEditPartForSemanticElement(semanticElement);
            if (editPartForSemanticElement != null) {
                IFigure figure = getTargetFigure(editPartForSemanticElement);
                Fader fader = new Fader(figure, figure.getForegroundColor(), parameters.foregroundFadingColor, figure.getBackgroundColor(), parameters.backgroundFadingColor, parameters.highlightTime, true, parameters.flashcounter, true);
                Display.getCurrent().asyncExec(fader);
            }
        }
    }
}
Also used : IGraphicalEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) EObject(org.eclipse.emf.ecore.EObject) IFigure(org.eclipse.draw2d.IFigure)

Example 40 with IGraphicalEditPart

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

the class EnlargeContainerEditPolicy method calculateFeedbackBounds.

@SuppressWarnings({ "unchecked" })
private Rectangle calculateFeedbackBounds(ChangeBoundsRequest request, Rectangle feedbackBounds, int level, IFigure containerFigure) {
    Rectangle result = feedbackBounds.getCopy();
    List<IGraphicalEditPart> editParts = request.getEditParts();
    for (IGraphicalEditPart editPart : editParts) {
        PrecisionRectangle transformedRect = new PrecisionRectangle(editPart.getFigure().getBounds());
        editPart.getFigure().translateToAbsolute(transformedRect);
        transformedRect.translate(request.getMoveDelta());
        transformedRect.resize(request.getSizeDelta());
        transformedRect.expand(SPACEING * level, SPACEING * level);
        result.union(transformedRect);
        Dimension preferredSize = containerFigure.getPreferredSize().getCopy();
        editPart.getFigure().translateToAbsolute(preferredSize);
        Dimension max = Dimension.max(result.getSize(), preferredSize);
        result.setSize(max);
        if (result.x < feedbackBounds.x || result.y < feedbackBounds.y) {
            return feedbackBounds;
        }
    }
    return result;
}
Also used : IGraphicalEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) PrecisionRectangle(org.eclipse.draw2d.geometry.PrecisionRectangle) PrecisionRectangle(org.eclipse.draw2d.geometry.PrecisionRectangle) Rectangle(org.eclipse.draw2d.geometry.Rectangle) Dimension(org.eclipse.draw2d.geometry.Dimension)

Aggregations

IGraphicalEditPart (org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)43 ArrayList (java.util.ArrayList)10 EObject (org.eclipse.emf.ecore.EObject)10 View (org.eclipse.gmf.runtime.notation.View)10 List (java.util.List)8 Point (org.eclipse.draw2d.geometry.Point)8 Rectangle (org.eclipse.draw2d.geometry.Rectangle)7 TransactionalEditingDomain (org.eclipse.emf.transaction.TransactionalEditingDomain)7 ICommandProxy (org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy)7 IFigure (org.eclipse.draw2d.IFigure)6 BusinessItemShapeEditPart (org.talend.designer.business.diagram.custom.edit.parts.BusinessItemShapeEditPart)5 PrecisionRectangle (org.eclipse.draw2d.geometry.PrecisionRectangle)4 Command (org.eclipse.gef.commands.Command)4 CompositeTransactionalCommand (org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand)3 EObjectAdapter (org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter)3 IElementType (org.eclipse.gmf.runtime.emf.type.core.IElementType)3 Iterator (java.util.Iterator)2 Connection (org.eclipse.draw2d.Connection)2 RoundedRectangle (org.eclipse.draw2d.RoundedRectangle)2 Dimension (org.eclipse.draw2d.geometry.Dimension)2