Skip to content
Snippets Groups Projects
Commit ef88803b authored by Florian Hölzl's avatar Florian Hölzl
Browse files

fixed

refs 598
parent 87633004
No related branches found
No related tags found
No related merge requests found
...@@ -85,7 +85,6 @@ public abstract class ElementEditPartBase<T extends ILayoutedModelElement & INam ...@@ -85,7 +85,6 @@ public abstract class ElementEditPartBase<T extends ILayoutedModelElement & INam
nameLabel.setIcon(IModelElementHandlerService.INSTANCE nameLabel.setIcon(IModelElementHandlerService.INSTANCE
.getModelElementHandler(getModel()).getIcon()); .getModelElementHandler(getModel()).getIcon());
return nameLabel; return nameLabel;
} }
/** /**
......
...@@ -37,6 +37,7 @@ import org.eclipse.gef.tools.DragEditPartsTracker; ...@@ -37,6 +37,7 @@ import org.eclipse.gef.tools.DragEditPartsTracker;
import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Image;
import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
import org.fortiss.tooling.base.ui.editpart.figure.TransparentLabel;
import org.fortiss.tooling.base.ui.layout.IDiagramLayoutConfiguration; import org.fortiss.tooling.base.ui.layout.IDiagramLayoutConfiguration;
import org.fortiss.tooling.kernel.extension.data.IConstraintViolation; import org.fortiss.tooling.kernel.extension.data.IConstraintViolation;
import org.fortiss.tooling.kernel.extension.data.IConstraintViolation.ESeverity; import org.fortiss.tooling.kernel.extension.data.IConstraintViolation.ESeverity;
...@@ -73,7 +74,7 @@ import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService; ...@@ -73,7 +74,7 @@ import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService;
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating GREEN Hash: A3E4A702B8E644BAA152153CBEC63DB2 * @ConQAT.Rating YELLOW Hash: 5FE3D895F9E86F63B52B038EAF664C34
*/ */
public abstract class PositionedEditPartBase<T extends ILayoutedModelElement> public abstract class PositionedEditPartBase<T extends ILayoutedModelElement>
extends GraphicalEditPartBase<T> implements NodeEditPart { extends GraphicalEditPartBase<T> implements NodeEditPart {
...@@ -146,7 +147,7 @@ public abstract class PositionedEditPartBase<T extends ILayoutedModelElement> ...@@ -146,7 +147,7 @@ public abstract class PositionedEditPartBase<T extends ILayoutedModelElement>
* a figure. * a figure.
*/ */
protected Label createDecorationFigure() { protected Label createDecorationFigure() {
return new Label(); return new TransparentLabel();
} }
/** /**
...@@ -184,9 +185,7 @@ public abstract class PositionedEditPartBase<T extends ILayoutedModelElement> ...@@ -184,9 +185,7 @@ public abstract class PositionedEditPartBase<T extends ILayoutedModelElement>
baseFigure.getParent().setConstraint(baseFigure, baseBounds); baseFigure.getParent().setConstraint(baseFigure, baseBounds);
baseFigure.setForegroundColor(getForegroundColor()); baseFigure.setForegroundColor(getForegroundColor());
baseFigure.setBackgroundColor(getBackgroundColor()); baseFigure.setBackgroundColor(getBackgroundColor());
baseFigure.setToolTip(new Label( baseFigure.setToolTip(new Label(getBaseFigureTooltip()));
IModelElementHandlerService.INSTANCE
.getWrappedNameDescription(getModel())));
} }
if (labelFigure != null && labelFigure.getParent() != null) { if (labelFigure != null && labelFigure.getParent() != null) {
...@@ -201,6 +200,23 @@ public abstract class PositionedEditPartBase<T extends ILayoutedModelElement> ...@@ -201,6 +200,23 @@ public abstract class PositionedEditPartBase<T extends ILayoutedModelElement>
} }
} }
/** Returns the current tooltip description. */
protected String getBaseFigureTooltip() {
String message = IModelElementHandlerService.INSTANCE
.getWrappedNameDescription(getModel());
ESeverity sev = IMarkerService.INSTANCE
.getHighestViolationSeverity(getModel());
switch (sev) {
case ERROR:
message = getViolationMessage(sev);
break;
case WARNING:
message = getViolationMessage(sev);
break;
}
return message;
}
/** Refreshes the decoration figure using {@link IMarkerService} */ /** Refreshes the decoration figure using {@link IMarkerService} */
private void refreshDecorationFigure() { private void refreshDecorationFigure() {
Rectangle decorationBounds = determineDecorationFigureBounds(); Rectangle decorationBounds = determineDecorationFigureBounds();
...@@ -223,18 +239,20 @@ public abstract class PositionedEditPartBase<T extends ILayoutedModelElement> ...@@ -223,18 +239,20 @@ public abstract class PositionedEditPartBase<T extends ILayoutedModelElement>
default: default:
} }
decorationFigure.setIcon(icon); decorationFigure.setIcon(icon);
if (icon != null) { }
String message = "";
Collection<IConstraintViolation<? extends EObject>> violations = IMarkerService.INSTANCE /** Returns the message for the given severity of the model. */
.getViolations(getModel()); private String getViolationMessage(ESeverity sev) {
for (IConstraintViolation<? extends EObject> viol : violations) { String message = "";
if (viol.getSeverity() == sev) { Collection<IConstraintViolation<? extends EObject>> violations = IMarkerService.INSTANCE
message = viol.getExplanation(); .getViolations(getModel());
break; for (IConstraintViolation<? extends EObject> viol : violations) {
} if (viol.getSeverity() == sev) {
message = viol.getExplanation();
break;
} }
decorationFigure.setToolTip(new Label(message));
} }
return message;
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment