Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorSergey Kovalchuk2020-01-03 07:52:38 +0000
committerJonah Graham2020-01-03 14:34:34 +0000
commitb74f56878c081a9f5b5d033c55bb992658c33119 (patch)
tree70e10594cf108448a89353265a5c9f5363518a59 /build
parent55e08c0dfa1eabd64ee05ec4492781b18c2d3259 (diff)
downloadorg.eclipse.cdt-b74f56878c081a9f5b5d033c55bb992658c33119.tar.gz
org.eclipse.cdt-b74f56878c081a9f5b5d033c55bb992658c33119.tar.xz
org.eclipse.cdt-b74f56878c081a9f5b5d033c55bb992658c33119.zip
Bug 558474 - CleanUp deprecated methods in org.eclipse.cdt.ui
Reworked SubMonitors (Part2) Fixed percentage counting Removed explicit cancellation checks. Change-Id: Ibd9ef2664885746ab9ac2be556ac5effc994a512 Signed-off-by: Sergey Kovalchuk <sergei.kovalchuk@arsysop.ru>
Diffstat (limited to 'build')
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/MBSWizardHandler.java26
1 files changed, 12 insertions, 14 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 066ba6fba3e..0af8672ff60 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
@@ -61,6 +61,7 @@ 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.core.runtime.SubMonitor;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.IWizardPage;
@@ -576,15 +577,11 @@ public class MBSWizardHandler extends CWizardHandler {
@Override
public void createProject(IProject project, boolean defaults, boolean onFinish, IProgressMonitor monitor)
throws CoreException {
- try {
- monitor.beginTask("", 100); //$NON-NLS-1$
- setProjectDescription(project, defaults, onFinish, monitor);
- doTemplatesPostProcess(project);
- doCustom(project);
- monitor.worked(30);
- } finally {
- monitor.done();
- }
+ SubMonitor subMonitor = SubMonitor.convert(monitor, 100);
+ setProjectDescription(project, defaults, onFinish, subMonitor.split(70));
+ doTemplatesPostProcess(project);
+ doCustom(project);
+ subMonitor.worked(30);
}
@Override
@@ -594,10 +591,11 @@ public class MBSWizardHandler extends CWizardHandler {
private void setProjectDescription(IProject project, boolean defaults, boolean onFinish, IProgressMonitor monitor)
throws CoreException {
+ SubMonitor subMonitor = SubMonitor.convert(monitor, 3);
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
ICProjectDescription des = mngr.createProjectDescription(project, false, !onFinish);
ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
- monitor.worked(10);
+ subMonitor.worked(1);
cfgs = getCfgItems(false);
if (cfgs == null || cfgs.length == 0)
cfgs = CDTConfigWizardPage.getDefaultCfgs(this);
@@ -609,15 +607,15 @@ public class MBSWizardHandler extends CWizardHandler {
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;
+ subMonitor.worked(1);
- int work = 50 / cfgs.length;
-
+ SubMonitor cfgMonitor = SubMonitor.convert(subMonitor.split(1), cfgs.length);
for (CfgHolder cfg : cfgs) {
cf = (Configuration) cfg.getConfiguration();
String id = ManagedBuildManager.calculateChildId(cf.getId(), null);
@@ -640,7 +638,7 @@ public class MBSWizardHandler extends CWizardHandler {
cfgDebug = cfgDes;
if (cfgFirst == null) // select at least first configuration
cfgFirst = cfgDes;
- monitor.worked(work);
+ cfgMonitor.worked(1);
}
mngr.setProjectDescription(project, des);
}

Back to the top