Skip to content
Snippets Groups Projects
Commit d438b7c3 authored by Christoph Döbber's avatar Christoph Döbber
Browse files

added tooltip to error markers in gef editors - code is YELLOW

refs 504
parent 78238594
No related branches found
No related tags found
No related merge requests found
...@@ -20,10 +20,13 @@ package org.fortiss.tooling.base.ui.editpart; ...@@ -20,10 +20,13 @@ package org.fortiss.tooling.base.ui.editpart;
import static org.fortiss.tooling.base.ui.editpart.ExtendedLayerRootEditPart.DECORATION_LAYER; import static org.fortiss.tooling.base.ui.editpart.ExtendedLayerRootEditPart.DECORATION_LAYER;
import static org.fortiss.tooling.base.ui.editpart.ExtendedLayerRootEditPart.LABEL_LAYER; import static org.fortiss.tooling.base.ui.editpart.ExtendedLayerRootEditPart.LABEL_LAYER;
import java.util.Collection;
import org.eclipse.draw2d.ConnectionAnchor; import org.eclipse.draw2d.ConnectionAnchor;
import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label; import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gef.ConnectionEditPart; import org.eclipse.gef.ConnectionEditPart;
import org.eclipse.gef.DragTracker; import org.eclipse.gef.DragTracker;
import org.eclipse.gef.NodeEditPart; import org.eclipse.gef.NodeEditPart;
...@@ -35,6 +38,7 @@ import org.eclipse.swt.graphics.Color; ...@@ -35,6 +38,7 @@ 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.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.ESeverity; import org.fortiss.tooling.kernel.extension.data.IConstraintViolation.ESeverity;
import org.fortiss.tooling.kernel.ui.service.IMarkerService; import org.fortiss.tooling.kernel.ui.service.IMarkerService;
import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService; import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService;
...@@ -69,7 +73,7 @@ import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService; ...@@ -69,7 +73,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: A01B2CB842D388DAAC38F6B9A2D853B8 * @ConQAT.Rating YELLOW Hash: AA7E698D18A510E82F864B9CEE5667FD
*/ */
public abstract class PositionedEditPartBase<T extends ILayoutedModelElement> public abstract class PositionedEditPartBase<T extends ILayoutedModelElement>
extends GraphicalEditPartBase<T> implements NodeEditPart { extends GraphicalEditPartBase<T> implements NodeEditPart {
...@@ -219,6 +223,18 @@ public abstract class PositionedEditPartBase<T extends ILayoutedModelElement> ...@@ -219,6 +223,18 @@ 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
.getViolations(getModel());
for (IConstraintViolation<? extends EObject> viol : violations) {
if (viol.getSeverity() == sev) {
message = viol.getExplanation();
break;
}
}
decorationFigure.setToolTip(new Label(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