diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/figure/AbstractBMotionFigure.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/figure/AbstractBMotionFigure.java index 7a9ea7ccf8c5887fad3db417e81377301f4b970a..1b784991b8e2460372a31be91324ec1df7bc5f68 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/figure/AbstractBMotionFigure.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/figure/AbstractBMotionFigure.java @@ -7,6 +7,9 @@ package de.bmotionstudio.gef.editor.figure; import org.eclipse.draw2d.Clickable; +import org.eclipse.draw2d.ColorConstants; +import org.eclipse.draw2d.Graphics; +import org.eclipse.draw2d.geometry.Rectangle; /** * @author Lukas Ladenberger @@ -14,10 +17,50 @@ import org.eclipse.draw2d.Clickable; */ public class AbstractBMotionFigure extends Clickable { + private boolean visible = true; + private boolean isRunning = false; + public void deactivateFigure() { } public void activateFigure() { } + @Override + public void setVisible(boolean visible) { + if (!isRunning()) { + this.visible = visible; + repaint(); + } else { + super.setVisible(visible); + } + } + + @Override + public void paint(Graphics g) { + + if (!this.visible && !isRunning) { + + Rectangle r = getClientArea(); + + g.setForegroundColor(ColorConstants.lightGray); + g.setLineStyle(Graphics.LINE_DOT); + g.drawRectangle(r.x, r.y, r.width - 1, r.height - 1); + + g.setAlpha(15); + + } + + super.paint(g); + + } + + public boolean isRunning() { + return isRunning; + } + + public void setRunning(boolean isRunning) { + this.isRunning = isRunning; + } + } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BMSAbstractEditPart.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BMSAbstractEditPart.java index f60a2947bd56f4cda2204553ea5a7fe61871a4ff..951a270cb5619f44b8fd3fdd1b8ec1a4decd10d5 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BMSAbstractEditPart.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BMSAbstractEditPart.java @@ -129,9 +129,12 @@ public abstract class BMSAbstractEditPart extends AbstractGraphicalEditPart IFigure toolTipFigure = getToolTip(); if (toolTipFigure != null) figure.setToolTip(toolTipFigure); - if (!isRunning()) { - if (figure instanceof AbstractBMotionFigure) { - ((AbstractBMotionFigure) figure).setEnabled(false); + if (figure instanceof AbstractBMotionFigure) { + AbstractBMotionFigure bmsFigure = (AbstractBMotionFigure) figure; + Boolean isRunning = isRunning(); + bmsFigure.setRunning(isRunning); + if (!isRunning) { + bmsFigure.setEnabled(false); } } return figure;