@Override
 public void actionPerformed(AnActionEvent e) {
   if (e.getProject() == null) return;
   RESOLVEPluginController controller = RESOLVEPluginController.getInstance(e.getProject());
   controller.getVerifierWindow().show(null); // open the verifier window
   VerificationConditionSelectorPanel vcselector =
       controller.getVerifierPanel().getVcSelectorPanel();
   if (vcselector == null) return;
   vcselector.vcTabs.get(Integer.parseInt(vcNum));
   VerifierPanel verifierPanel = controller.getVerifierPanel();
   if (verifierPanel.getVcSelectorPanel() == null) return;
   VerificationConditionSelectorPanel selector = verifierPanel.getVcSelectorPanel();
   ConditionCollapsiblePanel details = selector.vcTabs.get(Integer.parseInt(vcNum));
   details.setExpanded(true);
 }
  @Override
  public void update(AnActionEvent e) {
    Presentation presentation = e.getPresentation();

    Project project = e.getProject();
    if (project == null) {
      presentation.setEnabled(false);
      return;
    }

    final DataContext dataContext = e.getDataContext();
    Editor editor = getEditor(dataContext, project, true);
    if (editor == null) {
      presentation.setEnabled(false);
      return;
    }

    final PsiFile file = PsiUtilBase.getPsiFileInEditor(editor, project);
    if (file == null) {
      presentation.setEnabled(false);
      return;
    }

    update(presentation, project, editor, file, dataContext, e.getPlace());
  }
 @Override
 public final void update(final AnActionEvent e) {
   final Presentation presentation = e.getPresentation();
   final Project project = e.getProject();
   if (project == null) return;
   presentation.setEnabled(isEnabled());
   presentation.setText(getCurrentScopeType());
 }
 @Override
 public void beforeActionPerformedUpdate(@NotNull AnActionEvent e) {
   Project project = e.getProject();
   if (project != null) {
     getEditor(e.getDataContext(), project, false); // ensure documents are committed
   }
   super.beforeActionPerformedUpdate(e);
 }
 @Override
 public void actionPerformed(AnActionEvent e) {
   Project project = e.getProject();
   if (project != null) {
     Editor editor = getEditor(e.getDataContext(), project, false);
     actionPerformedImpl(project, editor);
   }
 }
 @Override
 public void setSelected(AnActionEvent e, boolean watch) {
   myWatchesReturnValues = watch;
   DebuggerSettings.getInstance().WATCH_RETURN_VALUES = watch;
   DebugProcessImpl process = getCurrentDebugProcess(e.getProject());
   if (process != null) {
     process.setWatchMethodReturnValuesEnabled(watch);
   }
 }
 @Override
 public void update(@NotNull final AnActionEvent e) {
   super.update(e);
   final Presentation presentation = e.getPresentation();
   DebugProcessImpl process = getCurrentDebugProcess(e.getProject());
   if (process == null || process.canGetMethodReturnValue()) {
     presentation.setEnabled(true);
     presentation.setText(myText);
   } else {
     presentation.setEnabled(false);
     presentation.setText(myTextUnavailable);
   }
 }
