Search in sources :

Example 1 with ApplicationNamesInfo

use of com.intellij.openapi.application.ApplicationNamesInfo 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 2 with ApplicationNamesInfo

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

the class StartupUtil method startLogging.

private static void startLogging(final Logger log) {
    Runtime.getRuntime().addShutdownHook(new Thread("Shutdown hook - logging") {

        @Override
        public void run() {
            log.info("------------------------------------------------------ IDE SHUTDOWN ------------------------------------------------------");
        }
    });
    log.info("------------------------------------------------------ IDE STARTED ------------------------------------------------------");
    ApplicationInfo appInfo = ApplicationInfoImpl.getShadowInstance();
    ApplicationNamesInfo namesInfo = ApplicationNamesInfo.getInstance();
    String buildDate = new SimpleDateFormat("dd MMM yyyy HH:ss", Locale.US).format(appInfo.getBuildDate().getTime());
    log.info("IDE: " + namesInfo.getFullProductName() + " (build #" + appInfo.getBuild().asString() + ", " + buildDate + ")");
    log.info("OS: " + SystemInfoRt.OS_NAME + " (" + SystemInfoRt.OS_VERSION + ", " + SystemInfo.OS_ARCH + ")");
    log.info("JRE: " + System.getProperty("java.runtime.version", "-") + " (" + System.getProperty("java.vendor", "-") + ")");
    log.info("JVM: " + System.getProperty("java.vm.version", "-") + " (" + System.getProperty("java.vm.name", "-") + ")");
    List<String> arguments = ManagementFactory.getRuntimeMXBean().getInputArguments();
    if (arguments != null) {
        log.info("JVM Args: " + StringUtil.join(arguments, " "));
    }
    String extDirs = System.getProperty("java.ext.dirs");
    if (extDirs != null) {
        for (String dir : StringUtil.split(extDirs, File.pathSeparator)) {
            String[] content = new File(dir).list();
            if (content != null && content.length > 0) {
                log.info("ext: " + dir + ": " + Arrays.toString(content));
            }
        }
    }
    log.info("JNU charset: " + System.getProperty("sun.jnu.encoding"));
}
Also used : ApplicationInfo(com.intellij.openapi.application.ApplicationInfo) ApplicationNamesInfo(com.intellij.openapi.application.ApplicationNamesInfo) SimpleDateFormat(java.text.SimpleDateFormat) File(java.io.File)

Example 3 with ApplicationNamesInfo

use of com.intellij.openapi.application.ApplicationNamesInfo in project android by JetBrains.

the class PatchInstallerUtil method askAboutRestart.

/**
   * If a patch fails to install because Studio is locking some of the files, we have to restart studio. Ask if the user wants
   * to, and then move things into place so they can be picked up on restart.
   */
private static void askAboutRestart(@NotNull PatchRunner patchRunner, @NotNull PatchOperation op, @NotNull final File patchFile, @NotNull FileOp fop, @NotNull final ProgressIndicator progress) {
    final ApplicationEx application = ApplicationManagerEx.getApplicationEx();
    application.invokeLater(() -> {
        String[] options;
        ApplicationNamesInfo names = ApplicationNamesInfo.getInstance();
        boolean restartable = application.isRestartCapable();
        if (restartable) {
            options = new String[] { "Cancel", "Restart Later", "Restart Now" };
        } else {
            options = new String[] { "Cancel", String.format("Exit %s", names.getProductName()) };
        }
        String message;
        if (op.getExisting() != null) {
            message = String.format("%1$s is currently in use by %2$s and cannot be updated. Please restart to complete installation.", op.getExisting().getDisplayName(), names.getFullProductName());
        } else {
            message = String.format("Some files in the destination are currently in use by %1$s. Please restart to complete installation.", names.getFullProductName());
        }
        int result = Messages.showDialog((Project) null, message, "Restart Required", options, options.length - 1, AllIcons.General.QuestionDialog);
        if (result == 0) {
            progress.logInfo("Cancelled");
        } else {
            if (setupPatchDir(patchFile, patchRunner.getPatcherJar(), op.getPackage(), op.getRepoManager(), fop, progress)) {
                if (result == 1 && restartable) {
                    progress.logInfo("Installation will continue after restart");
                } else {
                    application.exit(true, true);
                }
            }
        }
    }, ModalityState.any());
}
Also used : ApplicationEx(com.intellij.openapi.application.ex.ApplicationEx) ApplicationNamesInfo(com.intellij.openapi.application.ApplicationNamesInfo)

Example 4 with ApplicationNamesInfo

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

the class ProjectCheckoutListener method getProductNameWithArticle.

static String getProductNameWithArticle() {
    final ApplicationNamesInfo namesInfo = ApplicationNamesInfo.getInstance();
    // example: "to create an IntelliJ IDEA project" (full product name is ok);
    // "to create a JetBrains Astella project" (better use not full product name: "to create an Astella project")
    final String productName = PlatformUtils.isIdeaUltimate() ? namesInfo.getFullProductName() : namesInfo.getProductName();
    final String article = StringUtil.isVowel(Character.toLowerCase(productName.charAt(0))) ? "an " : "a ";
    return article + productName;
}
Also used : ApplicationNamesInfo(com.intellij.openapi.application.ApplicationNamesInfo)

Example 5 with ApplicationNamesInfo

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

the class ITNProxy method createParameters.

@NotNull
private static Multimap<String, String> createParameters(String login, String password, @NotNull ErrorBean error) {
    Multimap<String, String> params = ArrayListMultimap.create(40, 1);
    params.put("protocol.version", "1");
    params.put("user.login", login);
    params.put("user.password", password);
    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.getApiVersion());
    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());
    BuildNumber build = appInfo.getBuild();
    String buildNumberWithAllDetails = build.asString();
    params.put("app.product.code", build.getProductCode());
    if (StringUtil.startsWith(buildNumberWithAllDetails, build.getProductCode() + "-")) {
        buildNumberWithAllDetails = buildNumberWithAllDetails.substring(build.getProductCode().length() + 1);
    }
    params.put("app.build.number", buildNumberWithAllDetails);
    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) BuildNumber(com.intellij.openapi.util.BuildNumber) 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) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ApplicationNamesInfo (com.intellij.openapi.application.ApplicationNamesInfo)5 Application (com.intellij.openapi.application.Application)2 ApplicationInfoEx (com.intellij.openapi.application.ex.ApplicationInfoEx)2 Attachment (com.intellij.openapi.diagnostic.Attachment)2 UpdateSettings (com.intellij.openapi.updateSettings.impl.UpdateSettings)2 ApplicationInfo (com.intellij.openapi.application.ApplicationInfo)1 ApplicationEx (com.intellij.openapi.application.ex.ApplicationEx)1 BuildNumber (com.intellij.openapi.util.BuildNumber)1 File (java.io.File)1 SimpleDateFormat (java.text.SimpleDateFormat)1 NotNull (org.jetbrains.annotations.NotNull)1