Java Code Examples for org.eclipse.swt.widgets.Table.getForeground()

The following are Jave code examples for showing how to use getForeground() of the org.eclipse.swt.widgets.Table class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: eZooKeeper   File: ZooKeeperConnectionModelMainFormPage.java   Source Code and License Vote up 5 votes
/**
 * TODO: Comment.
 * 
 */
protected void initPropertiesSectionFromModel() {

    Table table = getPropertiesSectionTable();
    table.removeAll();

    Map<String, String> properties = getZooKeeperConnectionProperties();

    for (String key : properties.keySet()) {
        TableItem item = new TableItem(table, SWT.NONE);
        String value = properties.get(key);
        item.setText(0, key);
        item.setText(1, value);

        Color valueTextColor = table.getForeground();
        if (key.equals(ZooKeeperConnectionModelElementType.PROPERTY_NAME_STATE)) {
            if (!States.CONNECTED.name().equals(value)) {
                valueTextColor = table.getDisplay().getSystemColor(SWT.COLOR_RED);
            }
            // else {
            // valueTextColor = table.getDisplay().getSystemColor(SWT.COLOR_GREEN);
            // }
        }
        
        item.setForeground(1, valueTextColor);
    }

    packTable(table, PROPERTIES_COLUMN_WIDTHS);

}