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;
}
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();
}
}
}
}
}
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;
}
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);
}
}
}
}
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;
}
Aggregations