コード例 #1
0
 @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);
 }
コード例 #2
0
 @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());
 }
コード例 #3
0
  @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);
    }
  }
コード例 #4
0
 public void actionPerformed(AnActionEvent e) {
   new ConfigureCvsGlobalSettingsDialog(e.getProject()).show();
 }
コード例 #5
0
  @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);
                  }
                }
              }
            });
  }
コード例 #6
0
 @Override
 public void update(@NotNull AnActionEvent e) {
   e.getPresentation().setEnabled(e.getProject() != null);
 }