當前位置: 首頁>>代碼示例>>Java>>正文


Java Application.executeOnPooledThread方法代碼示例

本文整理匯總了Java中com.intellij.openapi.application.Application.executeOnPooledThread方法的典型用法代碼示例。如果您正苦於以下問題:Java Application.executeOnPooledThread方法的具體用法?Java Application.executeOnPooledThread怎麽用?Java Application.executeOnPooledThread使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.application.Application的用法示例。


在下文中一共展示了Application.executeOnPooledThread方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: run

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
public static void run(final Project project, final Runnable action) {
  final ProjectLevelVcsManager plVcsManager = ProjectLevelVcsManager.getInstance(project);
  plVcsManager.startBackgroundVcsOperation();
  try {
    action.run();
  } finally {
    final Application application = ApplicationManager.getApplication();
    if (application.isDispatchThread()) {
      application.executeOnPooledThread(new Runnable() {
        public void run() {
          plVcsManager.stopBackgroundVcsOperation();
        }
      });
    } else {
      plVcsManager.stopBackgroundVcsOperation();
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:ExclusiveBackgroundVcsAction.java

示例2: projectClosed

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
@Override
public void projectClosed() {
  final Application app = ApplicationManager.getApplication();
  Runnable cleanupInspectionProfilesRunnable = new Runnable() {
    @Override
    public void run() {
      for (InspectionProfileWrapper wrapper : myName2Profile.values()) {
        wrapper.cleanup(myProject);
      }
      fireProfilesShutdown();
    }
  };
  if (app.isUnitTestMode() || app.isHeadlessEnvironment()) {
    cleanupInspectionProfilesRunnable.run();
  }
  else {
    app.executeOnPooledThread(cleanupInspectionProfilesRunnable);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:20,代碼來源:InspectionProjectProfileManagerImpl.java

示例3: runActivity

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
@Override
public void runActivity(@NotNull final Project project) {
  final Application application = ApplicationManager.getApplication();
  if (application.isUnitTestMode()) {
    return;
  }
  if (checkNeeded()) {
    application.executeOnPooledThread(new Runnable() {
      @Override
      public void run() {
        final List<CourseInfo> courses = EduStepicConnector.getCourses();
        StudyProjectGenerator.flushCache(courses);
      }
    });
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:StudyCoursesUpdater.java

示例4: execute

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
protected synchronized void execute(GeneralCommandLine commandLine) throws AuthenticationException {
  try {
    commandLine.withParentEnvironmentType(ParentEnvironmentType.CONSOLE);
    myProcess = commandLine.createProcess();

    myErrThread = new ReadProcessThread(
      new BufferedReader(new InputStreamReader(myProcess.getErrorStream(), EncodingManager.getInstance().getDefaultCharset()))) {
      protected void textAvailable(String s) {
        myErrorText.append(s);
        myErrorRegistry.registerError(s);
        myContainsError = true;
      }
    };
    final Application application = ApplicationManager.getApplication();
    myStdErrFuture = application.executeOnPooledThread(myErrThread);

    myInputStream = myProcess.getInputStream();
    myOutputStream = myProcess.getOutputStream();

    waitForProcess(application);
  }
  catch (Exception e) {
    closeInternal();
    throw new AuthenticationException(e.getLocalizedMessage(), e);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:ConnectionOnProcess.java

示例5: close

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
public static void close(final Process process) {
  final Semaphore outerSemaphore = new Semaphore();
  outerSemaphore.down();

  final Application application = ApplicationManager.getApplication();
  application.executeOnPooledThread(new Runnable() {
    public void run() {
      try {
        final Semaphore semaphore = new Semaphore();
        semaphore.down();

        final Runnable closeRunnable = new Runnable() {
          public void run() {
            try {
              closeProcessImpl(process);
            }
            finally {
              semaphore.up();
            }
          }
        };

        final Future<?> innerFuture = application.executeOnPooledThread(closeRunnable);
        semaphore.waitFor(ourAsynchronousWaitTimeout);
        if ( ! (innerFuture.isDone() || innerFuture.isCancelled())) {
          innerFuture.cancel(true); // will call interrupt()
        }
      }
      finally {
        outerSemaphore.up();
      }
    }
  });

  // just wait
  outerSemaphore.waitFor(ourSynchronousWaitTimeout);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:38,代碼來源:ProcessCloseUtil.java

示例6: processChangeLists

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
public void processChangeLists(final List<LocalChangeList> lists) {
  final ProjectLevelVcsManager plVcsManager = ProjectLevelVcsManager.getInstanceChecked(myProject);
  plVcsManager.startBackgroundVcsOperation();
  try {
    for (LocalChangeList list : lists) {
      if (!list.isDefault()) {
        final Collection<Change> changes = list.getChanges();
        for (Change change : changes) {
          correctListForRevision(plVcsManager, change.getBeforeRevision(), list.getName());
          correctListForRevision(plVcsManager, change.getAfterRevision(), list.getName());
        }
      }
    }
  }
  finally {
    final Application appManager = ApplicationManager.getApplication();
    if (appManager.isDispatchThread()) {
      appManager.executeOnPooledThread(new Runnable() {
        @Override
        public void run() {
          plVcsManager.stopBackgroundVcsOperation();
        }
      });
    }
    else {
      plVcsManager.stopBackgroundVcsOperation();
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:30,代碼來源:SvnVcs.java

示例7: startProcessing

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
private boolean startProcessing() {
  LOG.assertTrue(Thread.holdsLock(myQueue));

  if (isProcessing || !myStarted) {
    return false;
  }
  isProcessing = true;
  final T item = myQueue.removeFirst();
  final Runnable runnable = new Runnable() {
    @Override
    public void run() {
      if (myDeathCondition.value(null)) return;
      runSafely(new Runnable() {
        @Override
        public void run() {
          myProcessor.consume(item, myContinuationContext);
        }
      });
    }
  };
  final Application application = ApplicationManager.getApplication();
  if (myThreadToUse == ThreadToUse.AWT) {
    final ModalityState state = myModalityState.remove(new MyOverrideEquals(item));
    if (state != null) {
      application.invokeLater(runnable, state);
    }
    else {
      application.invokeLater(runnable);
    }
  }
  else {
    application.executeOnPooledThread(runnable);
  }
  return true;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:36,代碼來源:QueueProcessor.java

示例8: executeOnPooledThread

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
protected static Future<?> executeOnPooledThread(Runnable task) {
  final Application application = ApplicationManager.getApplication();

  if (application != null) {
    return application.executeOnPooledThread(task);
  }

  return BaseOSProcessHandler.ExecutorServiceHolder.submit(task);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:BaseRemoteProcessHandler.java

示例9: initModel

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
public void initModel() {
  setDownloadStatus(true);
  final Application application = ApplicationManager.getApplication();
  application.executeOnPooledThread(new Runnable() {
    @Override
    public void run() {
      try {
        myPackagesModel = new PackagesModel(myController.getAllPackages());

        application.invokeLater(new Runnable() {
          @Override
          public void run() {
            myPackages.setModel(myPackagesModel);
            ((MyPackageFilter)myFilter).filter();
            doSelectPackage(mySelectedPackageName);
            setDownloadStatus(false);
          }
        }, ModalityState.any());
      }
      catch (final IOException e) {
        application.invokeLater(new Runnable() {
          @Override
          public void run() {
            Messages.showErrorDialog(myMainPanel, "Error loading package list:" + e.getMessage(), "Packages");
            setDownloadStatus(false);
          }
        }, ModalityState.any());
      }
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:32,代碼來源:ManagePackagesDialog.java

示例10: refreshLatestVersions

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
private void refreshLatestVersions(@NotNull final PackageManagementService packageManagementService) {
  final Application application = ApplicationManager.getApplication();
  application.executeOnPooledThread(new Runnable() {
    @Override
    public void run() {
      if (packageManagementService == myPackageManagementService) {
        try {
          List<RepoPackage> packages = packageManagementService.reloadAllPackages();
          final Map<String, RepoPackage> packageMap = buildNameToPackageMap(packages);
          application.invokeLater(new Runnable() {
            @Override
            public void run() {
              for (int i = 0; i != myPackagesTableModel.getRowCount(); ++i) {
                final InstalledPackage pyPackage = (InstalledPackage)myPackagesTableModel.getValueAt(i, 0);
                final RepoPackage repoPackage = packageMap.get(pyPackage.getName());
                myPackagesTableModel.setValueAt(repoPackage == null ? null : repoPackage.getLatestVersion(), i, 2);
              }
              myPackagesTable.setPaintBusy(false);
            }
          }, ModalityState.stateForComponent(myPackagesTable));
        }
        catch (IOException ignored) {
          myPackagesTable.setPaintBusy(false);
        }
      }
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:29,代碼來源:InstalledPackagesPanel.java

示例11: updateSdkLanguageLevel

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
private void updateSdkLanguageLevel(@NotNull final Project project, final Sdk sdk) {
  final LanguageLevel languageLevel = PythonSdkType.getLanguageLevelForSdk(sdk);
  final VirtualFile[] files = sdk.getRootProvider().getFiles(OrderRootType.CLASSES);
  final Application application = ApplicationManager.getApplication();
  PyUtil.invalidateLanguageLevelCache(project);
  application.executeOnPooledThread(new Runnable() {
    @Override
    public void run() {
      application.runReadAction(new Runnable() {
        @Override
        public void run() {
          if (project.isDisposed()) {
            return;
          }
          for (VirtualFile file : files) {
            if (file.isValid()) {
              VirtualFile parent = file.getParent();
              boolean suppressSizeLimit = false;
              if (parent != null && parent.getName().equals(PythonSdkType.SKELETON_DIR_NAME)) {
                suppressSizeLimit = true;
              }
              markRecursively(project, file, languageLevel, suppressSizeLimit);
            }
          }
        }
      });
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:30,代碼來源:PythonLanguageLevelPusher.java

示例12: runActivity

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
@Override
public void runActivity(@NotNull final Project project) {
  final Application application = ApplicationManager.getApplication();
  if (application.isUnitTestMode()) {
    return;
  }
  final PyPackageService service = PyPackageService.getInstance();
  if (checkNeeded(project, service)) {
    application.executeOnPooledThread(new Runnable() {
      @Override
      public void run() {
        try {
          PyPIPackageUtil.INSTANCE.updatePyPICache(service);
          service.LAST_TIME_CHECKED = System.currentTimeMillis();
        }
        catch (IOException e) {
          LOG.warn(e.getMessage());
        }
      }
    });
  }
  if (checkCondaUpdateNeeded(project)) {
    application.executeOnPooledThread(new Runnable() {
      @Override
      public void run() {
        PyCondaPackageService.getInstance().updatePackagesCache();
      }
    });
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:31,代碼來源:PyPackagesUpdater.java

示例13: ask

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
@Override
protected boolean ask(final AuthenticationRequest obj, String description) {
  if (myVerificationInProgress) {
    return showAlreadyChecking();
  }
  myVerificationInProgress = true;

  final Ref<Boolean> resultRef = new Ref<Boolean>();

  final Runnable checker = new Runnable() {
    @Override
    public void run() {
      try {
        final boolean result =
          interactiveValidation(obj.myProject, obj.getUrl(), obj.getRealm(), obj.getKind());
        log("ask result for: " + obj.getUrl() + " is: " + result);
        resultRef.set(result);
        if (result) {
          onStateChangedToSuccess(obj);
        }
      }
      finally {
        myVerificationInProgress = false;
      }
    }
  };
  final Application application = ApplicationManager.getApplication();
  // also do not show auth if thread does not have progress indicator
  if (application.isReadAccessAllowed() || !ProgressManager.getInstance().hasProgressIndicator()) {
    application.executeOnPooledThread(checker);
  }
  else {
    checker.run();
    return resultRef.get();
  }
  return false;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:38,代碼來源:SvnAuthenticationNotifier.java

示例14: reportNoRoots

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
public void reportNoRoots(final List<VirtualFile> result) {
  synchronized (myLock) {
    if (myInvocationCounter >= ourInvocationMax) return;
    ++ myCounter;
    -- myDownStartCounter;
    if ((myCounter > ourFrequency) || (myDownStartCounter >= 0)) {
      myCounter = 0;
      ++ myInvocationCounter;
      final Application application = ApplicationManager.getApplication();
      application.executeOnPooledThread(new Runnable() {
        public void run() {
          final List<VirtualFile> suspicious = new ArrayList<VirtualFile>();
          for (VirtualFile vf : result) {
            if (SvnUtil.seemsLikeVersionedDir(vf)) {
              suspicious.add(vf);
            }
          }
          if (! suspicious.isEmpty()) {
            final String message = (suspicious.size() == 1) ?
                                   "Root '" + suspicious.get(0).getPresentableName() + "' is likely to be of unsupported Subversion format" :
                                   "Some roots are likely to be of unsupported Subversion format";
            application.invokeLater(new Runnable() {
              public void run() {
                new VcsBalloonProblemNotifier(myProject, message, MessageType.WARNING).run();
              }
            }, ModalityState.NON_MODAL, new Condition() {
              @Override
              public boolean value(Object o) {
                return (! myProject.isOpen()) || myProject.isDisposed();
              }
            });
          }
        }
      });
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:38,代碼來源:SvnCompatibilityChecker.java

示例15: applySettings

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
public void applySettings() {
  if (! myUpdating.get()) myUpdating.set(true);
  final JBLoadingPanel loadingPanel = getLoadingPanel();
  if (!loadingPanel.isLoading()) {
    loadingPanel.startLoading();
    if (myUpdater == null) {
      myUpdater = new Updater(loadingPanel, 100);
      myUpdater.start();
    }
  }
  final Application app = ApplicationManager.getApplication();
  app.executeOnPooledThread(new Runnable() {
    public void run() {
      if (myDisposed) return;
      myTree.updateVisibility(mySettings);
      final ArrayList<DirDiffElementImpl> elements = new ArrayList<DirDiffElementImpl>();
      fillElements(myTree, elements);
      final Runnable uiThread = new Runnable() {
        public void run() {
          if (myDisposed) return;
          clear();
          myElements.addAll(elements);
          myUpdating.set(false);
          fireTableDataChanged();
          DirDiffTableModel.this.text.set("");
          if (loadingPanel.isLoading()) {
            loadingPanel.stopLoading();
          }
          if (mySelectionConfig == null) {
            selectFirstRow();
          } else {
            mySelectionConfig.restore();
          }
          myPanel.update(true);
        }
      };
      if (myProject == null || myProject.isDefault()) {
        SwingUtilities.invokeLater(uiThread);
      } else {
        app.invokeLater(uiThread, ModalityState.any());
      }
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:45,代碼來源:DirDiffTableModel.java


注:本文中的com.intellij.openapi.application.Application.executeOnPooledThread方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。