@@ -122,6 +122,13 @@ public class IDEApplication implements IApplication, IExecutableExtension {
122
122
*/
123
123
private static final int RETRY_LOAD = 0 ;
124
124
125
+ /**
126
+ * Return value when the user wants to cancel launch since workspace already
127
+ * occupied
128
+ */
129
+ private static final int CANCEL_LAUNCH = 2 ;
130
+ private static final int CANCEL_LAUNCH_DEFAULT = -1 ;
131
+
125
132
/**
126
133
* A special return code that will be recognized by the PDE launcher and used to
127
134
* show an error dialog if the workspace is locked.
@@ -374,8 +381,9 @@ protected Object checkInstanceLocation(Shell shell, Map applicationArguments) {
374
381
375
382
MessageDialog dialog = new MessageDialog (null , IDEWorkbenchMessages .IDEApplication_workspaceInUseTitle ,
376
383
null , NLS .bind (IDEWorkbenchMessages .IDEApplication_workspaceInUseMessage , workspaceUrl .getFile ()),
377
- MessageDialog .ERROR , 1 , IDEWorkbenchMessages .IDEApplication_workspaceInUse_Retry ,
378
- IDEWorkbenchMessages .IDEApplication_workspaceInUse_Choose ) {
384
+ MessageDialog .ERROR , 2 , IDEWorkbenchMessages .IDEApplication_workspaceInUse_Retry ,
385
+ IDEWorkbenchMessages .IDEApplication_workspaceInUse_Choose ,
386
+ IDEWorkbenchMessages .IDEApplication_workspaceInUse_Cancel ) {
379
387
@ Override
380
388
protected Control createCustomArea (Composite parent ) {
381
389
if (lockInfo == null || lockInfo .isBlank ()) {
@@ -393,6 +401,11 @@ protected Control createCustomArea(Composite parent) {
393
401
};
394
402
// the return value influences the next loop's iteration
395
403
returnValue = dialog .open ();
404
+
405
+ if (returnValue == CANCEL_LAUNCH || returnValue == CANCEL_LAUNCH_DEFAULT ) {
406
+ return EXIT_OK ;
407
+ }
408
+
396
409
// Remember the locked workspace as recent workspace
397
410
launchData .writePersistedData ();
398
411
}
0 commit comments