diff --git a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editpart/PositionedEditPartBase.java b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editpart/PositionedEditPartBase.java index 6ad550a12162bdfa941b5682d1b1d0f9730e9855..3298700607a3d1c3d3ab041fe07356c7f5eff18e 100644 --- a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editpart/PositionedEditPartBase.java +++ b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editpart/PositionedEditPartBase.java @@ -69,7 +69,7 @@ import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService; * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating GREEN Hash: 3B050D7FB691B8F17BBADB932EFF2BF2 + * @ConQAT.Rating YELLOW Hash: 3F8B52876DADB7B723518D32AFDAD2AD */ public abstract class PositionedEditPartBase<T extends ILayoutedModelElement> extends GraphicalEditPartBase<T> implements NodeEditPart { @@ -204,10 +204,9 @@ public abstract class PositionedEditPartBase<T extends ILayoutedModelElement> decorationFigure.getParent().setConstraint(decorationFigure, decorationBounds); + Image icon = null; ESeverity sev = IMarkerService.INSTANCE .getHighestViolationSeverity(getModel()); - - Image icon = null; switch (sev) { case ERROR: icon = IMarkerService.INSTANCE.getImageFor(ESeverity.ERROR, @@ -217,6 +216,7 @@ public abstract class PositionedEditPartBase<T extends ILayoutedModelElement> icon = IMarkerService.INSTANCE.getImageFor(ESeverity.WARNING, useSmallDecorationImage()).createImage(); break; + default: } decorationFigure.setIcon(icon); } diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/MarkerService.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/MarkerService.java index bd998e86db9027da9502f248c36262297cd4a8f7..ccae8cf2057314b3d7bacafc2e5c69be63b999bd 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/MarkerService.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/MarkerService.java @@ -31,6 +31,8 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.impl.NotificationImpl; import org.eclipse.emf.ecore.EObject; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.viewers.IDecoration; @@ -55,7 +57,7 @@ import org.fortiss.tooling.kernel.ui.service.IMarkerService; * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: BD8AB2A7EDA9DB684707242CAC441F6F + * @ConQAT.Rating YELLOW Hash: 242B488A1C4D7DDB614EB3E75F8D9294 */ public class MarkerService implements IMarkerService, IPersistencyServiceListener, ILightweightLabelDecorator { @@ -156,7 +158,7 @@ public class MarkerService implements IMarkerService, ITopLevelElement top = IPersistencyService.INSTANCE .getTopLevelElementFor(element); if (top == null) { - return ESeverity.lowest(); + return null; } return getCacheEntry(top).getHighestSeverity(element); } @@ -289,6 +291,26 @@ public class MarkerService implements IMarkerService, /** Stores the top-level element. */ private ITopLevelElement topElement; + /** Notification to cause model element display refresh. */ + private Notification refreshOnly = new NotificationImpl( + Notification.EVENT_TYPE_COUNT + 256, null, null); + + /** Stores the display update UI job. */ + private final UIJob refreshElementDisplay = new UIJob("Update Markers") { + + @Override + public IStatus runInUIThread(IProgressMonitor monitor) { + for (EObject eo : violationsMap.keySet()) { + eo.eNotify(refreshOnly); + for (IConstraintViolation<? extends EObject> viol : violationsMap + .get(eo)) { + viol.getSource().eNotify(refreshOnly); + } + } + return Status.OK_STATUS; + } + }; + /** Constructor. */ public CacheEntry(ITopLevelElement topElement) { this.topElement = topElement; @@ -296,11 +318,10 @@ public class MarkerService implements IMarkerService, /** Returns the highest severity for the given element. */ public ESeverity getHighestSeverity(EObject element) { - ESeverity severity = highestSeverityMap.get(element); - if (severity == null) { - severity = ESeverity.lowest(); + if (!highestSeverityMap.containsKey(element)) { + return ESeverity.lowest(); } - return severity; + return highestSeverityMap.get(element); } /** Updates the cache entry. */ @@ -325,6 +346,8 @@ public class MarkerService implements IMarkerService, } // project severity to parent computeHighestSeverity(topElement.getRootModelElement()); + // refresh display + refreshElementDisplay.schedule(); } /** Recursively projects highest severity from children to parents. */ diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/MarkerViewPart.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/MarkerViewPart.java index 6af4ce2b296a4a2dfd091f968a858edd1b4684cd..c96b5b58fad5aca8bb7f9df15f464658a86532a3 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/MarkerViewPart.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/MarkerViewPart.java @@ -55,7 +55,7 @@ import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService; * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating GREEN Hash: 2EC4BD8032972D2AFD4E88B3F34E5049 + * @ConQAT.Rating YELLOW Hash: CBDF2C05D0E2D9AC3FAC9D3030ECAC05 */ public class MarkerViewPart extends ViewPart { @@ -113,9 +113,9 @@ public class MarkerViewPart extends ViewPart { @Override public Object[] getElements(Object inputElement) { - List<ESeverity> result = new ArrayList<ESeverity>(5); + List<ESeverity> result = new ArrayList<ESeverity>(); for (ESeverity sev : ESeverity.values()) { - if (toggleState.get(sev)) { + if (sev != ESeverity.lowest() && toggleState.get(sev)) { result.add(sev); } } @@ -213,7 +213,9 @@ public class MarkerViewPart extends ViewPart { /** Refreshes the view. Needs to be called on UI thread. */ public void refresh() { - gui.getTreeViewer().refresh(); + if (!gui.getTreeViewer().getControl().isDisposed()) { + gui.getTreeViewer().refresh(); + } } /** Creates the toggle actions. */ diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/service/IMarkerService.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/service/IMarkerService.java index 88a1357682e5b97fe7d1ab9fa89f49cc4fed335f..359cae2cadcdb34a4e13090d8c1d606b155ff8f3 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/service/IMarkerService.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/service/IMarkerService.java @@ -35,7 +35,7 @@ import org.fortiss.tooling.kernel.ui.internal.MarkerService; * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating GREEN Hash: 7CA4B3A1CFB5DAA9243A2537F4C75C02 + * @ConQAT.Rating YELLOW Hash: 2AF8DAFE162ECF932E56C8770FADF137 */ public interface IMarkerService { @@ -50,7 +50,8 @@ public interface IMarkerService { EObject element); /** - * /** Returns the highest severity for the given element. + * /** Returns the highest severity for the given element or + * <code>null</code> if there are no violations for this element. */ ESeverity getHighestViolationSeverity(EObject element); diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/data/IConstraintViolation.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/data/IConstraintViolation.java index 65ecad005f5fac5891f422d733f453cbfbb300c5..11d749fd35d78fce16e26a05623a76ca75307f92 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/data/IConstraintViolation.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/data/IConstraintViolation.java @@ -37,7 +37,7 @@ import org.fortiss.tooling.kernel.extension.base.ConstraintViolationBase; * @author hoelzlf * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: 11AEB121B98133BB02808AA44C0BFFDB + * @ConQAT.Rating YELLOW Hash: 7C5D15AAF9D6703ABFECFDF82B5D45B8 */ public interface IConstraintViolation<T extends EObject> extends IAdaptable { @@ -64,7 +64,10 @@ public interface IConstraintViolation<T extends EObject> extends IAdaptable { /** Information severity. */ INFO, /** Debug severity. */ - DEBUG; + DEBUG, + + /** The lowest None severity. */ + NONE; /** Translates ESeverity to int. */ public static int getIntSeverity(ESeverity severity) { @@ -77,14 +80,16 @@ public interface IConstraintViolation<T extends EObject> extends IAdaptable { return -1; case INFO: return 1; + case DEBUG: + return 5; } - // ESeverity.DEBUG - return 5; + // ESeverity.NONE + return 10000; } /** Returns the lowest severity level. */ public static ESeverity lowest() { - return DEBUG; + return NONE; } }