Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2016-09-27 17:06:08 -0400
committerDonald Dunne2016-09-28 14:07:47 -0400
commit0681a7540b3541cc9d83b5b1c60633b2677d2831 (patch)
treef39e0fadb1ef4f4e3e3586f338d2b22e946f34a5
parent5afef5cf1a2b3e97455578ceaeeab38c29117d4f (diff)
downloadorg.eclipse.osee-0681a7540b3541cc9d83b5b1c60633b2677d2831.tar.gz
org.eclipse.osee-0681a7540b3541cc9d83b5b1c60633b2677d2831.tar.xz
org.eclipse.osee-0681a7540b3541cc9d83b5b1c60633b2677d2831.zip
bug: Handle NPE in XViewerColumn.getColor
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerAtsColumn.java80
1 files changed, 41 insertions, 39 deletions
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerAtsColumn.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerAtsColumn.java
index a77edea377..6d646b2ed4 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerAtsColumn.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/xviewer/column/XViewerAtsColumn.java
@@ -118,50 +118,52 @@ public abstract class XViewerAtsColumn extends XViewerColumn {
private Color getColor(Object element, boolean background, int columnIndex) {
Color resultColor = null;
- String hexColor = null;
- if (background) {
- hexColor = elementToBackgroundColor.get(element);
- } else {
- hexColor = elementToForegroundColor.get(element);
- }
- if (!Strings.isValid(hexColor)) {
- Color color = hexColorToColor.get(hexColor);
- if (color != null) {
- resultColor = color;
+ if (isColorColumn()) {
+ String hexColor = null;
+ if (background) {
+ hexColor = elementToBackgroundColor.get(element);
} else {
- try {
- String value = null;
- if (this instanceof IXViewerPreComputedColumn) {
- IXViewerPreComputedColumn ixViewerPreComputedColumn = (IXViewerPreComputedColumn) this;
- value = ixViewerPreComputedColumn.getText(element, ixViewerPreComputedColumn.getKey(element), "");
- } else if (this instanceof IXViewerValueColumn) {
- IXViewerValueColumn valueColumn = (IXViewerValueColumn) this;
- value = valueColumn.getColumnText(element, this, columnIndex);
- } else {
- value = getStyledText(element, this, 0).getString();
- }
- if (Strings.isValid(value)) {
- if (background) {
- hexColor = colorColumn.getBackgroundColorHex(value);
+ hexColor = elementToForegroundColor.get(element);
+ }
+ if (!Strings.isValid(hexColor)) {
+ Color color = hexColorToColor.get(hexColor);
+ if (color != null) {
+ resultColor = color;
+ } else {
+ try {
+ String value = null;
+ if (this instanceof IXViewerPreComputedColumn) {
+ IXViewerPreComputedColumn ixViewerPreComputedColumn = (IXViewerPreComputedColumn) this;
+ value = ixViewerPreComputedColumn.getText(element, ixViewerPreComputedColumn.getKey(element), "");
+ } else if (this instanceof IXViewerValueColumn) {
+ IXViewerValueColumn valueColumn = (IXViewerValueColumn) this;
+ value = valueColumn.getColumnText(element, this, columnIndex);
} else {
- hexColor = colorColumn.getForgroundColorHex(value);
+ value = getStyledText(element, this, 0).getString();
}
+ if (Strings.isValid(value)) {
+ if (background) {
+ hexColor = colorColumn.getBackgroundColorHex(value);
+ } else {
+ hexColor = colorColumn.getForgroundColorHex(value);
+ }
+ }
+ } catch (Exception ex) {
+ // do nothing
}
- } catch (Exception ex) {
- // do nothing
}
}
- }
- if (Strings.isValid(hexColor)) {
- resultColor = hexColorToColor.get(hexColor);
- if (resultColor == null) {
- resultColor = Displays.getColor(Integer.valueOf(hexColor.substring(1, 3), 16),
- Integer.valueOf(hexColor.substring(3, 5), 16), Integer.valueOf(hexColor.substring(5, 7), 16));
- hexColorToColor.put(hexColor, resultColor);
- if (background) {
- elementToBackgroundColor.put(element, hexColor);
- } else {
- elementToForegroundColor.put(element, hexColor);
+ if (Strings.isValid(hexColor)) {
+ resultColor = hexColorToColor.get(hexColor);
+ if (resultColor == null) {
+ resultColor = Displays.getColor(Integer.valueOf(hexColor.substring(1, 3), 16),
+ Integer.valueOf(hexColor.substring(3, 5), 16), Integer.valueOf(hexColor.substring(5, 7), 16));
+ hexColorToColor.put(hexColor, resultColor);
+ if (background) {
+ elementToBackgroundColor.put(element, hexColor);
+ } else {
+ elementToForegroundColor.put(element, hexColor);
+ }
}
}
}
@@ -184,7 +186,7 @@ public abstract class XViewerAtsColumn extends XViewerColumn {
public Boolean isActionRollup() {
return actionRollup;
}
-
+
public void setHasColorColumn(Boolean hasColorColumn, ColorColumn colorColumn) {
this.hasColorColumn = hasColorColumn;
this.colorColumn = colorColumn;

Back to the top