daily merge
authorfturovic <frank.turovich@nokia.com>
Tue, 31 Aug 2010 22:58:47 -0500
changeset 1935 4ee79469c566
parent 1934 4f0cd256d26c (current diff)
parent 1932 bb5cd1564dad (diff)
child 1936 68ee6a613ebc
daily merge
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/ManageConfigurationsDialog.java	Tue Aug 31 22:58:09 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/ManageConfigurationsDialog.java	Tue Aug 31 22:58:47 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);
 		}
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/BuildTargetTreeNode.java	Tue Aug 31 22:58:09 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/BuildTargetTreeNode.java	Tue Aug 31 22:58:47 2010 -0500
@@ -19,9 +19,13 @@
 package com.nokia.carbide.cpp.sdk.ui.shared;
 
 import java.io.File;
+import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.jface.viewers.TreeNode;
 
 import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildContext;
@@ -112,60 +116,81 @@
 	 * from the SDK preferences page.  Only enabled SDK's are used.  Each SDK node will
 	 * have build configurations for children appropriate for the SDK.  These configurations
 	 * are filtered based on the platform filtering preference panel.
-	 * @return
-	 */
-	public static BuildTargetTreeNode[] getTreeViewerInput() {
-		return getTreeViewerInput(false);
-	}
-
-	/**
-	 * Gets the list of SDK tree nodes for use in a tree viewer.  The SDK's are gathered
-	 * from the SDK preferences page.  Only enabled SDK's are used.  Each SDK node will
-	 * have build configurations for children appropriate for the SDK.  These configurations
-	 * are filtered based on the platform filtering preference panel.
 	 * @param sbsv2Project true if this is an SBSv2 project which affects how the build
 	 * configuration list is calculated
+	 * @param IRunnableContext - a runnable context for which to update a progress monitor. Cannot be null.
 	 * @return array of BuildTargetTreeNode, or null
 	 * @since 1.4
 	 */
