use of org.eclipse.swt.widgets.ColorDialog in project portfolio by buchen.
the class DefinitionViewer method doEditColor.
private void doEditColor(TaxonomyNode node) {
RGB oldColor = Colors.toRGB(node.getClassification().getColor());
ColorDialog colorDialog = new ColorDialog(getNodeViewer().getControl().getShell());
colorDialog.setRGB(oldColor);
RGB newColor = colorDialog.open();
if (newColor != null && !newColor.equals(oldColor)) {
String hex = Colors.toHex(newColor);
node.getClassification().setColor(hex);
// use same color for virtual and classification root nodes
if (node.getParent().isRoot())
node.getParent().getClassification().setColor(hex);
getModel().fireTaxonomyModelChange(node);
getModel().markDirty();
}
}
Aggregations