public void setSelected(AnActionEvent e, boolean state) { T change = ObjectUtils.tryCast(e.getData(VcsDataKeys.CURRENT_CHANGE), myClass); if (change == null) return; if (state) { myViewer.includeChange(change); } else { myViewer.excludeChange(change); } }
@Override public void actionPerformed(AnActionEvent e) { final Project project = e.getData(PlatformDataKeys.PROJECT); if (project == null) return; Runnable searchEverywhere = mySearchEverywhereRunnable; mySearchEverywhereRunnable = null; hideHints(); if (searchEverywhere != null) { searchEverywhere.run(); return; } final RelativePoint popupPosition = JBPopupFactory.getInstance().guessBestPopupLocation(e.getDataContext()); PsiDocumentManager.getInstance(project).commitAllDocuments(); FeatureUsageTracker.getInstance().triggerFeatureUsed("navigation.goto.usages"); UsageTarget[] usageTargets = e.getData(UsageView.USAGE_TARGETS_KEY); final Editor editor = e.getData(PlatformDataKeys.EDITOR); if (usageTargets == null) { chooseAmbiguousTargetAndPerform( project, editor, new PsiElementProcessor<PsiElement>() { @Override public boolean execute(@NotNull final PsiElement element) { startFindUsages(element, popupPosition, editor, USAGES_PAGE_SIZE); return false; } }); } else { PsiElement element = ((PsiElementUsageTarget) usageTargets[0]).getElement(); if (element != null) { startFindUsages(element, popupPosition, editor, USAGES_PAGE_SIZE); } } }
public void actionPerformed(AnActionEvent e) { Change change = e.getData(VcsDataKeys.CURRENT_CHANGE); askAndMove(myProject, Collections.singletonList(change), null); }
@Override protected boolean isEnabled(AnActionEvent e) { Change change = e.getData(VcsDataKeys.CURRENT_CHANGE); if (change == null) return false; return super.isEnabled(e); }
public boolean isSelected(AnActionEvent e) { T change = ObjectUtils.tryCast(e.getData(VcsDataKeys.CURRENT_CHANGE), myClass); if (change == null) return false; return myViewer.isIncluded(change); }
@Override public void actionPerformed(AnActionEvent e) { Project project = e.getData(PlatformDataKeys.PROJECT); if (project == null) { LOGGER.error("actionPerformed (genVCs): no project for " + e); return; } VirtualFile resolveFile = getRESOLVEFileFromEvent(e); LOGGER.info("prove actionPerformed " + (resolveFile == null ? "NONE" : resolveFile)); if (resolveFile == null) return; String title = "RESOLVE Prove"; boolean canBeCancelled = true; commitDoc(project, resolveFile); Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor(); if (editor == null) return; RunRESOLVEOnLanguageFile gen = new RunRESOLVEOnLanguageFile(resolveFile, project, title); MyProverListener pl = new MyProverListener(); VCOutputFile vco = generateVCs(resolveFile, editor, project); // give each action an instance of the prover listener and make Update() print the result as it // comes back produce if (vco == null) return; RESOLVEPluginController controller = RESOLVEPluginController.getInstance(project); VerifierPanel verifierPanel = controller.getVerifierPanel(); verifierPanel.createVerifierView2( vco.getFinalVCs(), pl); // TODO: maybe make this take in a list of VCs addVCGutterIcons(vco, editor, project, pl); controller.getVerifierWindow().show(null); // runProver List<String> args = new ArrayList<>(); args.add(resolveFile.getPath()); args.add("-lib"); args.add(RunRESOLVEOnLanguageFile.getContentRoot(project, resolveFile).getPath()); args.add("-prove"); RESOLVECompiler compiler = new RESOLVECompiler(args.toArray(new String[args.size()])); compiler.addProverListener(pl); // TODO: Instead of this being anon, make a separate static class and add an error listener to // 'compiler' that (make it accessible // right here though so the UI part below can stop and update remaining (unproved) vcs if the // compiler does indeed suffer some // catastrophic failure: npe, etc. Task.Backgroundable proverTask = new Task.Backgroundable(project, "Proving") { @Override public void run(@NotNull final ProgressIndicator progressIndicator) { compiler.processCommandLineTargets(); } }; ProgressManager.getInstance().run(proverTask); // TODO: Different status icons for different proof results. running = true; Task.Backgroundable task = new Task.Backgroundable(project, "Updating Presentation") { @Override public void run(@NotNull final ProgressIndicator progressIndicator) { Map<String, Boolean> processed = new HashMap<>(); for (VC vc : vco.getFinalVCs()) { processed.put(vc.getName(), false); } while (pl.vcIsProved.size() != vco.getFinalVCs().size()) { // if (proverTask.getNotificationInfo().)//TODO: Put something here that breaks out of // this if the compiler crashes.. for (VC vc : vco.getFinalVCs()) { if (pl.vcIsProved.containsKey(vc.getName()) && !processed.get(vc.getName())) { processed.put(vc.getName(), true); long dur = pl.vcMetrics.get(vc.getName()).getProofDuration(); ConditionCollapsiblePanel section = verifierPanel.vcSelectorPanel.vcTabs.get(vc.getNumber()); section.changeToFinalState( pl.vcIsProved.get(vc.getName()) ? ConditionCollapsiblePanel.State.PROVED : ConditionCollapsiblePanel.State.NOT_PROVED, dur); } } } running = false; } }; ProgressManager.getInstance().run(task); }