-	public static BuildTargetTreeNode[] getTreeViewerInput(boolean sbsv2Project) {
-		ISDKManager sdkMgr = SDKCorePlugin.getSDKManager();
-		List<ISymbianSDK> sdkList = sdkMgr.getSDKList();
-		if (sdkList == null)
-			return null;
+	public static BuildTargetTreeNode[] getTreeViewerInput(final boolean sbsv2Project, IRunnableContext runnableContext) {
+		
+		final List<BuildTargetTreeNode> assembledInput = new ArrayList<BuildTargetTreeNode>();
 		
-		List<ISymbianSDK> sdkListCopy = new ArrayList<ISymbianSDK>();
-		// Only add SDKs that are enabled
-		for (ISymbianSDK currSDK : sdkList){
-			if (currSDK.isEnabled()){
-				sdkListCopy.add(currSDK);
-			}
-		}
-		
-		if (sbsv2Project) {
-			// filter non-SBSv2 supported SDK's
-			sdkListCopy = SBSv2Utils.getSupportedSDKs(sdkListCopy);
+		try {
+			runnableContext.run(true, false, new IRunnableWithProgress(){
+
+				public void run(IProgressMonitor monitor)
+						throws InvocationTargetException, InterruptedException {
+					
+					String msgPrefix = "Building SDK/Configuration Model: "; //$NON-NLS-N$
+					
+					ISDKManager sdkMgr = SDKCorePlugin.getSDKManager();
+					List<ISymbianSDK> sdkList = sdkMgr.getSDKList();
+					monitor.beginTask(msgPrefix, sdkList.size() + 2);
+					if (sdkList == null)
+						return;
+					
+					monitor.worked(1);
+					List<ISymbianSDK> sdkListCopy = new ArrayList<ISymbianSDK>();
+					// Only add SDKs that are enabled
+					for (ISymbianSDK currSDK : sdkList) {
+						if (currSDK.isEnabled()) {
+							sdkListCopy.add(currSDK);
+						}
+					}
+
+					if (sbsv2Project) {
+						// filter non-SBSv2 supported SDK's
+						sdkListCopy = SBSv2Utils.getSupportedSDKs(sdkListCopy);
+					}
+
+					BuildTargetTreeNode[] input = new BuildTargetTreeNode[sdkListCopy
+							.size()];
+					int index = 0;
+					monitor.worked(1);
+					for (ISymbianSDK sdk : sdkListCopy) {
+						monitor.worked(1);
+						monitor.setTaskName(msgPrefix + sdk.getUniqueId());
+						BuildTargetTreeNode treeNode = new BuildTargetTreeNode(
+								sdk, sbsv2Project);
+						if (treeNode.getChildren() != null || sbsv2Project) {
+							input[index++] = treeNode;
+						}
+					}
+
+					// Filter out any SDKs that don't have configs
+					monitor.worked(1);
+					for (BuildTargetTreeNode currNode : input) {
+						if (currNode != null) {
+							assembledInput.add(currNode);
+						}
+					}
+					monitor.done();
+				}
+			
+			
+			});
+		} catch (InvocationTargetException e) {
+			e.printStackTrace();
+		} catch (InterruptedException e) {
+			e.printStackTrace();
 		}
 		
-		BuildTargetTreeNode[] input = new BuildTargetTreeNode[sdkListCopy.size()];
-		int index = 0;
-		for (ISymbianSDK sdk : sdkListCopy) {
-			
-			BuildTargetTreeNode treeNode = new BuildTargetTreeNode(sdk, sbsv2Project);
-			if (treeNode.getChildren() != null || sbsv2Project){
-				input[index++] = treeNode;
-			}
+		if (assembledInput.size() == 0){
+			return null;
 		}
-		
-		// Filter out any SDKs that don't have configs
-		BuildTargetTreeNode[] realInput = new BuildTargetTreeNode[index];
-		index = 0;
-		for (BuildTargetTreeNode currNode : input) {
-			if (currNode != null){
-				realInput[index++] = currNode;
-			}
-		}
-		return realInput;
+
+		return assembledInput.toArray(new BuildTargetTreeNode[assembledInput.size()]);
 	}
 	
 	private static String stripSDKIDFromConfigName(String configName, String sdkID){
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/BuildTargetsPage.java	Tue Aug 31 22:58:09 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/BuildTargetsPage.java	Tue Aug 31 22:58:47 2010 -0500
@@ -439,7 +439,7 @@
 			}
 
 			if (setInput) {
-		        viewer.setInput(BuildTargetTreeNode.getTreeViewerInput(useSBSv2Builder));
+		        viewer.setInput(BuildTargetTreeNode.getTreeViewerInput(useSBSv2Builder, getContainer()));
 			}
 
 			if (!inited) {
--- a/core/com.nokia.carbide.cpp.ui/META-INF/MANIFEST.MF	Tue Aug 31 22:58:09 2010 -0500
+++ b/core/com.nokia.carbide.cpp.ui/META-INF/MANIFEST.MF	Tue Aug 31 22:58:47 2010 -0500
@@ -12,7 +12,8 @@
  com.nokia.cpp.utils.ui,
  com.nokia.sdt.utils,
  org.eclipse.core.resources,
- org.eclipse.ui.forms
+ org.eclipse.ui.forms,
+ com.nokia.carbide.cpp.featureTracker;bundle-version="3.0.0"
 Bundle-ActivationPolicy: lazy
 Export-Package: com.nokia.carbide.cpp.internal.ui.images;
   x-friends:="com.nokia.sdt.symbian,
--- a/core/com.nokia.carbide.cpp.ui/src/com/nokia/carbide/cpp/ui/CarbideUIPlugin.java	Tue Aug 31 22:58:09 2010 -0500
+++ b/core/com.nokia.carbide.cpp.ui/src/com/nokia/carbide/cpp/ui/CarbideUIPlugin.java	Tue Aug 31 22:58:47 2010 -0500
@@ -21,6 +21,7 @@
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.osgi.framework.BundleContext;
 
+import com.nokia.carbide.cpp.internal.featureTracker.FeatureUseTrackerPlugin;
 import com.nokia.carbide.cpp.internal.ui.SharedImages;
 import com.nokia.cpp.internal.api.utils.core.Logging;
 
@@ -32,6 +33,8 @@
 	// The plug-in ID
 	public static final String PLUGIN_ID = "com.nokia.carbide.cpp.ui";
 
+	private static final String CARBIDE_IDE_FEATURE = "CARBIDE_IDE"; //$NON-NLS-1$
+
 	// The shared instance
 	private static CarbideUIPlugin plugin;
 	
@@ -50,6 +53,8 @@
 	 */
 	public void start(BundleContext context) throws Exception {
 		super.start(context);
+
+		FeatureUseTrackerPlugin.getFeatureUseProxy().useFeature(CARBIDE_IDE_FEATURE);
 	}
 
 	/*
--- a/core/com.nokia.carbide.cpp/META-INF/MANIFEST.MF	Tue Aug 31 22:58:09 2010 -0500
+++ b/core/com.nokia.carbide.cpp/META-INF/MANIFEST.MF	Tue Aug 31 22:58:47 2010 -0500
@@ -15,8 +15,7 @@
  org.eclipse.ui.ide,
  org.eclipse.cdt.core,
  com.nokia.carbide.discovery.ui;bundle-version="1.0.0",
- org.eclipse.equinox.p2.ui;bundle-version="2.0.0",
- com.nokia.carbide.cpp.featureTracker
+ org.eclipse.equinox.p2.ui;bundle-version="2.0.0"
 Bundle-ActivationPolicy: lazy
 Export-Package: com.nokia.carbide.cpp,
  com.nokia.carbide.cpp.logging
--- a/core/com.nokia.carbide.cpp/src/com/nokia/carbide/cpp/ProductPlugin.java	Tue Aug 31 22:58:09 2010 -0500
+++ b/core/com.nokia.carbide.cpp/src/com/nokia/carbide/cpp/ProductPlugin.java	Tue Aug 31 22:58:47 2010 -0500
@@ -22,7 +22,6 @@
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.osgi.framework.BundleContext;
 
-import com.nokia.carbide.cpp.internal.featureTracker.FeatureUseTrackerPlugin;
 import com.nokia.carbide.internal.discovery.ui.wizard.P2Utils;
 
 /**
@@ -30,8 +29,6 @@
  */
 public class ProductPlugin extends AbstractUIPlugin {
 
-	private static final String CARBIDE_IDE_FEATURE = "CARBIDE_IDE"; //$NON-NLS-1$
-	
 	//The shared instance.
 	private static ProductPlugin plugin;
 	
@@ -47,12 +44,11 @@
 	 */
 	public void start(BundleContext context) throws Exception {
 		super.start(context);
+
 		File file = P2Utils.getInitialFeaturesFile();
 		if (!file.exists()) {
 			P2Utils.writeFeaturesToFile(file);
 		}
-
-		FeatureUseTrackerPlugin.getFeatureUseProxy().useFeature(CARBIDE_IDE_FEATURE);
 	}
 
 	/**
--- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/wizards/NewSymbianOSCppProjectWizard.java	Tue Aug 31 22:58:09 2010 -0500
+++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/wizards/NewSymbianOSCppProjectWizard.java	Tue Aug 31 22:58:47 2010 -0500
@@ -22,6 +22,8 @@
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbench;
 
 import com.nokia.carbide.cpp.internal.api.sdk.ISDKManagerInternal;
 import com.nokia.carbide.cpp.internal.api.sdk.ui.TemplateSDKsFilter;
@@ -50,6 +52,7 @@
 
 	public NewSymbianOSCppProjectWizard() {
 		super();
+		setNeedsProgressMonitor(true);
 		setFilterCheckboxLabel(Messages.getString("NewSymbianOSCppProjectWizard.FilterCheckboxLabel")); //$NON-NLS-1$
 		setTemplateFilter(new TemplateSDKsFilter());
 		setWindowTitle(Messages.getString("NewSymbianOSCppProjectWizard.WindowTitle")); //$NON-NLS-1$
@@ -80,6 +83,7 @@
 			String description = Messages.getString("NewSymbianOSCppProjectWizard.NewProjectPageDesc"); //$NON-NLS-1$
 			newProjectPage = new NewProjectPage(title, description);
 			pagesAfterTemplateChoice.add(newProjectPage);
+			setNeedsProgressMonitor(true);
 			buildTargetsPage = new ProjectWizardBuildTargetsPage(this);
 			pagesAfterTemplateChoice.add(buildTargetsPage);
 			notifyTemplateChanged();
@@ -88,6 +92,12 @@
 	}
 
 	@Override
+	public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
+		super.init(workbench, currentSelection);
+		setNeedsProgressMonitor(true);
+	}
+
+	@Override
 	public String getChooseTemplatePageTitle() {
 		return Messages.getString("NewSymbianOSCppProjectWizard.ChooseTemplatePageTitle"); //$NON-NLS-1$
 	}
--- a/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/NewQtCppProjectWizard.java	Tue Aug 31 22:58:09 2010 -0500
+++ b/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/NewQtCppProjectWizard.java	Tue Aug 31 22:58:47 2010 -0500
@@ -33,11 +33,13 @@
 	public NewQtCppProjectWizard() {
 		super();
 		setWindowTitle(Messages.NewQtCppProjectWizard_title);
+		setNeedsProgressMonitor(true);
 	}
 
     @Override
 	public List<IWizardDataPage> getPagesAfterTemplateChoice() {
 		if (pagesAfterTemplateChoice == null) {
+			setNeedsProgressMonitor(true);
 			pagesAfterTemplateChoice = new ArrayList<IWizardDataPage>();
 
 			newProjectPage = new NewProjectPage(Messages.NewQtCppProjectWizard_title, Messages.NewQtCppProjectWizard_desc);