Package com.intellij.openapi.application

Examples of com.intellij.openapi.application.Application


      }
    }));
  }

  public static void sortModules(final Project project, final List<Module> modules) {
    final Application application = ApplicationManager.getApplication();
    Runnable sort = new Runnable() {
      public void run() {
        Comparator<Module> comparator = ModuleManager.getInstance(project).moduleDependencyComparator();
        Collections.sort(modules, comparator);
      }
    };
    if (application.isDispatchThread()) {
      sort.run();
    }
    else {
      application.runReadAction(sort);
    }
  }
View Full Code Here


    writer.close();
    return VfsUtil.pathToUrl(redirect.getAbsolutePath());
  }

  private static boolean isUseDefaultBrowser() {
    Application application = ApplicationManager.getApplication();
    if (application == null) {
      return true;
    }
    else {
      return GeneralSettings.getInstance().isUseDefaultBrowser();
View Full Code Here

      return GeneralSettings.getInstance().isUseDefaultBrowser();
    }
  }

  private static void showErrorMessage(final String message, final String title) {
    final Application app = ApplicationManager.getApplication();
    if (app == null) {
      return; // Not started yet. Not able to show message up. (Could happen in License panel under Linux).
    }

    Runnable runnable = new Runnable() {
      public void run() {
        Messages.showMessageDialog(message,
                                   title,
                                   Messages.getErrorIcon());
      }
    };

    if (app.isDispatchThread()) {
      runnable.run();
    }
    else {
      app.invokeLater(runnable, ModalityState.NON_MODAL);
    }
  }
View Full Code Here

    if (myMacroMap == null) {
      // the insertion order is important for later iterations, so LinkedHashMap is used
      myMacroMap = new LinkedHashMap<String, String>();

      // ApplicationManager.getApplication() will return null if executed in ParameterListTest
      final Application application = ApplicationManager.getApplication();
      if (application != null) {
        application.runReadAction(new Runnable() {
          public void run() {
            final PathMacros pathMacros = PathMacros.getInstance();
            final Set<String> names = pathMacros.getAllMacroNames();
              for (String name : names) {
                  myMacroMap.put("${" + name + "}", pathMacros.getValue(name));
View Full Code Here

  private final ProcessWaitFor myWaitFor;

  private static ExecutorService ourThreadExecutorsService = null;

  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,
View Full Code Here

  public StorageAccessors(Storage storage) {
    myStorage = storage;
  }

  public static StorageAccessors createGlobal(@NonNls String prefix) {
    Application application = ApplicationManager.getApplication();
    Storage storage;
    if (application != null) storage = new Storage.PropertiesComponentStorage(prefix + ".");
    else storage = new Storage.MapStorage();
    return new StorageAccessors(storage);
  }
View Full Code Here

import com.intellij.ui.content.ContentManagerUtil;

public class SayHelloAction extends AnAction {
    public void actionPerformed(AnActionEvent e) {
        ContentManager contentManager = ContentManagerUtil.getContentManagerFromContext(e.getDataContext(), false);
        Application application = ApplicationManager.getApplication();
        HelloWorldApplicationComponent helloWorldComponent =
                application.getComponent(HelloWorldApplicationComponent.class);
        helloWorldComponent.sayHello();
        if (contentManager != null) {
            contentManager.addContent(ContentFactory.SERVICE.getInstance().createContent(helloWorldComponent.createComponent(), "POPS", false));
        }
    }
View Full Code Here

public class JsLintExternalAnnotator extends ExternalAnnotator {

    public void annotate(@NotNull final PsiFile psiFile, @NotNull final AnnotationHolder annotationHolder) {
        final String text = psiFile.getText();
        final JSLintRunner runner = JSLintRunnerManager.getInstance().getRunner();
        final Application application = ApplicationManager.getApplication();
        final JsLintValidatorComponent validator = application.getComponent(JsLintValidatorComponent.class);
        try {
            final Object[] errorBeans = runner.validateScriptString(text, validator.getJsLintOptions());
            int currentLine = 1;
            int currentOffset = 0;
            ErrorBeanWrapper errorBean = new ErrorBeanWrapper();
View Full Code Here

    private JLabel totalNumberOfErrors;

    public JsLinkToolWindow() {
        runButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Application application = ApplicationManager.getApplication();
                JsLintValidatorComponent validator = application.getComponent(JsLintValidatorComponent.class);
                try {
                    ((DefaultTableModel) errorList.getModel()).setRowCount(0);
                    totalNumberOfErrors.setText("");
                    DataContext toolContext = DataManager.getInstance().getDataContextFromFocus().getResult();
                    Project project = DataKeys.PROJECT.getData(toolContext);
View Full Code Here

        } else {
            attributes = additionalType.getAttributes().clone();
            attributes.setBackgroundColor(mainAttributes.getBackgroundColor());
        }

        Application application = ApplicationManager.getApplication();
        if (application.isDispatchThread()) {
            console.printToHistory(string, attributes);
        } else {
            application.invokeLater(new Runnable() {
                public void run() {
                    console.printToHistory(string, attributes);
                }
            }, ModalityState.stateForComponent(console.getComponent()));
        }
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.