|
Lines 422-475
Link Here
|
| 422 |
public void run() { |
422 |
public void run() { |
| 423 |
IWorkbenchWindow window = null; |
423 |
IWorkbenchWindow window = null; |
| 424 |
try{ |
424 |
try{ |
| 425 |
if (targetId != null) { |
425 |
// get the window to open the perspective in |
|
|
426 |
window = getWindowForPerspective(targetId); |
| 427 |
if (window == null) { |
| 428 |
return; |
| 429 |
} |
| 430 |
|
| 431 |
// switch the perspective if user preference is set |
| 432 |
if (shouldSwitchPerspective(window, targetId, IInternalDebugUIConstants.PREF_SWITCH_PERSPECTIVE_ON_SUSPEND)) { |
| 433 |
switchToPerspective(window, targetId); |
| 426 |
window = getWindowForPerspective(targetId); |
434 |
window = getWindowForPerspective(targetId); |
| 427 |
if (window == null) { |
435 |
if (window == null) { |
| 428 |
return; |
436 |
return; |
| 429 |
} |
437 |
} |
| 430 |
|
438 |
} |
| 431 |
if (shouldSwitchPerspective(window, targetId, IInternalDebugUIConstants.PREF_SWITCH_PERSPECTIVE_ON_SUSPEND)) { |
439 |
|
| 432 |
switchToPerspective(window, targetId); |
440 |
// make sure the shell is active |
| 433 |
window = getWindowForPerspective(targetId); |
441 |
Shell shell= window.getShell(); |
| 434 |
if (window == null) { |
442 |
if (shell != null) { |
| 435 |
return; |
443 |
if (DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IDebugUIConstants.PREF_ACTIVATE_WORKBENCH)) { |
| 436 |
} |
444 |
if (shell.getMinimized()) { |
| 437 |
} |
445 |
shell.setMinimized(false); |
| 438 |
Shell shell= window.getShell(); |
|
|
| 439 |
if (shell != null) { |
| 440 |
if (DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IDebugUIConstants.PREF_ACTIVATE_WORKBENCH)) { |
| 441 |
if (shell.getMinimized()) { |
| 442 |
shell.setMinimized(false); |
| 443 |
} |
| 444 |
shell.forceActive(); |
| 445 |
} |
446 |
} |
|
|
447 |
shell.forceActive(); |
| 446 |
} |
448 |
} |
| 447 |
} |
449 |
} |
| 448 |
if (targetId != null) { |
450 |
|
| 449 |
Object ca = fLaunchToContextActivations.get(launch); |
451 |
// Activate a context for the launch |
| 450 |
if (ca == null) { |
452 |
Object ca = fLaunchToContextActivations.get(launch); |
| 451 |
ILaunchConfiguration launchConfiguration = launch.getLaunchConfiguration(); |
453 |
if (ca == null) { |
| 452 |
if (launchConfiguration != null) { |
454 |
ILaunchConfiguration launchConfiguration = launch.getLaunchConfiguration(); |
| 453 |
try { |
455 |
if (launchConfiguration != null) { |
| 454 |
String type = launchConfiguration.getType().getIdentifier(); |
456 |
try { |
| 455 |
ViewContextService service = ViewContextManager.getDefault().getService(window); |
457 |
String type = launchConfiguration.getType().getIdentifier(); |
| 456 |
if (service != null) { |
458 |
ViewContextService service = ViewContextManager.getDefault().getService(window); |
| 457 |
IContextService contextServce = (IContextService) PlatformUI.getWorkbench().getAdapter(IContextService.class); |
459 |
if (service != null) { |
| 458 |
String[] ids = service.getEnabledPerspectives(); |
460 |
IContextService contextServce = (IContextService) PlatformUI.getWorkbench().getAdapter(IContextService.class); |
| 459 |
IContextActivation[] activations = new IContextActivation[ids.length]; |
461 |
String[] ids = service.getEnabledPerspectives(); |
| 460 |
for (int i = 0; i < ids.length; i++) { |
462 |
IContextActivation[] activations = new IContextActivation[ids.length]; |
| 461 |
Context context = contextServce.getContext(type + "." + ids[i]); //$NON-NLS-1$ |
463 |
for (int i = 0; i < ids.length; i++) { |
| 462 |
if (!context.isDefined()) { |
464 |
// Include the word '.internal.' so the context is filtered from the key binding pref page (Bug 144019) also see ViewContextService.contextActivated() |
| 463 |
context.define(context.getId(), null, null); |
465 |
Context context = contextServce.getContext(type + ".internal." + ids[i]); //$NON-NLS-1$ |
| 464 |
} |
466 |
if (!context.isDefined()) { |
| 465 |
IContextActivation activation = contextServce.activateContext(context.getId()); |
467 |
context.define(context.getId(), null, null); |
| 466 |
activations[i] = activation; |
|
|
| 467 |
} |
468 |
} |
| 468 |
fLaunchToContextActivations.put(launch, activations); |
469 |
IContextActivation activation = contextServce.activateContext(context.getId()); |
|
|
470 |
activations[i] = activation; |
| 469 |
} |
471 |
} |
| 470 |
} catch (CoreException e) { |
472 |
fLaunchToContextActivations.put(launch, activations); |
| 471 |
DebugUIPlugin.log(e); |
|
|
| 472 |
} |
473 |
} |
|
|
474 |
} catch (CoreException e) { |
| 475 |
DebugUIPlugin.log(e); |
| 473 |
} |
476 |
} |
| 474 |
} |
477 |
} |
| 475 |
|
478 |
|