builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/ManageConfigurationsDialog.java
changeset 1931 d7c1f804f316
parent 1913 bcd5f4dbd8ac
child 1949 1531bcf5dea3
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/ManageConfigurationsDialog.java	Tue Aug 31 14:13:15 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/ManageConfigurationsDialog.java	Tue Aug 31 17:03:48 2010 -0500
@@ -21,6 +21,9 @@
 import java.util.Iterator;
 import java.util.List;
 
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.jface.dialogs.TrayDialog;
 import org.eclipse.jface.viewers.CheckStateChangedEvent;
@@ -46,6 +49,7 @@
 import org.eclipse.swt.widgets.Link;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.dialogs.ContainerCheckedTreeViewer;
 import org.eclipse.ui.dialogs.PreferencesUtil;
@@ -226,7 +230,11 @@
 			filteringContentProviderWrapper.setConfigFilter(new QtConfigFilter());
 		}
 		
-		drawSDKConfigTree();
+		try {
+			drawSDKConfigTree();
+		} catch (CoreException e1) {
+			e1.printStackTrace();
+		}
 		
 		BrokenConfigurationInProjectTreeNode[] brokenTreeInput = BrokenConfigurationInProjectTreeNode.getTreeViewerInput(cpi);
 		if (brokenTreeInput.length > 0) {
@@ -247,7 +255,11 @@
 			public void widgetSelected(SelectionEvent e) {
 				// I don't see a way to open it to a specific tab, only the page
 				if (Window.OK == PreferencesUtil.createPreferenceDialogOn(getShell(), "com.nokia.carbide.cpp.sdk.ui.preferences.BuildPlatformFilterPage", null, null, 0).open()){ //$NON-NLS-1$
-					drawSDKConfigTree();
+					try {
+						drawSDKConfigTree();
+					} catch (CoreException e1) {
+						e1.printStackTrace();
+					}
 				}
 			}
 		});
@@ -260,7 +272,11 @@
 			public void widgetSelected(SelectionEvent e) {
 				// I don't see a way to open it to a specific tab, only the page
 				if (Window.OK == PreferencesUtil.createPreferenceDialogOn(getShell(), "com.nokia.carbide.cpp.sdk.ui.preferences.SDKPreferencePage", null, null, 0).open()){ //$NON-NLS-1$
-					drawSDKConfigTree();
+					try {
+						drawSDKConfigTree();
+					} catch (CoreException e1) {
+						e1.printStackTrace();
+					}
 				}
 			}
 		});
@@ -270,11 +286,18 @@
 		return container;
 	}
 
-	private void drawSDKConfigTree() {
+	private void drawSDKConfigTree() throws CoreException {
 		boolean sbsv2Project = CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(cpi.getProject());
 	
 		properSdkViewer.setContentProvider(filteringContentProviderWrapper);
-		BuildTargetTreeNode[] sdkConfigTreeNodes = BuildTargetTreeNode.getTreeViewerInput(sbsv2Project);
+		IWorkbenchWindow wbw = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+		BuildTargetTreeNode[] sdkConfigTreeNodes = null;
+		if (wbw != null){
+			sdkConfigTreeNodes = BuildTargetTreeNode.getTreeViewerInput(sbsv2Project, wbw);
+		} else {
+			IStatus s = new Status(IStatus.ERROR, CarbideBuilderPlugin.PLUGIN_ID, 0, "Error retrieving workbench window. Cannot display configuration tree.", null);
+			throw new CoreException(s);
+		}
 		if (sbsv2Project){
 			replaceFilteredConfigsFromProject(sdkConfigTreeNodes);
 		}