Beispiel #1
0
  /* (non-Javadoc)
   * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
   */
  public void run(IAction action) {
    String natureId = ScriptDebugManager.getInstance().getNatureByDebugModel(getDebugModelId());
    fToolkit = DLTKUILanguageManager.getLanguageToolkit(natureId);
    IDialogSettings settings = getDialogSettings();
    AddExceptionTypeDialogExtension ext =
        new AddExceptionTypeDialogExtension(
            null, settings.getBoolean(CAUGHT_CHECKED), settings.getBoolean(UNCAUGHT_CHECKED));

    TypeSelectionDialog2 dialog =
        new TypeSelectionDialog2(
            DLTKUIPlugin.getActiveWorkbenchShell(),
            false,
            PlatformUI.getWorkbench().getProgressService(),
            SearchEngine.createWorkspaceScope(fToolkit.getCoreToolkit()),
            IDLTKSearchConstants.TYPE,
            ext,
            fToolkit);

    dialog.setMessage(Messages.AddExceptionAction_search);
    dialog.setTitle(Messages.AddExceptionAction_addExceptionBreakpoint);
    if (dialog.open() == IDialogConstants.OK_ID) {
      Object[] types = dialog.getResult();
      if (types != null && types.length > 0) {
        boolean caught = ext.shouldHandleCaughtExceptions();
        boolean uncaught = ext.shouldHandleUncaughtExceptions();
        Object[] results = dialog.getResult();
        if (results != null && results.length > 0) {
          try {
            createBreakpoint(caught, uncaught, (IType) results[0]);
            settings.put(CAUGHT_CHECKED, caught);
            settings.put(UNCAUGHT_CHECKED, uncaught);
          } catch (CoreException e) {
            DLTKDebugUIPlugin.errorDialog(
                Messages.AddExceptionAction_unableToCreateBreakpoint, e.getStatus());
          }
        }
      }
    }
  }