diff options
author | Karsten Thoms | 2020-11-13 20:04:45 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2021-01-20 07:43:10 +0000 |
commit | f553c30fd94a984cc75d8fc79269b9e0c87cbedc (patch) | |
tree | 024662d05282c33adea8ea52f1fdae1f785a1d59 | |
parent | d3ab09fbec4de49c976c6c0d123a1e4f3a742b56 (diff) | |
download | eclipse.platform.debug-f553c30fd94a984cc75d8fc79269b9e0c87cbedc.tar.gz eclipse.platform.debug-f553c30fd94a984cc75d8fc79269b9e0c87cbedc.tar.xz eclipse.platform.debug-f553c30fd94a984cc75d8fc79269b9e0c87cbedc.zip |
[cleanup] Combine nested 'if' within 'else' block to 'else if'I20210120-1800I20210120-1400
Cleanup performed on bundles
- org.eclipse.debug.core
Change-Id: I3e42c91479b0363ce858bcf01d2e2274ec9d4e6d
Signed-off-by: Karsten Thoms <karsten.thoms@karakun.com>
7 files changed, 34 insertions, 52 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java index 65e78f5b2..f35c70ed8 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java @@ -937,12 +937,10 @@ public class DebugPlugin extends Plugin { } } p = pb.start(); + } else if (workingDirectory == null) { + p = Runtime.getRuntime().exec(cmdLine, envp); } else { - if (workingDirectory == null) { - p = Runtime.getRuntime().exec(cmdLine, envp); - } else { - p = Runtime.getRuntime().exec(cmdLine, envp, workingDirectory); - } + p = Runtime.getRuntime().exec(cmdLine, envp, workingDirectory); } } catch (IOException e) { Status status = new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, DebugCoreMessages.DebugPlugin_0, e); diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java index ca8d5398b..9e0b6b228 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java @@ -267,13 +267,11 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau } catch (DebugException e) { status.merge(e.getStatus()); } - } else { - if (target.canDisconnect()) { - try { - target.disconnect(); - } catch (DebugException de) { - status.merge(de.getStatus()); - } + } else if (target.canDisconnect()) { + try { + target.disconnect(); + } catch (DebugException de) { + status.merge(de.getStatus()); } } } diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/RefreshUtil.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/RefreshUtil.java index 3a2ddc1ad..15bc7aaf7 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/RefreshUtil.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/RefreshUtil.java @@ -183,14 +183,12 @@ public class RefreshUtil { if (resource == null) { // empty selection return new IResource[]{}; - } else { - if (memento.equals(MEMENTO_SELECTED_RESOURCE)) { - return new IResource[] { resource }; - } else if (memento.equals(MEMENTO_SELECTED_CONTAINER)) { - return new IResource[] {resource.getParent()}; - } else if (memento.equals(MEMENTO_SELECTED_PROJECT)) { - return new IResource[] {resource.getProject()}; - } + } else if (memento.equals(MEMENTO_SELECTED_RESOURCE)) { + return new IResource[] { resource }; + } else if (memento.equals(MEMENTO_SELECTED_CONTAINER)) { + return new IResource[] {resource.getParent()}; + } else if (memento.equals(MEMENTO_SELECTED_PROJECT)) { + return new IResource[] {resource.getProject()}; } } throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), MessageFormat.format(DebugCoreMessages.RefreshUtil_0, memento))); diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java index cf60a2d75..7ee8a8c1c 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java @@ -681,12 +681,10 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig String memento = getAttribute(ATTR_SOURCE_LOCATOR_MEMENTO, (String)null); if (memento == null) { locator.initializeDefaults(this); + } else if(locator instanceof IPersistableSourceLocator2) { + ((IPersistableSourceLocator2)locator).initializeFromMemento(memento, this); } else { - if(locator instanceof IPersistableSourceLocator2) { - ((IPersistableSourceLocator2)locator).initializeFromMemento(memento, this); - } else { - locator.initializeFromMemento(memento); - } + locator.initializeFromMemento(memento); } launch.setSourceLocator(locator); } @@ -744,13 +742,11 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig } if (launch == null) { launch = new Launch(this, mode, null); - } else { - // ensure the launch mode is valid - if (!mode.equals(launch.getLaunchMode())) { - IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, - MessageFormat.format(DebugCoreMessages.LaunchConfiguration_14, mode, launch.getLaunchMode()), null); - throw new CoreException(status); - } + } else // ensure the launch mode is valid + if (!mode.equals(launch.getLaunchMode())) { + IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, + MessageFormat.format(DebugCoreMessages.LaunchConfiguration_14, mode, launch.getLaunchMode()), null); + throw new CoreException(status); } launch.setAttribute(DebugPlugin.ATTR_LAUNCH_TIMESTAMP, Long.toString(System.currentTimeMillis())); boolean captureOutput = getAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, true); diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.java index 9f460fdc1..4da5fa03d 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.java @@ -913,10 +913,8 @@ public class LaunchConfigurationInfo { if (strAttr1 == null && strAttr2 == null && !attr1.equals(attr2)) { return false; } - } else { - if (comp.compare(attr1, attr2) != 0) { - return false; - } + } else if (comp.compare(attr1, attr2) != 0) { + return false; } return true; } diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java index 4caad68bf..477ce0dce 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java @@ -284,12 +284,10 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe if (registered != null) { registered.add(fNotifierLaunches[j]); } - } else { - if (registered == null) { - registered = new ArrayList<>(fNotifierLaunches.length); - for (int k = 0; k < j; k++) { - registered.add(fNotifierLaunches[k]); - } + } else if (registered == null) { + registered = new ArrayList<>(fNotifierLaunches.length); + for (int k = 0; k < j; k++) { + registered.add(fNotifierLaunches[k]); } } } @@ -1366,13 +1364,11 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe } } + } else if (store != null){ + throw createDebugException(MessageFormat.format(DebugCoreMessages.LaunchManager_does_not_exist, new Object[] { + config.getName(), store.toURI().toString() }), null); } else { - if (store != null){ - throw createDebugException(MessageFormat.format(DebugCoreMessages.LaunchManager_does_not_exist, new Object[] { - config.getName(), store.toURI().toString() }), null); - } else { - throw createDebugException(MessageFormat.format(DebugCoreMessages.LaunchManager_does_not_exist_no_store_found, new Object[] { config.getName() }), null); - } + throw createDebugException(MessageFormat.format(DebugCoreMessages.LaunchManager_does_not_exist_no_store_found, new Object[] { config.getName() }), null); } } return info; diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/GroupLaunchConfigurationDelegate.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/GroupLaunchConfigurationDelegate.java index de3c2f2b7..851d35a95 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/GroupLaunchConfigurationDelegate.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/GroupLaunchConfigurationDelegate.java @@ -126,10 +126,8 @@ public class GroupLaunchConfigurationDelegate extends LaunchConfigurationDelegat // loop detected. report as appropriate and die. IStatusHandler cycleHandler = DebugPlugin.getDefault().getStatusHandler(GROUP_CYCLE); cycleHandler.handleStatus(GROUP_CYCLE, conf.getName()); - } else { - if (!launchChild(progress.newChild(1000 / launches.size()), group, le, conf, localMode, (i == launches.size() - 1))) { - break; - } + } else if (!launchChild(progress.newChild(1000 / launches.size()), group, le, conf, localMode, (i == launches.size() - 1))) { + break; } // in case the group has been terminated while waiting in the |