Search in sources :

Example 1 with ApplicationInfoEx

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

the class ReportProblemAction method launchBrowser.

public static void launchBrowser(@Nullable Project project) {
    final ApplicationInfoEx appInfo = ApplicationInfoEx.getInstanceEx();
    boolean eap = appInfo.isEAP();
    String urlTemplate = appInfo.getEAPFeedbackUrl();
    urlTemplate = urlTemplate.replace("$BUILD", eap ? appInfo.getBuild().asStringWithoutProductCode() : appInfo.getBuild().asString()).replace("$TIMEZONE", System.getProperty("user.timezone")).replace("$EVAL", isEvaluationLicense() ? "true" : "false").replace("$DESCR", SendFeedbackAction.getDescription());
    BrowserUtil.browse(urlTemplate, project);
}
Also used : ApplicationInfoEx(com.intellij.openapi.application.ex.ApplicationInfoEx)

Example 2 with ApplicationInfoEx

use of com.intellij.openapi.application.ex.ApplicationInfoEx in project smali by JesusFreke.

the class ITNProxy method createParameters.

public static Map<String, String> createParameters(ErrorBean error) {
    Map<String, String> params = ContainerUtil.newLinkedHashMap(40);
    params.put("protocol.version", "1");
    params.put("os.name", SystemProperties.getOsName());
    params.put("java.version", SystemProperties.getJavaVersion());
    params.put("java.vm.vendor", SystemProperties.getJavaVmVendor());
    ApplicationInfoEx appInfo = ApplicationInfoEx.getInstanceEx();
    ApplicationNamesInfo namesInfo = ApplicationNamesInfo.getInstance();
    Application application = ApplicationManager.getApplication();
    params.put("app.name", namesInfo.getProductName());
    params.put("app.name.full", namesInfo.getFullProductName());
    params.put("app.name.version", appInfo.getVersionName());
    params.put("app.eap", Boolean.toString(appInfo.isEAP()));
    params.put("app.internal", Boolean.toString(application.isInternal()));
    params.put("app.build", appInfo.getBuild().asString());
    params.put("app.version.major", appInfo.getMajorVersion());
    params.put("app.version.minor", appInfo.getMinorVersion());
    params.put("app.build.date", format(appInfo.getBuildDate()));
    params.put("app.build.date.release", format(appInfo.getMajorReleaseBuildDate()));
    params.put("app.compilation.timestamp", IdeaLogger.getOurCompilationTimestamp());
    UpdateSettings updateSettings = UpdateSettings.getInstance();
    params.put("update.channel.status", updateSettings.getSelectedChannelStatus().getCode());
    params.put("update.ignored.builds", StringUtil.join(updateSettings.getIgnoredBuildNumbers(), ","));
    params.put("plugin.name", error.getPluginName());
    params.put("plugin.version", error.getPluginVersion());
    params.put("last.action", error.getLastAction());
    params.put("previous.exception", error.getPreviousException() == null ? null : Integer.toString(error.getPreviousException()));
    params.put("error.message", error.getMessage());
    params.put("error.stacktrace", error.getStackTrace());
    params.put("error.description", error.getDescription());
    params.put("assignee.id", error.getAssigneeId() == null ? null : Integer.toString(error.getAssigneeId()));
    for (Attachment attachment : error.getAttachments()) {
        params.put("attachment.name", attachment.getName());
        params.put("attachment.value", attachment.getEncodedBytes());
    }
    return params;
}
Also used : ApplicationInfoEx(com.intellij.openapi.application.ex.ApplicationInfoEx) ApplicationNamesInfo(com.intellij.openapi.application.ApplicationNamesInfo) Attachment(com.intellij.openapi.diagnostic.Attachment) UpdateSettings(com.intellij.openapi.updateSettings.impl.UpdateSettings) Application(com.intellij.openapi.application.Application)

Example 3 with ApplicationInfoEx

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

the class PermanentInstallationID method calculateInstallationId.

