@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 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 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); }