Search in sources :

Example 11 with ApplicationInfoEx

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

the class AboutPopup method show.

public static void show(@Nullable Window window, boolean showDebugInfo) {
    ApplicationInfoEx appInfo = (ApplicationInfoEx) ApplicationInfo.getInstance();
    final PopupPanel panel = new PopupPanel(new BorderLayout());
    Icon image = IconLoader.getIcon(appInfo.getAboutImageUrl());
    if (appInfo.showLicenseeInfo()) {
        final InfoSurface infoSurface = new InfoSurface(image, showDebugInfo);
        infoSurface.setPreferredSize(new Dimension(image.getIconWidth(), image.getIconHeight()));
        panel.setInfoSurface(infoSurface);
    } else {
        panel.add(new JLabel(image), BorderLayout.NORTH);
    }
    RelativePoint location;
    if (window != null) {
        Rectangle r = window.getBounds();
        location = new RelativePoint(window, new Point((r.width - image.getIconWidth()) / 2, (r.height - image.getIconHeight()) / 2));
    } else {
        Rectangle r = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().getBounds();
        location = new RelativePoint(new Point((r.width - image.getIconWidth()) / 2, (r.height - image.getIconHeight()) / 2));
    }
    ourPopup = JBPopupFactory.getInstance().createComponentPopupBuilder(panel, panel).setRequestFocus(true).setFocusable(true).setResizable(false).setMovable(false).setModalContext(false).setShowShadow(true).setShowBorder(false).setCancelKeyEnabled(true).setCancelOnClickOutside(true).setCancelOnOtherWindowOpen(true).createPopup();
    Disposer.register(ourPopup, new Disposable() {

        @Override
        public void dispose() {
            ourPopup = null;
        }
    });
    ourPopup.show(location);
}
Also used : Disposable(com.intellij.openapi.Disposable) ApplicationInfoEx(com.intellij.openapi.application.ex.ApplicationInfoEx) RelativePoint(com.intellij.ui.awt.RelativePoint) RelativePoint(com.intellij.ui.awt.RelativePoint)

Example 12 with ApplicationInfoEx

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

the class PluginOptionsTopHitProvider method getOptions.

@NotNull
@Override
public Collection<OptionDescription> getOptions(@Nullable Project project) {
    ArrayList<OptionDescription> options = new ArrayList<>();
    ApplicationInfoEx applicationInfo = ApplicationInfoEx.getInstanceEx();
    for (IdeaPluginDescriptor pluginDescriptor : PluginManagerCore.getPlugins()) {
        if (applicationInfo.isEssentialPlugin(pluginDescriptor.getPluginId().getIdString())) {
            continue;
        }
        options.add(new PluginBooleanOptionDescriptor(pluginDescriptor.getPluginId()));
    }
    return options;
}
Also used : OptionDescription(com.intellij.ide.ui.search.OptionDescription) ApplicationInfoEx(com.intellij.openapi.application.ex.ApplicationInfoEx) ArrayList(java.util.ArrayList) IdeaPluginDescriptor(com.intellij.ide.plugins.IdeaPluginDescriptor) NotNull(org.jetbrains.annotations.NotNull)

Example 13 with ApplicationInfoEx

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

the class PluginDownloader method getUrl.

@NotNull
private static String getUrl(@NotNull IdeaPluginDescriptor descriptor, @Nullable String host, @Nullable BuildNumber buildNumber) throws URISyntaxException, MalformedURLException {
    if (host != null && descriptor instanceof PluginNode) {
        String url = ((PluginNode) descriptor).getDownloadUrl();
        return new URI(url).isAbsolute() ? url : new URL(new URL(host), url).toExternalForm();
    } else {
        Application app = ApplicationManager.getApplication();
        ApplicationInfoEx appInfo = ApplicationInfoImpl.getShadowInstance();
        String buildNumberAsString = buildNumber != null ? buildNumber.asString() : app != null ? ApplicationInfo.getInstance().getApiVersion() : appInfo.getBuild().asString();
        URIBuilder uriBuilder = new URIBuilder(appInfo.getPluginsDownloadUrl());
        uriBuilder.addParameter("action", "download");
        uriBuilder.addParameter("id", descriptor.getPluginId().getIdString());
        uriBuilder.addParameter("build", buildNumberAsString);
        uriBuilder.addParameter("uuid", PermanentInstallationID.get());
        return uriBuilder.build().toString();
    }
}
Also used : ApplicationInfoEx(com.intellij.openapi.application.ex.ApplicationInfoEx) URIBuilder(org.apache.http.client.utils.URIBuilder) NotNull(org.jetbrains.annotations.NotNull)

