For IColorProvider on the SDK/Config tree LabelProvider, only check for existence of EPOCROOT in the data provider.
Use updated text on SDK node to check if SDK has a valid EPOCROOT or not. Works now for project wizards too.
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/ManageConfigurationsDialog.java Fri Jun 11 10:31:54 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/ManageConfigurationsDialog.java Fri Jun 11 11:35:13 2010 -0500
@@ -16,7 +16,6 @@
*/
package com.nokia.carbide.cdt.internal.api.builder.ui;
-import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -197,9 +196,7 @@
if (element instanceof BuildTargetTreeNode){
BuildTargetTreeNode treeNode = (BuildTargetTreeNode)element;
if (treeNode.getValue() instanceof ISymbianSDK){
- ISymbianSDK sdk = (ISymbianSDK)treeNode.getValue();
- File f = new File (sdk.getEPOCROOT());
- if (!f.exists()){
+ if (treeNode.toString().contains(BuildTargetTreeNode.SDK_NODE_ERROR_EPOCROOT_INVALID)){
return WorkbenchUtils.getSafeShell().getDisplay().getSystemColor(SWT.COLOR_RED);
}
}
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/BuildTargetTreeNode.java Fri Jun 11 10:31:54 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/BuildTargetTreeNode.java Fri Jun 11 11:35:13 2010 -0500
@@ -37,6 +37,8 @@
*/
public class BuildTargetTreeNode extends TreeNode {
+ public static final String SDK_NODE_ERROR_EPOCROOT_INVALID = " -- SDK location does not exist! Check Symbian SDKs!"; //$NON-NLS
+
/**
* Constructs a new tree node for the given SDK
* @param value the SDK to create the tree node for
@@ -79,7 +81,7 @@
ISymbianSDK value = (ISymbianSDK) getValue();
File f = new File(value.getEPOCROOT());
if (!f.exists()){
- return value.getUniqueId() + " -- SDK location does not exist! Check Symbian SDKs!";
+ return value.getUniqueId() + SDK_NODE_ERROR_EPOCROOT_INVALID;
}
return value.getUniqueId();
}
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/BuildTargetsPage.java Fri Jun 11 10:31:54 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/BuildTargetsPage.java Fri Jun 11 11:35:13 2010 -0500
@@ -29,6 +29,7 @@
import org.eclipse.jface.dialogs.IDialogPage;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.IColorProvider;
import org.eclipse.jface.viewers.IFilter;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
@@ -40,6 +41,7 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -61,6 +63,7 @@
import com.nokia.carbide.template.engine.ITemplate;
import com.nokia.cpp.internal.api.utils.core.Check;
import com.nokia.cpp.internal.api.utils.core.HostOS;
+import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
/**
* Wizard page used to select a list of Carbide.c++ build configurations. Currently used
@@ -256,7 +259,27 @@
viewer = new ContainerCheckedTreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
viewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
- viewer.setLabelProvider(new LabelProvider());
+ class SDKNodeLabelProvider extends LabelProvider implements IColorProvider {
+
+ public Color getForeground(Object element) {
+ if (element instanceof BuildTargetTreeNode){
+ BuildTargetTreeNode treeNode = (BuildTargetTreeNode)element;
+ if (treeNode.getValue() instanceof ISymbianSDK){
+ if (treeNode.toString().contains(BuildTargetTreeNode.SDK_NODE_ERROR_EPOCROOT_INVALID)){
+ return WorkbenchUtils.getSafeShell().getDisplay().getSystemColor(SWT.COLOR_RED);
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public Color getBackground(Object element) {
+ return null;
+ }
+ }
+
+ viewer.setLabelProvider(new SDKNodeLabelProvider());
TreeNodeContentProvider treeNodeContentProvider = new TreeNodeContentProvider();
filteringContentProviderWrapper =