private void abortContinueDialog(final IDebugTarget target) {
    // do not report errors for snippet editor targets
    // that do not support HCR. HCR is simulated by using
    // a new class loader for each evaluation
    // final ILaunch launch = target.getLaunch();
    // if (launch.getAttribute(ScrapbookLauncher.SCRAPBOOK_LAUNCH) != null)
    // {
    // if (!target.supportsHotCodeReplace()) {
    // return;
    // }
    // }
    final Display display = ErlideUIPlugin.getStandardDisplay();
    if (display.isDisposed()) {
      return;
    }

    String name = null;
    try {
      name = target.getName();
    } catch (final DebugException e) {
      name = ""; // never happens, ErlangDebugTarget doesn't throw this...
    }
    final String vmName = name;
    final ILaunchConfiguration config = target.getLaunch().getLaunchConfiguration();
    final String launchName = config != null ? config.getName() : "<unknown>";
    final IStatus status =
        new Status(IStatus.ERROR, ErlangCore.PLUGIN_ID, IStatus.ERROR, "Can't replace code", null);
    final String title = "Code Replace Failed";
    final String message =
        MessageFormat.format(
            "Some code changes cannot be replaced when being debugged.",
            new Object[] {vmName, launchName});
    display.asyncExec(
        new Runnable() {
          @Override
          public void run() {
            if (display.isDisposed()) {
              return;
            }
            final Shell shell = ErlideUIPlugin.getActiveWorkbenchShell();
            final HotCodeReplaceErrorDialog dialog =
                new HotCodeReplaceErrorDialog(shell, title, message, status, target);
            dialog.setBlockOnOpen(false);
            dialog.open();
          }
        });
  }
Exemplo n.º 2
0
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.ui.part.IShowInSource#getShowInContext()
  */
 public ShowInContext getShowInContext() {
   IProcess process = getProcess();
   if (process == null) {
     return null;
   }
   IDebugTarget target = (IDebugTarget) process.getAdapter(IDebugTarget.class);
   ISelection selection = null;
   if (target == null) {
     selection =
         new TreeSelection(
             new TreePath(
                 new Object[] {
                   DebugPlugin.getDefault().getLaunchManager(), process.getLaunch(), process
                 }));
   } else {
     selection =
         new TreeSelection(
             new TreePath(
                 new Object[] {
                   DebugPlugin.getDefault().getLaunchManager(), target.getLaunch(), target
                 }));
   }
   return new ShowInContext(null, selection);
 }