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


Java Application.isHeadlessEnvironment方法代碼示例

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


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

示例1: 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

示例2: updateActions

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
private void updateActions(boolean now, final boolean transparentOnly, final boolean forced) {
  final Runnable updateRunnable = new MyUpdateRunnable(this, transparentOnly, forced);
  final Application app = ApplicationManager.getApplication();

  if (now || app.isUnitTestMode()) {
    updateRunnable.run();
  }
  else {
    final IdeFocusManager fm = IdeFocusManager.getInstance(null);

    if (!app.isHeadlessEnvironment()) {
      if (app.isDispatchThread() && myComponent.isShowing()) {
        fm.doWhenFocusSettlesDown(updateRunnable);
      }
      else {
        UiNotifyConnector.doWhenFirstShown(myComponent, new Runnable() {
          @Override
          public void run() {
            fm.doWhenFocusSettlesDown(updateRunnable);
          }
        });
      }
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:ToolbarUpdater.java

示例3: show

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
private static void show(final Project project, final String message, final MessageType type, final boolean showOverChangesView,
                         @Nullable final NamedRunnable[] notificationListener) {
  final Application application = ApplicationManager.getApplication();
  if (application.isHeadlessEnvironment()) return;
  final Runnable showErrorAction = new Runnable() {
    public void run() {
      new VcsBalloonProblemNotifier(project, message, type, showOverChangesView, notificationListener).run();
    }
  };
  if (application.isDispatchThread()) {
    showErrorAction.run();
  }
  else {
    application.invokeLater(showErrorAction);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:VcsBalloonProblemNotifier.java

示例4: postStartupActivity

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
@Override
public void postStartupActivity(@NotNull Project project) {
  final Application application = ApplicationManager.getApplication();
  if (application.isHeadlessEnvironment() || application.isUnitTestMode()) {
    return;
  }

  List<VirtualFile> changedFiles = findVirtualFiles(myChangedFiles);
  if (!changedFiles.isEmpty()) {
    EditAction.editFilesAndShowErrors(project, changedFiles);
  }

  final List<VirtualFile> createdFiles = findVirtualFiles(myCreatedFiles);
  if (containsFilesUnderVcs(createdFiles, project)) {
    final VcsShowConfirmationOptionImpl option = new VcsShowConfirmationOptionImpl("", "", "", "", "");
    final Collection<VirtualFile> selected = AbstractVcsHelper.getInstance(project)
      .selectFilesToProcess(createdFiles, "Files Created", "Select files to be added to version control", null, null, option);
    if (selected != null && !selected.isEmpty()) {
      final ChangeListManagerImpl changeListManager = ChangeListManagerImpl.getInstanceImpl(project);
      changeListManager.addUnversionedFiles(changeListManager.getDefaultChangeList(), new ArrayList<VirtualFile>(selected));
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:24,代碼來源:ConversionResultImpl.java

示例5: processMetaData

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
private static synchronized void processMetaData(@NotNull final IntentionActionMetaData metaData) {
  final Application app = ApplicationManager.getApplication();
  if (app.isUnitTestMode() || app.isHeadlessEnvironment()) return;

  final TextDescriptor description = metaData.getDescription();
  ourRegisterMetaDataAlarm.addRequest(new Runnable(){
    @Override
    public void run() {
      try {
        SearchableOptionsRegistrar registrar = SearchableOptionsRegistrar.getInstance();
        if (registrar == null) return;
        @NonNls String descriptionText = description.getText().toLowerCase();
        descriptionText = HTML_PATTERN.matcher(descriptionText).replaceAll(" ");
        final Set<String> words = registrar.getProcessedWordsWithoutStemming(descriptionText);
        words.addAll(registrar.getProcessedWords(metaData.getFamily()));
        for (String word : words) {
          registrar.addOption(word, metaData.getFamily(), metaData.getFamily(), IntentionSettingsConfigurable.HELP_ID, IntentionSettingsConfigurable.DISPLAY_NAME);
        }
      }
      catch (IOException e) {
        LOG.error(e);
      }
    }
  }, 0);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:IntentionManagerSettings.java

示例6: startRemoteProcess

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
public ProcessHandler startRemoteProcess(@NotNull Sdk sdk,
                                         @NotNull GeneralCommandLine commandLine,
                                         @Nullable Project project,
                                         @Nullable PyRemotePathMapper pathMapper)
  throws ExecutionException {
  PythonRemoteInterpreterManager manager = PythonRemoteInterpreterManager.getInstance();
  if (manager != null) {
    PyRemoteProcessHandlerBase processHandler;

    try {
      processHandler = doStartRemoteProcess(sdk, commandLine, manager, project, pathMapper);
    }
    catch (ExecutionException e) {
      final Application application = ApplicationManager.getApplication();
      if (application != null && (application.isUnitTestMode() || application.isHeadlessEnvironment())) {
        throw new RuntimeException(e);
      }
      throw new ExecutionException("Can't run remote python interpreter: " + e.getMessage(), e);
    }
    ProcessTerminatedListener.attach(processHandler);
    return processHandler;
  }
  else {
    throw new PythonRemoteInterpreterManager.PyRemoteInterpreterExecutionException();
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:PyRemoteProcessStarter.java

示例7: runActivity

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
@Override
public void runActivity(@NotNull Project project) {
  final Application application = ApplicationManager.getApplication();
  if (application.isUnitTestMode() || application.isHeadlessEnvironment()) return;
  ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
    @Override
    public void run() {
      getInstance().getTechnologyDescriptors();
    }
  });
  ;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:LibraryJarStatisticsService.java

示例8: getDescriptionUrl

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
protected URL getDescriptionUrl() {
  Application app = ApplicationManager.getApplication();
  if (myEP == null || app.isUnitTestMode() || app.isHeadlessEnvironment()) {
    return superGetDescriptionUrl();
  }
  String fileName = getDescriptionFileName();
  return myEP.getLoaderForClass().getResource("/inspectionDescriptions/" + fileName);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:InspectionToolWrapper.java

示例9: addToInvokeLater

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
/**
* Adds runnable to Event Dispatch Queue
* if we aren't in UnitTest of Headless environment mode
*
* @param runnable Runnable
*/
public static void addToInvokeLater(final Runnable runnable) {
  final Application application = ApplicationManager.getApplication();
  final boolean unitTestMode = application.isUnitTestMode();
  if (unitTestMode) {
    UIUtil.invokeLaterIfNeeded(runnable);
  }
  else if (application.isHeadlessEnvironment() || application.isDispatchThread()) {
    runnable.run();
  }
  else {
    TRANSFER_TO_EDT_QUEUE.offer(runnable);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:20,代碼來源:ExternalSystemApiUtil.java

示例10: confirmAndUpdate

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
private boolean confirmAndUpdate(final X509Certificate[] chain, boolean addToKeyStore, boolean askUser) {
  Application app = ApplicationManager.getApplication();
  final X509Certificate endPoint = chain[0];
  // IDEA-123467 and IDEA-123335 workaround
  String threadClassName = StringUtil.notNullize(Thread.currentThread().getClass().getCanonicalName());
  if (threadClassName.equals("sun.awt.image.ImageFetcher")) {
    LOG.debug("Image Fetcher thread is detected. Certificate check will be skipped.");
    return true;
  }
  if (app.isUnitTestMode() || app.isHeadlessEnvironment() || CertificateManager.getInstance().getState().ACCEPT_AUTOMATICALLY) {
    LOG.debug("Certificate will be accepted automatically");
    if (addToKeyStore) {
      myCustomManager.addCertificate(endPoint);
    }
    return true;
  }
  boolean accepted = askUser && CertificateManager.showAcceptDialog(new Callable<DialogWrapper>() {
    @Override
    public DialogWrapper call() throws Exception {
      // TODO may be another kind of warning, if default trust store is missing
      return CertificateWarningDialog.createUntrustedCertificateWarning(endPoint);
    }
  });
  if (accepted) {
    LOG.info("Certificate was accepted by user");
    if (addToKeyStore) {
      myCustomManager.addCertificate(endPoint);
    }
  }
  return accepted;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:32,代碼來源:ConfirmingTrustManager.java

示例11: addToInvokeLater

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
/**
 * Adds runnable to Event Dispatch Queue
 * if we aren't in UnitTest of Headless environment mode
 * @param runnable Runnable
 */
public static void addToInvokeLater(final Runnable runnable) {
  final Application application = ApplicationManager.getApplication();
  if (application.isHeadlessEnvironment() && !application.isUnitTestMode()) {
    runnable.run();
  } else {
    UIUtil.invokeLaterIfNeeded(runnable);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:14,代碼來源:SMRunnerUtil.java

示例12: addToInvokeLater

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
public void addToInvokeLater(final Runnable runnable) {
  final Application application = ApplicationManager.getApplication();
  if (application.isUnitTestMode()) {
    UIUtil.invokeLaterIfNeeded(runnable);
  }
  else if (application.isHeadlessEnvironment() || SwingUtilities.isEventDispatchThread()) {
    runnable.run();
  }
  else {
    myTransferToEDTQueue.offer(runnable);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:GeneralTestEventsProcessor.java

示例13: commandStarted

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
private void commandStarted(UndoConfirmationPolicy undoConfirmationPolicy, boolean recordOriginalReference) {
  if (myCommandLevel == 0) {
    myCurrentMerger = new CommandMerger(this, CommandProcessor.getInstance().isUndoTransparentActionInProgress());

    if (recordOriginalReference && myProject != null) {
      Editor editor = null;
      final Application application = ApplicationManager.getApplication();
      if (application.isUnitTestMode() || application.isHeadlessEnvironment()) {
        editor = CommonDataKeys.EDITOR.getData(DataManager.getInstance().getDataContext());
      }
      else {
        Component component = WindowManagerEx.getInstanceEx().getFocusedComponent(myProject);
        if (component != null) {
          editor = CommonDataKeys.EDITOR.getData(DataManager.getInstance().getDataContext(component));
        }
      }

      if (editor != null) {
        Document document = editor.getDocument();
        VirtualFile file = FileDocumentManager.getInstance().getFile(document);
        if (file != null && file.isValid()) {
          myOriginatorReference = DocumentReferenceManager.getInstance().create(file);
        }
      }
    }
  }
  LOG.assertTrue(myCurrentMerger != null, String.valueOf(myCommandLevel));
  myCurrentMerger.setBeforeState(getCurrentState());
  myCurrentMerger.mergeUndoConfirmationPolicy(undoConfirmationPolicy);

  myCommandLevel++;

}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:34,代碼來源:UndoManagerImpl.java

示例14: append

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
@Override
protected synchronized void append(@NotNull final LoggingEvent event) {
  if (!event.getLevel().isGreaterOrEqual(Level.ERROR) ||
      Main.isCommandLine() ||
      !IdeaApplication.isLoaded()) {
    return;
  }

  Runnable action = new Runnable() {
    @Override
    public void run() {
      try {
        List<ErrorLogger> loggers = new ArrayList<ErrorLogger>();
        loggers.add(DEFAULT_LOGGER);

        Application application = ApplicationManager.getApplication();
        if (application != null) {
          if (application.isHeadlessEnvironment() || application.isDisposed()) return;
          ContainerUtil.addAll(loggers, ServiceKt.getComponents(application, ErrorLogger.class));
        }

        appendToLoggers(event, loggers.toArray(new ErrorLogger[loggers.size()]));
      }
      finally {
        myPendingAppendCounts.decrementAndGet();
      }
    }
  };

  if (myPendingAppendCounts.addAndGet(1) > MAX_ASYNC_LOGGING_EVENTS) {
    // Stop adding requests to the queue or we can get OOME on pending logging requests (IDEA-95327)
    myPendingAppendCounts.decrementAndGet(); // number of pending logging events should not increase
  }
  else {
    // Note, we MUST avoid SYNCHRONOUS invokeAndWait to prevent deadlocks
    //noinspection SSBasedInspection
    SwingUtilities.invokeLater(action);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:40,代碼來源:DialogAppender.java

示例15: shouldNotify

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
private boolean shouldNotify() {
  Application application = ApplicationManager.getApplication();
  if (application.isUnitTestMode() || application.isHeadlessEnvironment()) {
    return false;
  }
  EditorSettingsExternalizable.OptionSet editorOptions = EditorSettingsExternalizable.getInstance().getOptions();
  return editorOptions.SHOW_NOTIFICATION_AFTER_REFORMAT_CODE_ACTION && myEditor != null && !myProcessSelectedText;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:FileInEditorProcessor.java


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