Example 14 with ApplicationInfoEx

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

the class ShowSplashAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    final ApplicationInfoEx app = ApplicationInfoImpl.getShadowInstance();
    final Splash splash = new Splash(app);
    final SplashListener listener = new SplashListener(splash);
    splash.addFocusListener(listener);
    splash.addKeyListener(listener);
    splash.addMouseListener(listener);
    splash.show();
}
Also used : ApplicationInfoEx(com.intellij.openapi.application.ex.ApplicationInfoEx)

Example 15 with ApplicationInfoEx

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

the class HelpManagerImpl method invokeHelp.

public void invokeHelp(@Nullable String id) {
    id = StringUtil.notNullize(id, "top");
    UsageTrigger.trigger("ide.help." + id);
    if (MacHelpUtil.isApplicable() && MacHelpUtil.invokeHelp(id)) {
        return;
    }
    IdeaHelpBroker broker = SoftReference.dereference(myBrokerReference);
    if (broker == null) {
        HelpSet set = createHelpSet();
        if (set != null) {
            broker = new IdeaHelpBroker(set);
            myBrokerReference = new WeakReference<>(broker);
        }
    }
    if (broker == null) {
        ApplicationInfoEx info = ApplicationInfoEx.getInstanceEx();
        String minorVersion = info.getMinorVersion();
        int dot = minorVersion.indexOf('.');
        if (dot != -1) {
            minorVersion = minorVersion.substring(0, dot);
        }
        String productVersion = info.getMajorVersion() + "." + minorVersion;
        String url = info.getWebHelpUrl() + "/" + productVersion + "/?" + id;
        if (PlatformUtils.isJetBrainsProduct()) {
            String productCode = info.getBuild().getProductCode();
            if (!StringUtil.isEmpty(productCode)) {
                url += "&utm_source=from_product&utm_medium=help_link&utm_campaign=" + productCode + "&utm_content=" + productVersion;
            }
        }
        BrowserUtil.browse(url);
        return;
    }
    Window activeWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
    broker.setActivationWindow(activeWindow);
    try {
        broker.setCurrentID(id);
    } catch (BadIDException e) {
        Messages.showErrorDialog(IdeBundle.message("help.topic.not.found.error", id), CommonBundle.getErrorTitle());
        return;
    }
    broker.setDisplayed(true);
}
Also used : HelpSet(javax.help.HelpSet) ApplicationInfoEx(com.intellij.openapi.application.ex.ApplicationInfoEx) BadIDException(javax.help.BadIDException)

Aggregations

ApplicationInfoEx (com.intellij.openapi.application.ex.ApplicationInfoEx)20 NotNull (org.jetbrains.annotations.NotNull)4 IdeaPluginDescriptor (com.intellij.ide.plugins.IdeaPluginDescriptor)3 ApplicationNamesInfo (com.intellij.openapi.application.ApplicationNamesInfo)3 UpdateSettings (com.intellij.openapi.updateSettings.impl.UpdateSettings)3 IOException (java.io.IOException)3 Application (com.intellij.openapi.application.Application)2 Attachment (com.intellij.openapi.diagnostic.Attachment)2 BuildNumber (com.intellij.openapi.util.BuildNumber)2 URL (java.net.URL)2 Nullable (com.android.annotations.Nullable)1 CrashReport (com.android.tools.idea.diagnostics.crash.CrashReport)1 CrashReporter (com.android.tools.idea.diagnostics.crash.CrashReporter)1 Maps (com.google.common.collect.Maps)1 JsonWriter (com.google.gson.stream.JsonWriter)1 AbstractMessage (com.intellij.diagnostic.AbstractMessage)1 IdeErrorsDialog (com.intellij.diagnostic.IdeErrorsDialog)1 ReportMessages (com.intellij.diagnostic.ReportMessages)1 ErrorBean (com.intellij.errorreport.bean.ErrorBean)1 DataManager (com.intellij.ide.DataManager)1