Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Pazderski2019-05-09 15:40:03 -0400
committerPaul Pazderski2019-08-12 10:04:47 -0400
commitfbfee8d1413f408c644681303c5a4e844c700874 (patch)
treec864066f42ccdd9c41c5096f0a0ac39807201678 /org.eclipse.debug.ui/ui/org/eclipse/debug/internal
parent36d4b6c1b9fd73256c3d5c3ee0a900fbc635a0eb (diff)
downloadeclipse.platform.debug-fbfee8d1413f408c644681303c5a4e844c700874.tar.gz
eclipse.platform.debug-fbfee8d1413f408c644681303c5a4e844c700874.tar.xz
eclipse.platform.debug-fbfee8d1413f408c644681303c5a4e844c700874.zip
Bug 549903 - Replace usage of deprecated SubProgressMonitor withI20190813-1800I20190812-1800
SubMonitor Also replaced the anti-pattern: if(doMore) { doSomething(new SubProgressMonitor(monitor)); } else { monitor.worked(); } As consequence skipped optional work will not move the progress bar anymore but leave the space for the remaining tasks. Change-Id: Id58944194449f58f887e8969d7ba9d7c16939f9c Signed-off-by: Paul Pazderski <paul-eclipse@ppazderski.de>
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java52
1 files changed, 19 insertions, 33 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
index 973c1dddd..d6910cfa9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -42,7 +42,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.IJobChangeListener;
import org.eclipse.core.runtime.jobs.IJobManager;
@@ -1014,18 +1014,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
public static ILaunch buildAndLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
boolean buildBeforeLaunch = getDefault().getPreferenceStore().getBoolean(IDebugUIConstants.PREF_BUILD_BEFORE_LAUNCH);
- monitor.beginTask(IInternalDebugCoreConstants.EMPTY_STRING, 1);
- try
- {
- return configuration.launch(
- mode,
- new SubProgressMonitor(monitor, 1),
- buildBeforeLaunch);
- }
- finally
- {
- monitor.done();
- }
+ return configuration.launch(mode, SubMonitor.convert(monitor, 1), buildBeforeLaunch);
}
/**
@@ -1074,19 +1063,18 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
* Setup progress monitor - Waiting for jobs to finish (2) -
* Build & launch (98)
*/
- monitor.beginTask(MessageFormat.format(DebugUIMessages.DebugUIPlugin_25, new Object[] {
- configuration.getName() }), 100);
-
+ final SubMonitor subMonitor = SubMonitor.convert(monitor, MessageFormat
+ .format(DebugUIMessages.DebugUIPlugin_25, new Object[] { configuration.getName() }), 100);
try {
- jobManager.join(ResourcesPlugin.FAMILY_MANUAL_BUILD, new SubProgressMonitor(monitor, 1));
- jobManager.join(ResourcesPlugin.FAMILY_AUTO_BUILD, new SubProgressMonitor(monitor, 1));
+ jobManager.join(ResourcesPlugin.FAMILY_MANUAL_BUILD, subMonitor.split(1));
+ jobManager.join(ResourcesPlugin.FAMILY_AUTO_BUILD, subMonitor.split(1));
} catch (InterruptedException e1) {
- /* continue */}
+ /* continue */
+ }
if (!monitor.isCanceled()) {
try {
- buildAndLaunch(configuration, mode, new SubProgressMonitor(monitor, 98));
- }
- catch (CoreException e2) {
+ buildAndLaunch(configuration, mode, subMonitor.split(98));
+ } catch (CoreException e2) {
throw new InvocationTargetException(e2);
}
}
@@ -1103,10 +1091,10 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
/*
* Setup progress monitor - Build & launch (1)
*/
- monitor.beginTask(MessageFormat.format(DebugUIMessages.DebugUIPlugin_25, new Object[] {
- configuration.getName() }), 1);
+ final SubMonitor subMonitor = SubMonitor.convert(monitor, MessageFormat
+ .format(DebugUIMessages.DebugUIPlugin_25, new Object[] { configuration.getName() }), 1);
try {
- buildAndLaunch(configuration, mode, new SubProgressMonitor(monitor, 1));
+ buildAndLaunch(configuration, mode, subMonitor);
} catch (CoreException e) {
throw new InvocationTargetException(e);
}
@@ -1190,7 +1178,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
/* Setup progress monitor
* - Waiting for jobs to finish (2)
* - Build & launch (98) */
- monitor.beginTask(DebugUIMessages.DebugUITools_3, 100);
+ final SubMonitor subMonitor = SubMonitor.convert(monitor, DebugUIMessages.DebugUITools_3, 100);
try {
if(waitInJob) {
StringBuilder buffer = new StringBuilder(configuration.getName());
@@ -1221,17 +1209,15 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
};
addJobChangeListener(listener);
try {
- jobManager.join(ResourcesPlugin.FAMILY_MANUAL_BUILD, new SubProgressMonitor(monitor, 1));
- jobManager.join(ResourcesPlugin.FAMILY_AUTO_BUILD, new SubProgressMonitor(monitor, 1));
+ jobManager.join(ResourcesPlugin.FAMILY_MANUAL_BUILD, subMonitor.split(1));
+ jobManager.join(ResourcesPlugin.FAMILY_AUTO_BUILD, subMonitor.split(1));
}
catch (InterruptedException e) {/*just continue.*/}
DebugPlugin.getDefault().getLaunchManager().removeLaunch(pendingLaunch);
}
- else {
- monitor.worked(2); /* don't wait for jobs to finish */
- }
+ subMonitor.setWorkRemaining(98);
if (!monitor.isCanceled()) {
- buildAndLaunch(configuration, mode, new SubProgressMonitor(monitor, 98));
+ buildAndLaunch(configuration, mode, subMonitor.split(98));
}
} catch (CoreException e) {
final IStatus status = e.getStatus();

Back to the top