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


Java Application.isUnitTestMode方法代碼示例

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


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

示例1: IdeaDecompiler

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
public IdeaDecompiler() {
  Application app = ApplicationManager.getApplication();
  myLegalNoticeAccepted = app.isUnitTestMode() || PropertiesComponent.getInstance().isValueSet(LEGAL_NOTICE_KEY);
  if (!myLegalNoticeAccepted) {
    MessageBusConnection connection = app.getMessageBus().connect(app);
    connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
      @Override
      public void fileOpened(@NotNull FileEditorManager source, @NotNull VirtualFile file) {
        if (file.getFileType() == StdFileTypes.CLASS) {
          FileEditor editor = source.getSelectedEditor(file);
          if (editor instanceof TextEditor) {
            CharSequence text = ((TextEditor)editor).getEditor().getDocument().getImmutableCharSequence();
            if (StringUtil.startsWith(text, BANNER)) {
              showLegalNotice(source.getProject(), file);
            }
          }
        }
      }
    });
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:22,代碼來源:IdeaDecompiler.java

示例2: showError

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
public static void showError(final Project project, final String message, final boolean error) {
  final Application application = ApplicationManager.getApplication();
  if (application.isUnitTestMode()) {
    return;
  }
  final String title = VcsBundle.message("patch.apply.dialog.title");
  final Runnable messageShower = new Runnable() {
    @Override
    public void run() {
      if (error) {
        Messages.showErrorDialog(project, message, title);
      }
      else {
        Messages.showInfoMessage(project, message, title);
      }
    }
  };
  WaitForProgressToShow.runOrInvokeLaterAboveProgress(new Runnable() {
      @Override
      public void run() {
        messageShower.run();
      }
    }, null, project);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:25,代碼來源:PatchApplier.java

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

示例4: getService

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
@Nullable
public static <T> T getService(@NotNull Module module, @NotNull Class<T> serviceClass) {
  //noinspection unchecked
  T instance = (T)module.getPicoContainer().getComponentInstance(serviceClass.getName());
  if (instance == null) {
    instance = module.getComponent(serviceClass);
    if (instance != null) {
      Application app = ApplicationManager.getApplication();
      String message = serviceClass.getName() + " requested as a service, but it is a component - convert it to a service or change call to module.getComponent()";
      if (app.isUnitTestMode()) {
        LOG.error(message);
      }
      else {
        LOG.warn(message);
      }
    }
  }
  return instance;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:20,代碼來源:ModuleServiceManager.java

示例5: loadDescriptors

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
@NotNull
public static IdeaPluginDescriptorImpl[] loadDescriptors(@Nullable StartupProgress progress, @NotNull List<String> errors) {
  if (ClassUtilCore.isLoadingOfExternalPluginsDisabled()) {
    return IdeaPluginDescriptorImpl.EMPTY_ARRAY;
  }

  final List<IdeaPluginDescriptorImpl> result = new ArrayList<IdeaPluginDescriptorImpl>();

  int pluginsCount = countPlugins(PathManager.getPluginsPath()) + countPlugins(PathManager.getPreInstalledPluginsPath());
  loadDescriptors(PathManager.getPluginsPath(), result, progress, pluginsCount);
  Application application = ApplicationManager.getApplication();
  boolean fromSources = false;
  if (application == null || !application.isUnitTestMode()) {
    int size = result.size();
    loadDescriptors(PathManager.getPreInstalledPluginsPath(), result, progress, pluginsCount);
    fromSources = size == result.size();
  }

  loadDescriptorsFromProperty(result);

  loadDescriptorsFromClassPath(result, getClassLoaderUrls(), fromSources ? progress : null);

  return topoSortPlugins(result, errors);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:25,代碼來源:PluginManagerCore.java

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

示例7: 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;
  }

  updateActiveSdks(project, 7000);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:PythonSdkUpdater.java

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

示例9: isTestMode

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
private boolean isTestMode() {
  Boolean testMode = myTestMode;
  if (testMode != null) return testMode;
  
  Application application = ApplicationManager.getApplication();
  if (application == null) return false;

  testMode = application.isUnitTestMode();
  myTestMode = testMode;
  return testMode;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:IdeEventQueue.java

示例10: getSysPath

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
@NotNull
public static List<String> getSysPath(String bin_path) throws InvalidSdkException {
  String working_dir = new File(bin_path).getParent();
  Application application = ApplicationManager.getApplication();
  if (application != null && !application.isUnitTestMode()) {
    return getSysPathsFromScript(bin_path);
  }
  else { // mock sdk
    List<String> ret = new ArrayList<String>(1);
    ret.add(working_dir);
    return ret;
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:14,代碼來源:PythonSdkType.java

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

示例12: MergingUpdateQueue

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
public MergingUpdateQueue(@NonNls @NotNull String name,
                          int mergingTimeSpan,
                          boolean isActive,
                          @Nullable JComponent modalityStateComponent,
                          @Nullable Disposable parent,
                          @Nullable JComponent activationComponent,
                          @NotNull Alarm.ThreadToUse thread) {
  myMergingTimeSpan = mergingTimeSpan;
  myModalityStateComponent = modalityStateComponent;
  myName = name;
  Application app = ApplicationManager.getApplication();
  myPassThrough = app == null || app.isUnitTestMode();
  myExecuteInDispatchThread = thread == Alarm.ThreadToUse.SWING_THREAD;

  if (parent != null) {
    Disposer.register(parent, this);
  }

  myWaiterForMerge = createAlarm(thread, myExecuteInDispatchThread ? null : this);

  if (isActive) {
    showNotify();
  }

  if (activationComponent != null) {
    setActivationComponent(activationComponent);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:29,代碼來源:MergingUpdateQueue.java

示例13: skipAnimation

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
private static boolean skipAnimation() {
  if (GraphicsEnvironment.isHeadless()) {
    return true;
  }
  Application app = ApplicationManager.getApplication();
  return app != null && app.isUnitTestMode();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:8,代碼來源:Animator.java

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

示例15: updateLater

import com.intellij.openapi.application.Application; //導入方法依賴的package包/類
private void updateLater() {
  final Application application = ApplicationManager.getApplication();
  if (application.isUnitTestMode()) {
    myUpdateStatusRunnable.run();
  }
  else {
    updateStatusAlarm.cancelAllRequests();
    updateStatusAlarm.addRequest(myUpdateStatusRunnable, 100);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:StatusBarUpdater.java


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