Skip to content

Commit edebba5

Browse files
eharris369GitHub Enterprise
authored andcommitted
Merge pull request #223 from eharris/205-removeOldLaunchConfigs
Issue #205: Remove old launch configurations
2 parents 5b5ba1c + 47d88d2 commit edebba5

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

dev/com.ibm.microclimate.core/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
/build
44
/depcache
55
/dist
6+
/lib
67
/about.mappings

dev/com.ibm.microclimate.core/src/com/ibm/microclimate/core/internal/MCEclipseApplication.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,14 @@ public void clearDebugger() {
121121
}
122122
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
123123
launchManager.removeLaunch(launch);
124+
ILaunchConfiguration launchConfig = launch.getLaunchConfiguration();
125+
if (launchConfig != null) {
126+
try {
127+
launchConfig.delete();
128+
} catch (CoreException e) {
129+
MCLogger.logError("An error occurred while deleting the launch configuration for project: " + name, e); //$NON-NLS-1$
130+
}
131+
}
124132
}
125133
setLaunch(null);
126134
}
@@ -161,9 +169,9 @@ public void reconnectDebugger() {
161169
// Check if the debugger is still attached (for Liberty, a small change to the app does not require a server restart)
162170
IDebugTarget debugTarget = launch.getDebugTarget();
163171
if (debugTarget == null || debugTarget.isDisconnected()) {
172+
// Clean up
173+
clearDebugger();
164174
// Reconnect the debugger
165-
launchManager.removeLaunch(launch);
166-
launch = null;
167175
connectDebugger();
168176
}
169177
}
@@ -179,8 +187,7 @@ public void attachDebugger() {
179187
// Already attached
180188
return;
181189
}
182-
DebugPlugin.getDefault().getLaunchManager().removeLaunch(launch);
183-
launch = null;
190+
clearDebugger();
184191
}
185192
connectDebugger();
186193
}
@@ -200,10 +207,7 @@ public IDebugTarget getDebugTarget() {
200207
@Override
201208
public void dispose() {
202209
// Clean up the launch
203-
if (launch != null) {
204-
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
205-
launchManager.removeLaunch(launch);
206-
}
210+
clearDebugger();
207211

208212
// Clean up the consoles
209213
List<IConsole> consoles = new ArrayList<IConsole>();

dev/com.ibm.microclimate.core/src/com/ibm/microclimate/core/internal/connection/MicroclimateConnection.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,9 @@ public MicroclimateApplication removeApp(String projectID) {
254254
* @return The app with the given ID, if it exists in this Microclimate instance, else null.
255255
*/
256256
public synchronized MicroclimateApplication getAppByID(String projectID) {
257-
MicroclimateApplication app = null;
258257
synchronized(appMap) {
259-
app = appMap.get(projectID);
258+
return appMap.get(projectID);
260259
}
261-
return app;
262260
}
263261

264262
public MicroclimateApplication getAppByName(String name) {

0 commit comments

Comments
 (0)