Пример #8
0
    @Override
    public void actionPerformed(AnActionEvent e) {
      final DataContext dataContext = e.getDataContext();
      Project project = e.getProject();
      FavoritesTreeNodeDescriptor[] roots =
          FavoritesTreeViewPanel.CONTEXT_FAVORITES_ROOTS_DATA_KEY.getData(dataContext);
      String listName = FavoritesTreeViewPanel.FAVORITES_LIST_NAME_DATA_KEY.getData(dataContext);

      String newName = AddNewFavoritesListAction.doAddNewFavoritesList(project);
      if (newName != null) {
        new SendToFavoritesAction(newName)
            .doSend(FavoritesManager.getInstance(project), roots, listName);
      }
    }
  @Override
  public void update(AnActionEvent e) {
    Presentation presentation = e.getPresentation();

    if (ActionPlaces.PROJECT_VIEW_POPUP.equals(e.getPlace())
        || ActionPlaces.COMMANDER_POPUP.equals(e.getPlace())) {
      presentation.setText(IdeBundle.message("action.delete.ellipsis"));
    } else {
      presentation.setText(IdeBundle.message("action.delete"));
    }

    if (e.getProject() == null) {
      presentation.setEnabled(false);
      return;
    }

    DataContext dataContext = e.getDataContext();
    DeleteProvider provider = getDeleteProvider(dataContext);
    if (e.getInputEvent() instanceof KeyEvent) {
      KeyEvent keyEvent = (KeyEvent) e.getInputEvent();
      Object component = PlatformDataKeys.CONTEXT_COMPONENT.getData(dataContext);
      if (component instanceof JTextComponent) provider = null; // Do not override text deletion
      if (keyEvent.getKeyCode() == KeyEvent.VK_BACK_SPACE) {
        // Do not override text deletion in speed search
        if (component instanceof JComponent) {
          SpeedSearchSupply searchSupply = SpeedSearchSupply.getSupply((JComponent) component);
          if (searchSupply != null) provider = null;
        }

        String activeSpeedSearchFilter =
            SpeedSearchSupply.SPEED_SEARCH_CURRENT_QUERY.getData(dataContext);
        if (!StringUtil.isEmpty(activeSpeedSearchFilter)) {
          provider = null;
        }
      }
    }
    if (provider instanceof TitledHandler) {
      presentation.setText(((TitledHandler) provider).getActionTitle());
    }
    boolean canDelete = provider != null && provider.canDeleteElement(dataContext);
    if (ActionPlaces.isPopupPlace(e.getPlace())) {
      presentation.setVisible(canDelete);
    } else {
      presentation.setEnabled(canDelete);
    }
  }
 public void actionPerformed(AnActionEvent e) {
   new ConfigureCvsGlobalSettingsDialog(e.getProject()).show();
 }
  @Override
  public void actionPerformed(@NotNull AnActionEvent e) {
    final Project project = e.getProject();
    if (project == null) return;

    if (myPopup != null && myPopup.isVisible()) return;

    final JBList list = new JBList(buildModel(project));

    EditBookmarkDescriptionAction editDescriptionAction =
        new EditBookmarkDescriptionAction(project, list);
    DefaultActionGroup actions = new DefaultActionGroup();
    actions.add(editDescriptionAction);
    actions.add(new DeleteBookmarkAction(project, list));
    actions.add(new ToggleSortBookmarksAction());
    actions.add(new MoveBookmarkUpAction(project, list));
    actions.add(new MoveBookmarkDownAction(project, list));

    myPopup =
        new MasterDetailPopupBuilder(project)
            .setList(list)
            .setDelegate(this)
            .setDetailView(new DetailViewImpl(project))
            .setDimensionServiceKey("bookmarks")
            .setAddDetailViewToEast(true)
            .setActionsGroup(actions)
            .setPopupTuner(
                new Consumer<PopupChooserBuilder>() {
                  @Override
                  public void consume(PopupChooserBuilder builder) {
                    builder.setCloseOnEnter(false).setCancelOnClickOutside(false);
                  }
                })
            .setDoneRunnable(
                new Runnable() {
                  @Override
                  public void run() {
                    myPopup.cancel();
                  }
                })
            .createMasterDetailPopup();

    new AnAction() {
      @Override
      public void actionPerformed(AnActionEvent e) {
        @SuppressWarnings("deprecation")
        Object[] values = list.getSelectedValues();
        for (Object item : values) {
          if (item instanceof BookmarkItem) {
            itemChosen((BookmarkItem) item, project, myPopup, true);
          }
        }
      }
    }.registerCustomShortcutSet(CommonShortcuts.getEditSource(), list);

    editDescriptionAction.setPopup(myPopup);
    myPopup.showCenteredInCurrentWindow(project);

    list.getEmptyText().setText("No Bookmarks");
    list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    project
        .getMessageBus()
        .connect(myPopup)
        .subscribe(
            BookmarksListener.TOPIC,
            new BookmarksListener() {
              @Override
              public void bookmarkAdded(@NotNull Bookmark b) {}

              @Override
              public void bookmarkRemoved(@NotNull Bookmark b) {}

              @Override
              public void bookmarkChanged(@NotNull Bookmark b) {}

              @Override
              public void bookmarksOrderChanged() {
                doUpdate();
              }

              private void doUpdate() {
                TreeSet selectedValues = new TreeSet(Arrays.asList(list.getSelectedValues()));
                DefaultListModel listModel = buildModel(project);
                list.setModel(listModel);
                ListSelectionModel selectionModel = list.getSelectionModel();
                for (int i = 0; i < listModel.getSize(); i++) {
                  if (selectedValues.contains(listModel.get(i))) {
                    selectionModel.addSelectionInterval(i, i);
                  }
                }
              }
            });
  }
 @Override
 public void update(@NotNull AnActionEvent e) {
   e.getPresentation().setEnabled(e.getProject() != null);
 }
 @Override
 public void setSelected(AnActionEvent e, boolean enabled) {
   myAutoModeEnabled = enabled;
   DebuggerSettings.getInstance().AUTO_VARIABLES_MODE = enabled;
   XDebuggerUtilImpl.rebuildAllSessionsViews(e.getProject());
 }
