Package com.intellij.openapi.application

Examples of com.intellij.openapi.application.Application


    if (isReferenceTo(element)) return this;
    final PsiFile file = getContainingFile();
    if (element instanceof PsiClass && (file instanceof ClojureFile)) {
      // todo test me!!
      final PsiClass clazz = (PsiClass) element;
      final Application application = ApplicationManager.getApplication();
      application.runWriteAction(new Runnable() {
        public void run() {
          final ClNs ns = ((ClojureFile) file).findOrCreateNamespaceElement();
          ns.addImportForClass(ClSymbolImpl.this, clazz);
        }
      });
View Full Code Here


  private final Module myModule;

  private static final String CLOJURE_SDK = PathUtil.getJarPathForClass(AFn.class);

  public static Future<?> executeOnPooledThread(Runnable task) {
    final Application application = ApplicationManager.getApplication();

    if (application != null) {
      return application.executeOnPooledThread(task);
    } else {
      if (ourThreadExecutorsService == null) {
        ourThreadExecutorsService = new ThreadPoolExecutor(
            10,
            Integer.MAX_VALUE,
View Full Code Here

  private final SequentialTaskExecutor myRequestsProcessor = new SequentialTaskExecutor(PooledThreadExecutor.INSTANCE);
  private final Map<String, ProjectData> myProjectDataMap = Collections.synchronizedMap(new HashMap<String, ProjectData>());
  private final RustBuildMessageDispatcher myMessageDispatcher = new RustBuildMessageDispatcher();

  public RustBuildManager(final ProjectManager projectManager) {
    final Application application = ApplicationManager.getApplication();
    IS_UNIT_TEST_MODE = application.isUnitTestMode();
    myProjectManager = projectManager;
    mySystemCharset = CharsetToolkit.getDefaultSystemCharset();
    final String systemPath = PathManager.getSystemPath();
    File system = new File(systemPath);
    try {
      system = system.getCanonicalFile();
    }
    catch (IOException e) {
      LOG.info(e);
    }
    mySystemDirectory = system;

//    projectManager.addProjectManagerListener(new ProjectWatcher());

    final MessageBusConnection conn = application.getMessageBus().connect();
    conn.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener.Adapter() {
      @Override
      public void after(@NotNull List<? extends VFileEvent> events) {
        if (shouldTriggerMake(events)) {
//          scheduleAutoMake();
View Full Code Here

  private static void execute(final Update each) {
    each.run();
  }

  public void queue(final Update update) {
    final Application app = ApplicationManager.getApplication();
    if (myPassThrough) {
      app.invokeLater(new Runnable() {
        public void run() {
          if (myDisposed) return;
          update.run();
        }
      });
View Full Code Here

    addBrowseFolderListener(title, description, project, fileChooserDescriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT);
    installPathCompletion(project, fileChooserDescriptor);
  }

  protected void installPathCompletion(final Project project, final FileChooserDescriptor fileChooserDescriptor) {
    final Application application = ApplicationManager.getApplication();
     if (application == null || application.isUnitTestMode() || application.isHeadlessEnvironment()) return;
     FileChooserFactory.getInstance().installFileCompletion(getChildComponent(), fileChooserDescriptor, true, new ComponentDisposable(getChildComponent(), project));
   }
View Full Code Here

  protected abstract void interrupt();

  protected abstract int processTimeout();

  public final int execute() {
    final Application application = ApplicationManager.getApplication();

    /* TODO: uncomment assertion when problems in Perforce plugin are fixed.
    LOG.assertTrue(!application.isDispatchThread(), "InterruptibleActivity is supposed to be lengthy thus must not block Swing UI thread");
    */

    final Future<?> future = application.executeOnPooledThread(new Runnable() {
      public void run() {
        start();
      }
    });

    final int rc = waitForFuture(future);
    if (rc != 0) {
      application.executeOnPooledThread(new Runnable() {
        public void run() {
          interrupt();
        }
      });
    }
View Full Code Here

   * Returns the editor factory instance.
   *
   * @return the editor factory instance.
   */
  public static EditorFactory getInstance() {
    final Application application = ApplicationManager.getApplication();
    return application == null ? null : application.getComponent(EditorFactory.class);
  }
View Full Code Here

   */
  @Nullable
  public static String getModuleOutputPath(final Module module, boolean forTestClasses) {
    final ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module);
    final String outPathUrl;
    final Application application = ApplicationManager.getApplication();
    if (forTestClasses) {
      if (application.isDispatchThread()) {
        final String url = moduleRootManager.getCompilerOutputPathForTestsUrl();
        outPathUrl = (url != null) ? url : moduleRootManager.getCompilerOutputPathUrl();
      }
      else {
        outPathUrl = application.runReadAction(new Computable<String>() {
          public String compute() {
            final String url = moduleRootManager.getCompilerOutputPathForTestsUrl();
            return (url != null) ? url : moduleRootManager.getCompilerOutputPathUrl();
          }
        });
      }
    }
    else { // for ordinary classes
      if (application.isDispatchThread()) {
        outPathUrl = moduleRootManager.getCompilerOutputPathUrl();
      }
      else {
        outPathUrl = application.runReadAction(new Computable<String>() {
          public String compute() {
            return moduleRootManager.getCompilerOutputPathUrl();
          }
        });
      }
View Full Code Here

    return guessEncoding(f, bufferLength, getIDEOptionsCharset());
  }

  public static Charset getIDEOptionsCharset() {
    // see SCR #5288
    Application application = ApplicationManager.getApplication();
    if (application == null) return null;
    CharsetSettings settings = CharsetSettings.getInstance();
    if (settings == null) return null;

    String charsetName = settings.getCharsetName();
View Full Code Here

  protected static final String YES_BUTTON = CommonBundle.getYesButtonText();
  protected static final String NO_BUTTON = CommonBundle.getNoButtonText();
  protected static final String CANCEL_BUTTON = CommonBundle.getCancelButtonText();

  public static TestDialog setTestDialog(TestDialog newValue) {
    Application application = ApplicationManager.getApplication();
    if (application != null) {
      LOG.assertTrue(application.isUnitTestMode(), "This methos is available for tests only");
    }
    TestDialog oldValue = ourTestImplementation;
    ourTestImplementation = newValue;
    return oldValue;
  }
View Full Code Here

TOP

Related Classes of com.intellij.openapi.application.Application

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.