Skip to content

Implement PKCS authentication #1158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 140 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
5479253
bundle time
JavaJoeS Jan 29, 2024
029495c
Reset alg
JavaJoeS Jan 29, 2024
9418acf
Use Stronger secure random
JavaJoeS Jan 29, 2024
0b22d92
Update Crypto to GCM
JavaJoeS Jan 30, 2024
ee73e2a
Dont trust just any CA
JavaJoeS Jan 30, 2024
ea97676
Remove obsolete Crypto methods
JavaJoeS Jan 30, 2024
43724f6
Correct obsolete Crypto
JavaJoeS Jan 30, 2024
d94d6e6
Merge branch 'master' into master
JavaJoeS Jan 31, 2024
e0e5ab7
Merge branch 'eclipse-platform:master' into master
JavaJoeS Feb 5, 2024
d0989e3
Merge branch 'eclipse-platform:master' into master
JavaJoeS Feb 5, 2024
f2d2594
Revert "bundle time"
JavaJoeS Feb 5, 2024
d2c2167
Replace lost files
JavaJoeS Feb 6, 2024
7562447
Update manifest
JavaJoeS Feb 6, 2024
7ea9dc8
Replace missing files
JavaJoeS Feb 6, 2024
81aa8d7
Replace missing files
JavaJoeS Feb 6, 2024
ff137b4
replace missing files
JavaJoeS Feb 6, 2024
b05e626
Replace missing files
JavaJoeS Feb 6, 2024
ef98d11
Remove DebugLogger
JavaJoeS Feb 6, 2024
a58d6ac
Remove DebugLogger
JavaJoeS Feb 6, 2024
6f75212
Remove DebugLogger
JavaJoeS Feb 6, 2024
df952f5
Remove DebugLogger
JavaJoeS Feb 6, 2024
de65586
Removeing DebugLogger
JavaJoeS Feb 6, 2024
b51293b
Replace lost files
JavaJoeS Feb 6, 2024
79ab1a6
Remove about statement
JavaJoeS Feb 6, 2024
ca8ec9d
Merge branch 'eclipse-platform:master' into master
JavaJoeS Feb 7, 2024
1a20d28
Merge branch 'eclipse-platform:master' into master
JavaJoeS Feb 12, 2024
0f7c1a2
Ensure Keystoremanager knows a PKCS11 Keystore was set
JavaJoeS Feb 7, 2024
fb1e17a
Ensure there was a Setter
JavaJoeS Feb 7, 2024
7c49e86
Make sure options available for preferences page
JavaJoeS Feb 7, 2024
dc07ef7
Update keystore configuration
JavaJoeS Feb 12, 2024
57d426b
Update logging
JavaJoeS Feb 13, 2024
daa8b56
Update logging
JavaJoeS Feb 13, 2024
cc74eb1
Ensure logging properties function properly
JavaJoeS Feb 13, 2024
e16bef2
Add processing when no pki found
JavaJoeS Feb 13, 2024
f9ca94e
Set Provider name in security, remove if its missing
JavaJoeS Feb 13, 2024
a7305c4
Create Test for core.pki
JavaJoeS Feb 14, 2024
1d6afbe
Remove unused files
JavaJoeS Feb 18, 2024
f8b7785
mv test package into team bundles
JavaJoeS Feb 18, 2024
7348312
Add Exception processing messages
JavaJoeS Feb 18, 2024
e3263df
Add messages for logging
JavaJoeS Feb 20, 2024
1540188
Debug pki initialization
JavaJoeS Feb 20, 2024
e9530c4
Fix trustStore password load
JavaJoeS Feb 20, 2024
b2ef488
Remove extra debug statements
JavaJoeS Feb 20, 2024
e39de40
Move to teams bundles
JavaJoeS Feb 20, 2024
0a0b01f
Update pki core tests
JavaJoeS Feb 20, 2024
b27c356
Update security .pki file location to .eclipse directory
JavaJoeS Feb 21, 2024
4c16381
Ensure PKCS11 bad pin fails
JavaJoeS Feb 21, 2024
5b90fa2
Merge branch 'eclipse-platform:master' into master
JavaJoeS Feb 22, 2024
ce294cf
Add login processing for ui to core
JavaJoeS Feb 22, 2024
f36f925
Remove SecurityFileSnapshot instance
JavaJoeS Feb 22, 2024
738076b
Update bundle classpath
JavaJoeS Feb 26, 2024
4be0d7a
Update smartcard preference
JavaJoeS Feb 26, 2024
c647f6b
Add Markdown write up on this package
JavaJoeS Feb 27, 2024
bc77041
Correction to spelling
JavaJoeS Feb 27, 2024
a4699e1
Update with PKCS11 option
JavaJoeS Feb 27, 2024
19f3c0d
Correct markdown paragraph numbering
JavaJoeS Feb 27, 2024
b345ed1
Add text for option number 1
JavaJoeS Feb 27, 2024
c830fe7
Add more information
JavaJoeS Feb 27, 2024
a7d882f
Add footnote and refine definitions
JavaJoeS Feb 27, 2024
3c6f2b4
Make sure invalid truststore password is caught
JavaJoeS Feb 28, 2024
af46b49
Merge branch 'eclipse-platform:master' into master
JavaJoeS Feb 29, 2024
92c4a0e
Recommended option to pick
JavaJoeS Mar 4, 2024
81c5027
Add checks for PKI properties
JavaJoeS Mar 5, 2024
075c651
Add type args
JavaJoeS Mar 5, 2024
bfb37ea
Removing print statements
JavaJoeS Mar 5, 2024
18e71b1
Make sure to close .pki properties after restore
JavaJoeS Mar 6, 2024
676973e
Remove Bundle-ClassPath
JavaJoeS Mar 6, 2024
9f36a68
bundle time
JavaJoeS Jan 29, 2024
d31e556
Reset alg
JavaJoeS Jan 29, 2024
df615cd
Use Stronger secure random
JavaJoeS Jan 29, 2024
592d079
Update Crypto to GCM
JavaJoeS Jan 30, 2024
d351649
Dont trust just any CA
JavaJoeS Jan 30, 2024
0929d9a
Remove obsolete Crypto methods
JavaJoeS Jan 30, 2024
767fade
Correct obsolete Crypto
JavaJoeS Jan 30, 2024
7f5bf4e
Revert "bundle time"
JavaJoeS Feb 5, 2024
2097421
Replace lost files
JavaJoeS Feb 6, 2024
7682dfb
Update manifest
JavaJoeS Feb 6, 2024
6282988
Replace missing files
JavaJoeS Feb 6, 2024
83c7f9f
Replace missing files
JavaJoeS Feb 6, 2024
b1b53e5
replace missing files
JavaJoeS Feb 6, 2024
6c5675f
Replace missing files
JavaJoeS Feb 6, 2024
866e6db
Remove DebugLogger
JavaJoeS Feb 6, 2024
deadd38
Remove DebugLogger
JavaJoeS Feb 6, 2024
d584337
Remove DebugLogger
JavaJoeS Feb 6, 2024
6b91112
Remove DebugLogger
JavaJoeS Feb 6, 2024
f595d64
Removeing DebugLogger
JavaJoeS Feb 6, 2024
4abb356
Replace lost files
JavaJoeS Feb 6, 2024
dff8a8e
Remove about statement
JavaJoeS Feb 6, 2024
5d78c42
Ensure Keystoremanager knows a PKCS11 Keystore was set
JavaJoeS Feb 7, 2024
b092c8e
Ensure there was a Setter
JavaJoeS Feb 7, 2024
a637df9
Make sure options available for preferences page
JavaJoeS Feb 7, 2024
2bdf57a
Update keystore configuration
JavaJoeS Feb 12, 2024
e641239
Update logging
JavaJoeS Feb 13, 2024
76ca525
Update logging
JavaJoeS Feb 13, 2024
3ac4443
Ensure logging properties function properly
JavaJoeS Feb 13, 2024
b18cd01
Add processing when no pki found
JavaJoeS Feb 13, 2024
0ba2d05
Set Provider name in security, remove if its missing
JavaJoeS Feb 13, 2024
f9e79a0
Create Test for core.pki
JavaJoeS Feb 14, 2024
36178f3
Remove unused files
JavaJoeS Feb 18, 2024
bf3e8f4
mv test package into team bundles
JavaJoeS Feb 18, 2024
910df90
Add Exception processing messages
JavaJoeS Feb 18, 2024
5fe0afc
Add messages for logging
JavaJoeS Feb 20, 2024
2ff120f
Debug pki initialization
JavaJoeS Feb 20, 2024
4ecc1e8
Fix trustStore password load
JavaJoeS Feb 20, 2024
83c4957
Remove extra debug statements
JavaJoeS Feb 20, 2024
b139958
Move to teams bundles
JavaJoeS Feb 20, 2024
cbb8b6b
Update pki core tests
JavaJoeS Feb 20, 2024
ee5e122
Update security .pki file location to .eclipse directory
JavaJoeS Feb 21, 2024
3e7daf5
Ensure PKCS11 bad pin fails
JavaJoeS Feb 21, 2024
e09f6e2
Add login processing for ui to core
JavaJoeS Feb 22, 2024
92cd95a
Remove SecurityFileSnapshot instance
JavaJoeS Feb 22, 2024
5bf02d6
Update bundle classpath
JavaJoeS Feb 26, 2024
d46a8b8
Update smartcard preference
JavaJoeS Feb 26, 2024
b4b1780
Add Markdown write up on this package
JavaJoeS Feb 27, 2024
02b976f
Correction to spelling
JavaJoeS Feb 27, 2024
0782714
Update with PKCS11 option
JavaJoeS Feb 27, 2024
ab02f29
Correct markdown paragraph numbering
JavaJoeS Feb 27, 2024
a882201
Add text for option number 1
JavaJoeS Feb 27, 2024
9770242
Add more information
JavaJoeS Feb 27, 2024
f444046
Add footnote and refine definitions
JavaJoeS Feb 27, 2024
e8ecc25
Make sure invalid truststore password is caught
JavaJoeS Feb 28, 2024
f732132
Recommended option to pick
JavaJoeS Mar 4, 2024
7cf27d2
Add checks for PKI properties
JavaJoeS Mar 5, 2024
1754d67
Add type args
JavaJoeS Mar 5, 2024
099e514
Removing print statements
JavaJoeS Mar 5, 2024
fbc88a2
Make sure to close .pki properties after restore
JavaJoeS Mar 6, 2024
cb1b6ca
Remove Bundle-ClassPath
JavaJoeS Mar 6, 2024
d6098e3
Merge branch 'eclipse-platform:master' into master
JavaJoeS Mar 11, 2024
84272b0
Initial solicit pw from cons
JavaJoeS Mar 11, 2024
4d8fdc8
Dont require pw in .pki file
JavaJoeS Mar 11, 2024
f3a8593
Try console when no pw in .pki
JavaJoeS Mar 11, 2024
6f79872
Hide output from display
JavaJoeS Mar 11, 2024
0308da7
Update to avoid pw from pki file
JavaJoeS Mar 12, 2024
ecb07fc
Require certain pki properties
JavaJoeS Mar 12, 2024
150bfe2
Merge branch 'master' of
JavaJoeS Mar 12, 2024
7b2c3f5
Require certain properties
JavaJoeS Mar 12, 2024
f140878
Ensure password can be omitted from .pki file
JavaJoeS Mar 12, 2024
86c2847
Require certain PKI properties, make pw optional
JavaJoeS Mar 12, 2024
796cb5a
For pkcs12, no config file is required for pki
JavaJoeS Mar 12, 2024
5feb7ea
Merge branch 'eclipse-platform:master' into master
JavaJoeS Mar 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ pipeline {
sh """
mvn clean verify --batch-mode --fail-at-end -Dmaven.repo.local=$WORKSPACE/.m2/repository \
-Pbree-libs -Papi-check -Pjavadoc \
-Dmaven.test.failure.ignore=true \
-Dcompare-version-with-baselines.skip=false \
-Dmaven.compiler.failOnWarning=false \
-Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss.SSS \
Expand All @@ -31,8 +30,8 @@ pipeline {
archiveArtifacts artifacts: '.*log,*/target/work/data/.metadata/.*log,*/tests/target/work/data/.metadata/.*log,apiAnalyzer-workspace/.metadata/.*log', allowEmptyArchive: true
junit '**/target/surefire-reports/TEST-*.xml'
discoverGitReferenceBuild referenceJob: 'eclipse.platform/master'
recordIssues publishAllIssues:false, ignoreQualityGate:true, tool: eclipse(name: 'Compiler and API Tools', pattern: '**/target/compilelogs/*.xml'), qualityGates: [[threshold: 1, type: 'DELTA', unstable: true]]
recordIssues publishAllIssues:false, tools: [mavenConsole(), javaDoc()]
recordIssues tools: [eclipse(name: 'Compiler and API Tools', pattern: '**/target/compilelogs/*.xml'), javaDoc()], qualityGates: [[threshold: 1, type: 'DELTA', unstable: true]]
recordIssues tool: mavenConsole(), qualityGates: [[threshold: 1, type: 'DELTA_ERROR', unstable: true]]
}
}
}
Expand Down
Binary file modified ant/org.eclipse.ant.launching/lib/antdebug.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion debug/org.eclipse.debug.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.debug.core; singleton:=true
Bundle-Version: 3.21.400.qualifier
Bundle-Version: 3.21.300.qualifier
Bundle-Activator: org.eclipse.debug.core.DebugPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@


import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
Expand Down Expand Up @@ -68,7 +66,7 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
/**
* The configuration that was launched, or null.
*/
private volatile ILaunchConfiguration fConfiguration = null;
private ILaunchConfiguration fConfiguration= null;

/**
* The system processes associated with
Expand All @@ -80,7 +78,7 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
* The source locator to use in the debug session
* or <code>null</code> if not supported.
*/
private volatile ISourceLocator fLocator = null;
private ISourceLocator fLocator= null;

/**
* The mode this launch was launched in.
Expand All @@ -90,7 +88,7 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
/**
* Table of client defined attributes
*/
private final Map<String, String> fAttributes = new ConcurrentHashMap<>();
private HashMap<String, String> fAttributes;

/**
* Flag indicating that change notification should
Expand Down Expand Up @@ -321,20 +319,20 @@ public ILaunchConfiguration getLaunchConfiguration() {
*/
@Override
public void setAttribute(String key, String value) {
Objects.requireNonNull(key);
if (value == null) {
// ConcurrentHashMap does not allow null values
fAttributes.remove(key);
} else {
fAttributes.put(key, value);
if (fAttributes == null) {
fAttributes = new HashMap<>(5);
}
fAttributes.put(key, value);
}

/**
* @see ILaunch#getAttribute(String)
*/
@Override
public String getAttribute(String key) {
if (fAttributes == null) {
return null;
}
return fAttributes.get(key);
}

Expand All @@ -345,7 +343,7 @@ public String getAttribute(String key) {
public IDebugTarget[] getDebugTargets() {
readLock.lock();
try {
return fTargets.toArray(IDebugTarget[]::new);
return fTargets.toArray(new IDebugTarget[fTargets.size()]);
} finally {
readLock.unlock();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,16 @@
import org.eclipse.debug.core.ILaunch;

/**
* A process represents a program running in normal (non-debug) mode. Processes
* support setting and getting of client defined attributes. This way, clients
* can annotate a process with any extra information important to them. For
* example, classpath annotations, or command line arguments used to launch the
* process may be important to a client.
* A process represents a program running in normal (non-debug) mode.
* Processes support setting and getting of client defined attributes.
* This way, clients can annotate a process with any extra information
* important to them. For example, classpath annotations, or command
* line arguments used to launch the process may be important to a client.
* <p>
* Clients may implement this interface, however, the debug plug-in provides an
* implementation of this interface for a <code>java.lang.Process</code>.
* Clients may implement this interface, however, the debug plug-in
* provides an implementation of this interface for a
* <code>java.lang.Process</code>.
* </p>
*
* If implementing custom launches it is important to fire event whenever the
* process state changes in the following way:
*
* <pre>
* DebugPlugin manager = DebugPlugin.getDefault();
* if (manager != null) {
* manager.fireDebugEventSet(new DebugEvent[] {
* new DebugEvent(this, DebugEvent.CREATE) });
* }
* </pre>
*
* otherwise the UI will probably show faulty state for your process and launch.
*
* @see org.eclipse.debug.core.DebugPlugin#newProcess(ILaunch, Process, String)
*/
public interface IProcess extends IAdaptable, ITerminate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
import java.nio.charset.IllegalCharsetNameException;
import java.nio.charset.UnsupportedCharsetException;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
Expand Down Expand Up @@ -69,9 +68,7 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
private Process fProcess;

/**
* This process's exit value.
*
* synchronized by this
* This process's exit value
*/
private int fExitValue;

Expand Down Expand Up @@ -99,17 +96,17 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
/**
* Table of client defined attributes
*/
private final Map<String, String> fAttributes = new ConcurrentHashMap<>();
private Map<String, String> fAttributes;

/**
* Whether output from the process should be captured or swallowed
*/
private final boolean fCaptureOutput;
private boolean fCaptureOutput = true;

/**
* Whether the descendants of this process should be terminated too
*/
private final boolean fTerminateDescendants;
private boolean fTerminateDescendants = true;

private final String fThreadNameSuffix;

Expand Down Expand Up @@ -144,16 +141,14 @@ public RuntimeProcess(ILaunch launch, Process process, String name, Map<String,
String captureOutput = launch.getAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT);
fCaptureOutput = !("false".equals(captureOutput)); //$NON-NLS-1$

boolean terminateDescendants = true;
try {
ILaunchConfiguration launchConfiguration = launch.getLaunchConfiguration();
if (launchConfiguration != null) {
terminateDescendants = launchConfiguration.getAttribute(DebugPlugin.ATTR_TERMINATE_DESCENDANTS, true);
fTerminateDescendants = launchConfiguration.getAttribute(DebugPlugin.ATTR_TERMINATE_DESCENDANTS, true);
}
} catch (CoreException e) {
DebugPlugin.log(e);
}
fTerminateDescendants = terminateDescendants;
fThreadNameSuffix = getPidInfo(process, launch);

fStreamsProxy = createStreamsProxy();
Expand Down Expand Up @@ -269,9 +264,7 @@ public void terminate() throws DebugException {
try { // (in total don't wait longer than TERMINATION_TIMEOUT)
long waitStart = System.currentTimeMillis();
if (process.waitFor(TERMINATION_TIMEOUT, TimeUnit.MILLISECONDS)) {
synchronized (this) {
fExitValue = process.exitValue();
}
fExitValue = process.exitValue();
if (waitFor(descendants, waitStart)) {
return;
}
Expand Down Expand Up @@ -426,25 +419,26 @@ protected void fireChangeEvent() {
*/
@Override
public void setAttribute(String key, String value) {
Objects.requireNonNull(key);
if (value == null) {
// ConcurrentHashMap does not allow null values
if (fAttributes.remove(key) != null) {
fireChangeEvent();
}
} else {
String origVal = fAttributes.put(key, value);
if (!Objects.equals(origVal, value)) {
fireChangeEvent();
}
if (fAttributes == null) {
fAttributes = new HashMap<>(5);
}
Object origVal = fAttributes.get(key);
if (origVal != null && origVal.equals(value)) {
return; //nothing changed.
}

fAttributes.put(key, value);
fireChangeEvent();
}

/**
* @see IProcess#getAttribute(String)
*/
@Override
public String getAttribute(String key) {
if (fAttributes == null) {
return null;
}
return fAttributes.get(key);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.2.0" deactivate="deactivate" immediate="true" name="org.eclipse.debug.ui.launchview.internal.model.LaunchViewModel">
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.2.0" activate="activate" deactivate="deactivate" immediate="true" name="org.eclipse.debug.ui.launchview.internal.model.LaunchViewModel">
<service>
<provide interface="org.eclipse.debug.ui.launchview.internal.model.ILaunchModel"/>
</service>
Expand Down
2 changes: 1 addition & 1 deletion debug/org.eclipse.debug.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.debug.ui; singleton:=true
Bundle-Version: 3.18.400.qualifier
Bundle-Version: 3.18.300.qualifier
Bundle-Activator: org.eclipse.debug.internal.ui.DebugUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.commands.actions;

import java.util.Arrays;

import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchManager;
Expand All @@ -27,11 +22,9 @@
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
import org.eclipse.debug.internal.ui.actions.ActionMessages;
import org.eclipse.debug.ui.actions.DebugCommandAction;
import org.eclipse.debug.ui.contexts.DebugContextEvent;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.widgets.Event;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;

Expand All @@ -56,7 +49,9 @@ public void dispose() {
private void attachSelfToLaunchManager() {
ILaunchManager launchManager = getLaunchManager();
launchManager.addLaunchListener(this);
setEnabled(canTerminate());
// heuristic... rather than updating all the time, just assume there's
// something that's not terminated.
setEnabled(launchManager.getLaunches().length > 0);
}

private ILaunchManager getLaunchManager() {
Expand Down Expand Up @@ -108,12 +103,12 @@ protected Class<ITerminateHandler> getCommandType() {

@Override
public void launchesTerminated(ILaunch[] launches) {
setEnabled(canTerminate());
setEnabled(getLaunchManager().getLaunches().length > 0);
}

@Override
public void launchesAdded(ILaunch[] launches) {
setEnabled(canTerminate());
setEnabled(true);
}

@Override
Expand All @@ -122,7 +117,7 @@ public void launchesChanged(ILaunch[] launches) {

@Override
public void launchesRemoved(ILaunch[] launches) {
setEnabled(canTerminate());
setEnabled(getLaunchManager().getLaunches().length > 0);
}

@Override
Expand All @@ -141,32 +136,4 @@ public void init(IWorkbenchWindow window) {
super.init(window);
attachSelfToLaunchManager();
}

@Override
protected boolean getInitialEnablement() {
return canTerminate();
}

private boolean canTerminate() {
return Arrays.stream(getLaunchManager().getLaunches()).anyMatch(ILaunch::canTerminate);
}

@Override
public void runWithEvent(Event event) {
for (ILaunch l : getLaunchManager().getLaunches()) {
try {
if (l.canTerminate()) {
l.terminate();
}
} catch (DebugException e) {
ILog.get().log(Status.warning("Unable to terminate launch: " + e.getMessage(), e)); //$NON-NLS-1$
}
}
setEnabled(canTerminate());
}

@Override
public void debugContextChanged(DebugContextEvent event) {
setEnabled(canTerminate());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ public ProcessConsole(IProcess process, IConsoleColorProvider colorProvider, Str

colorProvider.connect(fProcess, this);

setName(computeName());

Color color = fColorProvider.getColor(IDebugUIConstants.ID_STANDARD_INPUT_STREAM);
if (fInput instanceof IOConsoleInputStream) {
((IOConsoleInputStream)fInput).setColor(color);
Expand Down Expand Up @@ -554,9 +556,6 @@ private synchronized void disposeStreams() {
protected void init() {
super.init();
DebugPlugin.getDefault().addDebugEventListener(this);
// computeName() after addDebugEventListener()
// see https://github.com/eclipse-jdt/eclipse.jdt.debug/issues/390
setName(computeName());
if (fProcess.isTerminated()) {
closeStreams();
resetName();
Expand Down
2 changes: 1 addition & 1 deletion debug/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<parent>
<groupId>org.eclipse.platform</groupId>
<artifactId>eclipse.platform</artifactId>
<version>4.32.0-SNAPSHOT</version>
<version>4.31.0-SNAPSHOT</version>
</parent>

<groupId>org.eclipse.platform</groupId>
Expand Down
Loading