Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorVivian Kong2008-11-13 16:12:38 +0000
committerVivian Kong2008-11-13 16:12:38 +0000
commit926ee25abbef1aaee166ac12b5cc526c7eb6e106 (patch)
treea40720b7bf2b2a930149b3ceb074835845e922d5 /build
parentd60c8570b9571e164342ee17f896554cbd887f6f (diff)
downloadorg.eclipse.cdt-926ee25abbef1aaee166ac12b5cc526c7eb6e106.tar.gz
org.eclipse.cdt-926ee25abbef1aaee166ac12b5cc526c7eb6e106.tar.xz
org.eclipse.cdt-926ee25abbef1aaee166ac12b5cc526c7eb6e106.zip
bug 250982 - add progress reporting to new project wizard
Diffstat (limited to 'build')
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/MBSWizardHandler.java100
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/STDWizardHandler.java73
2 files changed, 97 insertions, 76 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/MBSWizardHandler.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/MBSWizardHandler.java
index 5753acf9bb2..fac817543a5 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/MBSWizardHandler.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/MBSWizardHandler.java
@@ -55,6 +55,7 @@ import org.eclipse.cdt.ui.wizards.EntryDescriptor;
import org.eclipse.cdt.ui.wizards.IWizardItemsListListener;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.operation.IRunnableWithProgress;
@@ -520,54 +521,63 @@ public class MBSWizardHandler extends CWizardHandler {
full_tcs.put(tc.getUniqueRealName(), tc);
}
- public void createProject(IProject project, boolean defaults, boolean onFinish) throws CoreException {
- ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
- ICProjectDescription des = mngr.createProjectDescription(project, false, !onFinish);
- ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
-
- cfgs = fConfigPage.getCfgItems(false);
- if (cfgs == null || cfgs.length == 0)
- cfgs = CDTConfigWizardPage.getDefaultCfgs(this);
-
- if (cfgs == null || cfgs.length == 0 || cfgs[0].getConfiguration() == null) {
- throw new CoreException(new Status(IStatus.ERROR,
- ManagedBuilderUIPlugin.getUniqueIdentifier(),
- Messages.getString("CWizardHandler.6"))); //$NON-NLS-1$
- }
- Configuration cf = (Configuration)cfgs[0].getConfiguration();
- ManagedProject mProj = new ManagedProject(project, cf.getProjectType());
- info.setManagedProject(mProj);
-
- cfgs = CfgHolder.unique(cfgs);
- cfgs = CfgHolder.reorder(cfgs);
-
- ICConfigurationDescription cfgDebug = null;
- ICConfigurationDescription cfgFirst = null;
-
- for(int i = 0; i < cfgs.length; i++){
- cf = (Configuration)cfgs[i].getConfiguration();
- String id = ManagedBuildManager.calculateChildId(cf.getId(), null);
- Configuration config = new Configuration(mProj, cf, id, false, true);
- CConfigurationData data = config.getConfigurationData();
- ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
- config.setConfigurationDescription(cfgDes);
- config.exportArtifactInfo();
-
- IBuilder bld = config.getEditableBuilder();
- if (bld != null) { bld.setManagedBuildOn(true); }
+ public void createProject(IProject project, boolean defaults, boolean onFinish, IProgressMonitor monitor) throws CoreException {
+ try {
+ monitor.beginTask("", 100); //$NON-NLS-1$
+ ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
+ ICProjectDescription des = mngr.createProjectDescription(project, false, !onFinish);
+ ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
+ monitor.worked(10);
+ cfgs = fConfigPage.getCfgItems(false);
+ if (cfgs == null || cfgs.length == 0)
+ cfgs = CDTConfigWizardPage.getDefaultCfgs(this);
- config.setName(cfgs[i].getName());
- config.setArtifactName(removeSpaces(project.getName()));
+ if (cfgs == null || cfgs.length == 0 || cfgs[0].getConfiguration() == null) {
+ throw new CoreException(new Status(IStatus.ERROR,
+ ManagedBuilderUIPlugin.getUniqueIdentifier(),
+ Messages.getString("CWizardHandler.6"))); //$NON-NLS-1$
+ }
+ Configuration cf = (Configuration)cfgs[0].getConfiguration();
+ ManagedProject mProj = new ManagedProject(project, cf.getProjectType());
+ info.setManagedProject(mProj);
+ monitor.worked(10);
+ cfgs = CfgHolder.unique(cfgs);
+ cfgs = CfgHolder.reorder(cfgs);
+
+ ICConfigurationDescription cfgDebug = null;
+ ICConfigurationDescription cfgFirst = null;
- IBuildProperty b = config.getBuildProperties().getProperty(PROPERTY);
- if (cfgDebug == null && b != null && b.getValue() != null && PROP_VAL.equals(b.getValue().getId()))
- cfgDebug = cfgDes;
- if (cfgFirst == null) // select at least first configuration
- cfgFirst = cfgDes;
+ int work = 50/cfgs.length;
+
+ for(int i = 0; i < cfgs.length; i++){
+ cf = (Configuration)cfgs[i].getConfiguration();
+ String id = ManagedBuildManager.calculateChildId(cf.getId(), null);
+ Configuration config = new Configuration(mProj, cf, id, false, true);
+ CConfigurationData data = config.getConfigurationData();
+ ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
+ config.setConfigurationDescription(cfgDes);
+ config.exportArtifactInfo();
+
+ IBuilder bld = config.getEditableBuilder();
+ if (bld != null) { bld.setManagedBuildOn(true); }
+
+ config.setName(cfgs[i].getName());
+ config.setArtifactName(removeSpaces(project.getName()));
+
+ IBuildProperty b = config.getBuildProperties().getProperty(PROPERTY);
+ if (cfgDebug == null && b != null && b.getValue() != null && PROP_VAL.equals(b.getValue().getId()))
+ cfgDebug = cfgDes;
+ if (cfgFirst == null) // select at least first configuration
+ cfgFirst = cfgDes;
+ monitor.worked(work);
+ }
+ mngr.setProjectDescription(project, des);
+ doTemplatesPostProcess(project);
+ doCustom(project);
+ monitor.worked(30);
+ } finally {
+ monitor.done();
}
- mngr.setProjectDescription(project, des);
- doTemplatesPostProcess(project);
- doCustom(project);
}
protected void doTemplatesPostProcess(IProject prj) {
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/STDWizardHandler.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/STDWizardHandler.java
index b246ad481fd..7890c1a61bb 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/STDWizardHandler.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/STDWizardHandler.java
@@ -7,6 +7,7 @@
*
* Contributors:
* Intel Corporation - initial API and implementation
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.ui.wizards;
@@ -26,6 +27,7 @@ import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
import org.eclipse.cdt.ui.newui.UIMessages;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.swt.widgets.Composite;
@@ -48,40 +50,49 @@ public class STDWizardHandler extends MBSWizardHandler {
/**
* Note that configurations parameter is ignored
*/
- public void createProject(IProject project, boolean defaults, boolean onFinish) throws CoreException {
- ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
- ICProjectDescription des = mngr.createProjectDescription(project, false, !onFinish);
- ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
- ManagedProject mProj = new ManagedProject(des);
- info.setManagedProject(mProj);
-
- cfgs = CfgHolder.unique(fConfigPage.getCfgItems(defaults));
- cfgs = CfgHolder.reorder(cfgs);
-
- for (int i=0; i<cfgs.length; i++) {
- String s = (cfgs[i].getToolChain() == null) ? "0" : ((ToolChain)(cfgs[i].getToolChain())).getId(); //$NON-NLS-1$
- Configuration cfg = new Configuration(mProj, (ToolChain)cfgs[i].getToolChain(), ManagedBuildManager.calculateChildId(s, null), cfgs[i].getName());
- IBuilder bld = cfg.getEditableBuilder();
- if (bld != null) {
- if(bld.isInternalBuilder()){
- IConfiguration prefCfg = ManagedBuildManager.getPreferenceConfiguration(false);
- IBuilder prefBuilder = prefCfg.getBuilder();
- cfg.changeBuilder(prefBuilder, ManagedBuildManager.calculateChildId(cfg.getId(), null), prefBuilder.getName());
- bld = cfg.getEditableBuilder();
- bld.setBuildPath(null);
+ @Override
+ public void createProject(IProject project, boolean defaults, boolean onFinish, IProgressMonitor monitor) throws CoreException {
+ try {
+ monitor.beginTask("", 100);//$NON-NLS-1$
+
+ ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
+ ICProjectDescription des = mngr.createProjectDescription(project, false, !onFinish);
+ ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
+ ManagedProject mProj = new ManagedProject(des);
+ info.setManagedProject(mProj);
+ monitor.worked(20);
+ cfgs = CfgHolder.unique(fConfigPage.getCfgItems(defaults));
+ cfgs = CfgHolder.reorder(cfgs);
+ int work = 50/cfgs.length;
+ for (int i=0; i<cfgs.length; i++) {
+ String s = (cfgs[i].getToolChain() == null) ? "0" : ((ToolChain)(cfgs[i].getToolChain())).getId(); //$NON-NLS-1$
+ Configuration cfg = new Configuration(mProj, (ToolChain)cfgs[i].getToolChain(), ManagedBuildManager.calculateChildId(s, null), cfgs[i].getName());
+ IBuilder bld = cfg.getEditableBuilder();
+ if (bld != null) {
+ if(bld.isInternalBuilder()){
+ IConfiguration prefCfg = ManagedBuildManager.getPreferenceConfiguration(false);
+ IBuilder prefBuilder = prefCfg.getBuilder();
+ cfg.changeBuilder(prefBuilder, ManagedBuildManager.calculateChildId(cfg.getId(), null), prefBuilder.getName());
+ bld = cfg.getEditableBuilder();
+ bld.setBuildPath(null);
+ }
+ bld.setManagedBuildOn(false);
+ } else {
+ System.out.println(UIMessages.getString("StdProjectTypeHandler.3")); //$NON-NLS-1$
}
- bld.setManagedBuildOn(false);
- } else {
- System.out.println(UIMessages.getString("StdProjectTypeHandler.3")); //$NON-NLS-1$
+ cfg.setArtifactName(removeSpaces(project.getName()));
+ CConfigurationData data = cfg.getConfigurationData();
+ des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
+ monitor.worked(work);
}
- cfg.setArtifactName(removeSpaces(project.getName()));
- CConfigurationData data = cfg.getConfigurationData();
- des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
+ mngr.setProjectDescription(project, des);
+
+ doTemplatesPostProcess(project);
+ doCustom(project);
+ monitor.worked(30);
+ } finally {
+ monitor.done();
}
- mngr.setProjectDescription(project, des);
-
- doTemplatesPostProcess(project);
- doCustom(project);
}
public boolean canCreateWithoutToolchain() { return true; }

Back to the top