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);
}
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;
}
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();
}
}
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();
}
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);
}
Aggregations