Пример #14
0
  @Override
  public void actionPerformed(final AnActionEvent e) {
    final PsiFile psiFile = LangDataKeys.PSI_FILE.getData(e.getDataContext());
    if (!(psiFile instanceof DartFile)) {
      return;
    }
    final VirtualFile virtualFile = DartResolveUtil.getRealVirtualFile(psiFile);
    if (virtualFile == null) {
      return;
    }
    final DartSettings settings = DartSettingsUtil.getSettings();
    final VirtualFile dart2js = settings.getDart2JS();
    if (dart2js == null) {
      Messages.showOkCancelDialog(
          e.getProject(),
          DartBundle.message("dart.sdk.bad.dart2js.path", settings.getDart2JSUrl()),
          DartBundle.message("dart.warning"),
          icons.DartIcons.Dart_16);
      return;
    }

    final String jsFilePath = virtualFile.getPath() + ".js";
    final Dart2JSSettingsDialog dialog =
        new Dart2JSSettingsDialog(psiFile.getProject(), jsFilePath);
    dialog.show();
    if (!dialog.isOK()) {
      return;
    }

    new Task.Backgroundable(psiFile.getProject(), "dart2js", true) {
      public void run(@NotNull ProgressIndicator indicator) {
        indicator.setText("Running dart2js...");
        indicator.setFraction(0.0);
        final GeneralCommandLine command = new GeneralCommandLine();
        command.setExePath(dart2js.getPath());
        if (dialog.isCheckedMode()) {
          command.addParameter("--checked");
        }
        if (dialog.isMinify()) {
          command.addParameter("--minify");
        }
        command.addParameter("--out=" + dialog.getOutputPath());
        command.addParameter(virtualFile.getPath());

        // save on disk
        ApplicationManager.getApplication()
            .invokeAndWait(
                new Runnable() {
                  @Override
                  public void run() {
                    FileDocumentManager.getInstance().saveAllDocuments();
                  }
                },
                ModalityState.defaultModalityState());

        try {
          final String output = ScriptRunnerUtil.getProcessOutput(command);
          ProgressManager.progress("");
          LOG.debug(output);
          boolean error = !output.isEmpty();
          if (error) {
            Notifications.Bus.notify(
                new Notification(
                    e.getPresentation().getText(),
                    DartBundle.message("dart2js.title"),
                    DartBundle.message("dart2js.js.file.creation.error", output),
                    NotificationType.ERROR));
            return;
          }
          Notifications.Bus.notify(
              new Notification(
                  e.getPresentation().getText(),
                  DartBundle.message("dart2js.title"),
                  DartBundle.message("dart2js.js.file.created", jsFilePath),
                  NotificationType.INFORMATION));

          final String parentDir = VfsUtil.getParentDir(dialog.getOutputPath());
          assert parentDir != null;
          final VirtualFile outputParentVirtualFile =
              VirtualFileManager.getInstance().findFileByUrl(VfsUtilCore.pathToUrl(parentDir));
          if (outputParentVirtualFile != null) {
            outputParentVirtualFile.refresh(true, false);
          }
        } catch (ExecutionException ex) {
          LOG.error(ex);
          Notifications.Bus.notify(
              new Notification(
                  e.getPresentation().getText(),
                  DartBundle.message("dart2js.title"),
                  DartBundle.message("dart2js.js.file.creation.error", ex.getMessage()),
                  NotificationType.ERROR));
        }
        indicator.setFraction(1.0);
      }
    }.setCancelText("Stop").queue();
  }