Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraradermache2012-07-09 04:46:36 -0400
committeraradermache2012-07-09 04:46:36 -0400
commita64eec402a5898bba5a5afd74ebf2786b9e674bb (patch)
tree54b04a2d3bf7379c2ca5c45fd3cff47f24e1cc4b /plugins/infra
parent03261ca7d64f48f2013bc7f8df2671dd3cd9da5b (diff)
downloadorg.eclipse.papyrus-a64eec402a5898bba5a5afd74ebf2786b9e674bb.tar.gz
org.eclipse.papyrus-a64eec402a5898bba5a5afd74ebf2786b9e674bb.tar.xz
org.eclipse.papyrus-a64eec402a5898bba5a5afd74ebf2786b9e674bb.zip
Corrected possibility on null image descriptor in initial fix for bug 384164
Diffstat (limited to 'plugins/infra')
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.validation/META-INF/MANIFEST.MF3
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/ValidationFunctions.java43
2 files changed, 37 insertions, 9 deletions
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/META-INF/MANIFEST.MF b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/META-INF/MANIFEST.MF
index 8d2d2427aef..9227ba27f58 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/META-INF/MANIFEST.MF
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/META-INF/MANIFEST.MF
@@ -9,7 +9,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.gmf.runtime.emf.commands.core;bundle-version="1.0.100",
org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.1.0",
org.eclipse.papyrus.infra.core;bundle-version="0.9.0",
- org.eclipse.papyrus.infra.services.decoration;bundle-version="0.9.0"
+ org.eclipse.papyrus.infra.services.decoration;bundle-version="0.9.0",
+ org.eclipse.papyrus.infra.widgets;bundle-version="0.9.0"
Export-Package: org.eclipse.papyrus.infra.services.validation,
org.eclipse.papyrus.infra.services.validation.preferences
Bundle-Vendor: %pluginProvider
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/ValidationFunctions.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/ValidationFunctions.java
index b87a7b0bd32..2cc2461cc17 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/ValidationFunctions.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/ValidationFunctions.java
@@ -15,6 +15,12 @@ import org.eclipse.ui.PlatformUI;
public class ValidationFunctions implements IDecorationSpecificFunctions {
+ public static final String error_co = "icons/etool16/error_co.gif";
+
+ public static final String warning_co = "icons/etool16/warning_co.gif";
+
+ public static final String info_co = "icons/etool16/info_co.gif";
+
/**
* Return the image descriptor associated with an validation marker
*/
@@ -53,15 +59,23 @@ public class ValidationFunctions implements IDecorationSpecificFunctions {
ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
ImageDescriptor overlay = null;
+ org.eclipse.papyrus.infra.widgets.Activator widgetsActivator =
+ org.eclipse.papyrus.infra.widgets.Activator.getDefault();
switch(severity) {
case IMarker.SEVERITY_ERROR:
overlay = sharedImages.getImageDescriptor(ISharedImages.IMG_DEC_FIELD_ERROR);
+ if(overlay == null) {
+ overlay = widgetsActivator.getImageDescriptor(Activator.PLUGIN_ID, error_co);
+ }
break;
case IMarker.SEVERITY_WARNING:
overlay = sharedImages.getImageDescriptor(ISharedImages.IMG_DEC_FIELD_WARNING);
+ if(overlay == null) {
+ overlay = widgetsActivator.getImageDescriptor(Activator.PLUGIN_ID, warning_co);
+ }
break;
case IMarker.SEVERITY_INFO:
- overlay = sharedImages.getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK); // TODO: Image too big (unclear, if "info" is useful)
+ overlay = widgetsActivator.getImageDescriptor(Activator.PLUGIN_ID, info_co);
break;
}
@@ -85,20 +99,33 @@ public class ValidationFunctions implements IDecorationSpecificFunctions {
* Set of child decorations. use severity information?
*/
public IPapyrusDecoration markerPropagation(EList<IPapyrusDecoration> childDecorations) {
- int childSeverity = 0;
+ boolean childWarnings = false;
+ boolean childErrors = false;
// loop over children. Use the "highest" level for parent decoration
for(IPapyrusDecoration childDecoration : childDecorations) {
if(childDecoration.getDecorationImageForME() == getImageDescriptorForME(IMarker.SEVERITY_WARNING)) {
- childSeverity = IMarker.SEVERITY_WARNING;
+ childWarnings = true;
}
else if(childDecoration.getDecorationImageForME() == getImageDescriptorForME(IMarker.SEVERITY_ERROR)) {
- childSeverity = IMarker.SEVERITY_ERROR;
- break; // no need to check further
+ childErrors = true;
}
}
- if(childSeverity != 0) {
- String message = (childSeverity == IMarker.SEVERITY_ERROR) ? "Error" : "Warning";
- message += " marker in one of the children (packaged elements)";
+ if(childWarnings || childErrors) {
+ String message = "";
+ int childSeverity = 0;
+ if(childErrors && childWarnings) {
+ message = "Error and warning";
+ childSeverity = IMarker.SEVERITY_ERROR;
+ }
+ else if(childErrors) {
+ message = "Error";
+ childSeverity = IMarker.SEVERITY_ERROR;
+ }
+ else if(childWarnings) {
+ message = "Warning";
+ childSeverity = IMarker.SEVERITY_WARNING;
+ }
+ message += " marker(s) in one of the children";
IPapyrusDecoration deco = new Decoration(null, EValidator.MARKER,
getImageDescriptorForGE(childSeverity), getImageDescriptorForME(childSeverity), message, null);
deco.setPosition(PreferedPosition.NORTH_WEST);

Back to the top