@Override
 public void runClasspathPanelAction(Runnable action) {
   try {
     disableModelUpdate();
     action.run();
   } finally {
     enableModelUpdate();
     myEntryTable.requestFocus();
   }
 }
  @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);
      }
    }
  }
  @Nullable
  private void getRevisionsList(
      final FilePath file,
      final Ref<Boolean> supports15Ref,
      final Consumer<VcsFileRevision> consumer)
      throws VcsException {
    final VcsException[] exception = new VcsException[1];

    Runnable command =
        new Runnable() {
          public void run() {
            final ProgressIndicator indicator =
                ProgressManager.getInstance().getProgressIndicator();
            if (indicator != null) {
              indicator.setText(
                  SvnBundle.message("progress.text2.collecting.history", file.getName()));
            }
            try {
              if (!file.isNonLocal()) {
                collectLogEntries(indicator, file, exception, consumer, supports15Ref);
              } else {
                collectLogEntriesForRepository(indicator, file, consumer, supports15Ref);
              }
            } catch (SVNCancelException ex) {
              throw new ProcessCanceledException(ex);
            } catch (SVNException e) {
              exception[0] = new VcsException(e);
            } catch (VcsException e) {
              exception[0] = e;
            }
          }
        };

    command.run();

    if (exception[0] != null) {
      throw exception[0];
    }
  }
  @Override
  @NotNull
  public VirtualFile[] choose(
      @Nullable final Project project, @NotNull final VirtualFile... toSelect) {
    init();
    if ((myProject == null) && (project != null)) {
      myProject = project;
    }
    if (toSelect.length == 1) {
      restoreSelection(toSelect[0]);
    } else if (toSelect.length == 0) {
      restoreSelection(null); // select last opened file
    } else {
      selectInTree(toSelect, true);
    }

    Runnable showRunnable =
        new Runnable() {
          @Override
          public void run() {
            show();
          }
        };
    // file chooser calls VFS refresh which might lead to rootsChanged in any open project and dumb
    // mode that the clients don't expect.
    // so if reindexing has to happen, let it happen under a modal progress and be finished before
    // the file chooser returns.
    // this hack should be gone if file chooser doesn't use VFS
    // (https://youtrack.jetbrains.com/issue/IDEA-101218)
    for (final Project eachProject : ProjectManager.getInstance().getOpenProjects()) {
      showRunnable = allowModalDumbModeInside(showRunnable, eachProject);
    }
    showRunnable.run();

    return myChosenFiles;
  }
Пример #5
0
  @Override
  @SuppressWarnings("SSBasedInspection")
  protected void dispose() {
    LOG.assertTrue(
        EventQueue.isDispatchThread(), "Access is allowed from event dispatch thread only");
    for (Runnable runnable : myDisposeActions) {
      runnable.run();
    }
    myDisposeActions.clear();
    final JRootPane root = myDialog.getRootPane();

    Runnable disposer =
        new Runnable() {
          @Override
          public void run() {
            myDialog.dispose();
            myProject = null;

            SwingUtilities.invokeLater(
                new Runnable() {
                  @Override
                  public void run() {
                    if (myDialog != null && root != null) {
                      myDialog.remove(root);
                    }
                  }
                });
          }
        };

    if (EventQueue.isDispatchThread()) {
      disposer.run();
    } else {
      SwingUtilities.invokeLater(disposer);
    }
  }
 public void apply() throws ConfigurationException {
   if (!myModifiedModificators.isEmpty()) {
     mySdkSettingsWereModified.run();
   }
   for (SdkModificator modificator : myModifiedModificators) {
     /* This should always be true barring bug elsewhere, log error on else? */
     if (modificator.isWritable()) {
       modificator.commitChanges();
     }
   }
   myModificators.clear();
   myModifiedModificators.clear();
   mySdkListChanged = false;
   final Sdk sdk = getSelectedSdk();
   myShowMoreCallback.consume(sdk);
   PyPackageManagers.getInstance().clearCache(sdk);
   Disposer.dispose(getDisposable());
 }
 public void setSelected(AnActionEvent event, boolean flag) {
   DependencyUISettings.getInstance().UI_FILTER_LEGALS = flag;
   UIUtil.setEnabled(myLegendPanel, !flag, true);
   myUpdate.run();
 }