private static String calculateInstallationId() {
    final ApplicationInfoEx appInfo = ApplicationInfoImpl.getShadowInstance();
    final Preferences oldPrefs = Preferences.userRoot();
    // compatibility with previous versions
    final String oldValue = appInfo.isVendorJetBrains() ? oldPrefs.get(OLD_USER_ON_MACHINE_ID_KEY, null) : null;
    final String companyName = appInfo.getShortCompanyName();
    final Preferences prefs = Preferences.userRoot().node(StringUtil.isEmptyOrSpaces(companyName) ? "jetbrains" : companyName.toLowerCase(Locale.US));
    String installationId = prefs.get(INSTALLATION_ID_KEY, null);
    if (StringUtil.isEmptyOrSpaces(installationId)) {
        installationId = !StringUtil.isEmptyOrSpaces(oldValue) ? oldValue : UUID.randomUUID().toString();
        prefs.put(INSTALLATION_ID_KEY, installationId);
    }
    if (!appInfo.isVendorJetBrains()) {
        return installationId;
    }
    // for Windows attempt to use PermanentUserId, so that DotNet products and IDEA would use the same ID.
    if (SystemInfo.isWindows) {
        final String appdata = System.getenv("APPDATA");
        if (appdata != null) {
            final File dir = new File(appdata, "JetBrains");
            if (dir.exists() || dir.mkdirs()) {
                final File permanentIdFile = new File(dir, "PermanentUserId");
                try {
                    String fromFile = "";
                    if (permanentIdFile.exists()) {
                        fromFile = loadFromFile(permanentIdFile).trim();
                    }
                    if (!fromFile.isEmpty()) {
                        if (!fromFile.equals(installationId)) {
                            installationId = fromFile;
                            prefs.put(INSTALLATION_ID_KEY, installationId);
                        }
                    } else {
                        writeToFile(permanentIdFile, installationId);
                    }
                } catch (IOException ignored) {
                }
            }
        }
    }
    // make sure values in older location and in the new location are the same
    if (!installationId.equals(oldValue)) {
        oldPrefs.put(OLD_USER_ON_MACHINE_ID_KEY, installationId);
    }
    return installationId;
}
Also used : ApplicationInfoEx(com.intellij.openapi.application.ex.ApplicationInfoEx) Preferences(java.util.prefs.Preferences)

Example 4 with ApplicationInfoEx

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

the class SendFeedbackAction method launchBrowser.

public static void launchBrowser(@Nullable Project project) {
    final ApplicationInfoEx appInfo = ApplicationInfoEx.getInstanceEx();
    boolean eap = appInfo.isEAP();
    String urlTemplate = eap ? appInfo.getEAPFeedbackUrl() : appInfo.getReleaseFeedbackUrl();
    urlTemplate = urlTemplate.replace("$BUILD", eap ? appInfo.getBuild().asStringWithoutProductCode() : appInfo.getBuild().asString()).replace("$TIMEZONE", System.getProperty("user.timezone")).replace("$EVAL", isEvaluationLicense() ? "true" : "false").replace("$DESCR", getDescription());
    BrowserUtil.browse(urlTemplate, project);
}
Also used : ApplicationInfoEx(com.intellij.openapi.application.ex.ApplicationInfoEx)

Example 5 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)

Aggregations

ApplicationInfoEx (com.intellij.openapi.application.ex.ApplicationInfoEx)21 ApplicationNamesInfo (com.intellij.openapi.application.ApplicationNamesInfo)4 NotNull (org.jetbrains.annotations.NotNull)4 IdeaPluginDescriptor (com.intellij.ide.plugins.IdeaPluginDescriptor)3 UpdateSettings (com.intellij.openapi.updateSettings.impl.UpdateSettings)3 IOException (java.io.IOException)3 DataContext (com.intellij.openapi.actionSystem.DataContext)2 Application (com.intellij.openapi.application.Application)2 Attachment (com.intellij.openapi.diagnostic.Attachment)2 SubmittedReportInfo (com.intellij.openapi.diagnostic.SubmittedReportInfo)2 EmptyProgressIndicator (com.intellij.openapi.progress.EmptyProgressIndicator)2 Project (com.intellij.openapi.project.Project)2 BuildNumber (com.intellij.openapi.util.BuildNumber)2 Consumer (com.intellij.util.Consumer)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