Search in sources :

Example 81 with Application

use of com.intellij.openapi.application.Application in project intellij-community by JetBrains.

the class IdeaPluginDescriptorImpl method isBundled.

@Override
public boolean isBundled() {
    if (PluginManagerCore.CORE_PLUGIN_ID.equals(myId.getIdString())) {
        return true;
    }
    String path;
    try {
        //to avoid paths like this /home/kb/IDEA/bin/../config/plugins/APlugin
        path = getPath().getCanonicalPath();
    } catch (IOException e) {
        path = getPath().getAbsolutePath();
    }
    Application app = ApplicationManager.getApplication();
    if (app != null && app.isInternal()) {
        if (path.startsWith(PathManager.getHomePath() + File.separator + "out" + File.separator + "classes")) {
            return true;
        }
        if (app.isUnitTestMode() && !path.startsWith(PathManager.getPluginsPath() + File.separatorChar)) {
            return true;
        }
    }
    return path.startsWith(PathManager.getPreInstalledPluginsPath());
}
Also used : IOException(java.io.IOException) Application(com.intellij.openapi.application.Application)

Example 82 with Application

use of com.intellij.openapi.application.Application in project intellij-community by JetBrains.

the class IdeaPluginDescriptorImpl method readExternal.

public void readExternal(@NotNull Document document, @NotNull URL url, @NotNull JDOMXIncluder.PathResolver pathResolver) throws InvalidDataException, FileNotFoundException {
    Application application = ApplicationManager.getApplication();
    readExternal(document, url, application != null && application.isUnitTestMode(), pathResolver);
}
Also used : Application(com.intellij.openapi.application.Application)

Example 83 with Application

use of com.intellij.openapi.application.Application in project intellij-community by JetBrains.

the class PluginManagerCore method prepareLoadingPluginsErrorMessage.

private static void prepareLoadingPluginsErrorMessage(@NotNull List<String> errors) {
    if (!errors.isEmpty()) {
        String errorMessage = IdeBundle.message("error.problems.found.loading.plugins") + StringUtil.join(errors, "<p/>");
        Application app = ApplicationManager.getApplication();
        if (app != null && !app.isHeadlessEnvironment() && !app.isUnitTestMode()) {
            if (myPluginError == null) {
                myPluginError = errorMessage;
            } else {
                myPluginError += "\n" + errorMessage;
            }
        } else {
            getLogger().error(errorMessage);
        }
    }
}
Also used : Application(com.intellij.openapi.application.Application)

Example 84 with Application

use of com.intellij.openapi.application.Application in project intellij-community by JetBrains.

the class IdeFocusManager method getGlobalInstance.

@NotNull
public static IdeFocusManager getGlobalInstance() {
    IdeFocusManager fm = null;
    Application app = ApplicationManager.getApplication();
    if (app != null && app.hasComponent(IdeFocusManager.class)) {
        fm = app.getComponent(IdeFocusManager.class);
    }
    if (fm == null) {
        // happens when app is semi-initialized (e.g. when IDEA server dialog is shown)
        fm = PassThroughIdeFocusManager.getInstance();
    }
    return fm;
}
Also used : Application(com.intellij.openapi.application.Application) NotNull(org.jetbrains.annotations.NotNull)

Example 85 with Application

use of com.intellij.openapi.application.Application in project intellij-community by JetBrains.

the class TextFieldWithBrowseButton method installPathCompletion.

protected void installPathCompletion(final FileChooserDescriptor fileChooserDescriptor, @Nullable Disposable parent) {
    final Application application = ApplicationManager.getApplication();
    if (application == null || application.isUnitTestMode() || application.isHeadlessEnvironment())
        return;
    FileChooserFactory.getInstance().installFileCompletion(getChildComponent(), fileChooserDescriptor, true, parent);
}
Also used : Application(com.intellij.openapi.application.Application)

Aggregations

Application (com.intellij.openapi.application.Application)188 NotNull (org.jetbrains.annotations.NotNull)23 VirtualFile (com.intellij.openapi.vfs.VirtualFile)21 IOException (java.io.IOException)14 Project (com.intellij.openapi.project.Project)13 Nullable (org.jetbrains.annotations.Nullable)12 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)9 ModalityState (com.intellij.openapi.application.ModalityState)8 Ref (com.intellij.openapi.util.Ref)7 ArrayList (java.util.ArrayList)7 List (java.util.List)6 ApplicationImpl (com.intellij.openapi.application.impl.ApplicationImpl)5 ApplicationManager (com.intellij.openapi.application.ApplicationManager)4 ApplicationEx (com.intellij.openapi.application.ex.ApplicationEx)4 Document (com.intellij.openapi.editor.Document)4 Module (com.intellij.openapi.module.Module)4 Computable (com.intellij.openapi.util.Computable)4 PsiFile (com.intellij.psi.PsiFile)4 File (java.io.File)4 Editor (com.intellij.openapi.editor.Editor)3