use of com.intellij.openapi.application.ApplicationInfo in project android by JetBrains.
the class GoogleCrash method createPost.
@NotNull
private HttpUriRequest createPost(@NotNull FlightRecorder flightRecorder, @NotNull String issueText, @NotNull List<Path> logFiles) {
HttpPost post = new HttpPost(myCrashUrl);
ApplicationInfo applicationInfo = getApplicationInfo();
String strictVersion = applicationInfo == null ? "0.0.0.0" : applicationInfo.getStrictVersion();
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
// key names recognized by crash
builder.addTextBody(KEY_PRODUCT_ID, "AndroidStudio");
builder.addTextBody(KEY_VERSION, strictVersion);
builder.addTextBody("exception_info", getUniqueStackTrace());
builder.addTextBody("user_report", issueText);
if (ANONYMIZED_UID != null) {
builder.addTextBody("guid", ANONYMIZED_UID);
}
RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean();
builder.addTextBody("ptime", Long.toString(runtimeMXBean.getUptime()));
// product specific key value pairs
builder.addTextBody("fullVersion", applicationInfo == null ? "0.0.0.0" : applicationInfo.getFullVersion());
builder.addTextBody("osName", StringUtil.notNullize(SystemInfo.OS_NAME));
builder.addTextBody("osVersion", StringUtil.notNullize(SystemInfo.OS_VERSION));
builder.addTextBody("osArch", StringUtil.notNullize(SystemInfo.OS_ARCH));
builder.addTextBody("locale", StringUtil.notNullize(LOCALE));
builder.addTextBody("vmName", StringUtil.notNullize(runtimeMXBean.getVmName()));
builder.addTextBody("vmVendor", StringUtil.notNullize(runtimeMXBean.getVmVendor()));
builder.addTextBody("vmVersion", StringUtil.notNullize(runtimeMXBean.getVmVersion()));
MemoryUsage usage = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
builder.addTextBody("heapUsed", Long.toString(usage.getUsed()));
builder.addTextBody("heapCommitted", Long.toString(usage.getCommitted()));
builder.addTextBody("heapMax", Long.toString(usage.getMax()));
// add report specific data
builder.addTextBody("Type", "InstantRunFlightRecorder");
addFlightRecorderLogs(builder, flightRecorder, logFiles);
post.setEntity(new GzipCompressingEntity(builder.build()));
return post;
}
use of com.intellij.openapi.application.ApplicationInfo in project android by JetBrains.
the class IdeVersionReaderTest method testAppliesToWithIdea.
public void testAppliesToWithIdea() {
ApplicationInfo applicationInfo = replaceApplicationInfo();
String name = "Idea";
when(applicationInfo.getVersionName()).thenReturn(name);
assertFalse(myVersionReader.appliesTo(mock(Module.class)));
}
use of com.intellij.openapi.application.ApplicationInfo in project android by JetBrains.
the class IdeVersionReaderTest method testAppliesToWithAndroidStudio.
public void testAppliesToWithAndroidStudio() {
ApplicationInfo applicationInfo = replaceApplicationInfo();
String name = "Android Studio";
when(applicationInfo.getVersionName()).thenReturn(name);
assertTrue(myVersionReader.appliesTo(mock(Module.class)));
}
use of com.intellij.openapi.application.ApplicationInfo in project intellij-community by JetBrains.
the class RegistryUi method processClose.
private void processClose() {
if (Registry.getInstance().isRestartNeeded()) {
final ApplicationEx app = (ApplicationEx) ApplicationManager.getApplication();
final ApplicationInfo info = ApplicationInfo.getInstance();
final int r = Messages.showOkCancelDialog(myContent, "You need to restart " + info.getVersionName() + " for the changes to take effect", "Restart Required", app.isRestartCapable() ? "Restart Now" : "Shutdown Now", app.isRestartCapable() ? "Restart Later" : "Shutdown Later", Messages.getQuestionIcon());
if (r == Messages.OK) {
ApplicationManager.getApplication().invokeLater(() -> app.restart(true), ModalityState.NON_MODAL);
}
}
}
use of com.intellij.openapi.application.ApplicationInfo in project intellij-community by JetBrains.
the class ProjectNameStep method validate.
public boolean validate() throws ConfigurationException {
String name = myNamePathComponent.getNameValue();
if (name.length() == 0) {
final ApplicationInfo info = ApplicationInfo.getInstance();
throw new ConfigurationException(IdeBundle.message("prompt.new.project.file.name", info.getVersionName(), myWizardContext.getPresentationName()));
}
final String projectFileDirectory = getProjectFileDirectory();
if (projectFileDirectory.length() == 0) {
throw new ConfigurationException(IdeBundle.message("prompt.enter.project.file.location", myWizardContext.getPresentationName()));
}
final boolean shouldPromptCreation = myNamePathComponent.isPathChangedByUser();
String prefix = IdeBundle.message("directory.project.file.directory", myWizardContext.getPresentationName());
if (!ProjectWizardUtil.createDirectoryIfNotExists(prefix, projectFileDirectory, shouldPromptCreation)) {
return false;
}
boolean shouldContinue = true;
final String path = myWizardContext.isCreatingNewProject() && myWizardContext.getProjectStorageFormat() == DIRECTORY_BASED ? getProjectFileDirectory() + "/" + Project.DIRECTORY_STORE_FOLDER : getProjectFilePath();
final File projectFile = new File(path);
if (projectFile.exists()) {
final String title = myWizardContext.isCreatingNewProject() ? IdeBundle.message("title.new.project") : IdeBundle.message("title.add.module");
final String message = myWizardContext.isCreatingNewProject() && myWizardContext.getProjectStorageFormat() == DIRECTORY_BASED ? IdeBundle.message("prompt.overwrite.project.folder", Project.DIRECTORY_STORE_FOLDER, projectFile.getParentFile().getAbsolutePath()) : IdeBundle.message("prompt.overwrite.project.file", projectFile.getAbsolutePath(), myWizardContext.getPresentationName());
int answer = Messages.showYesNoDialog(message, title, Messages.getQuestionIcon());
shouldContinue = answer == Messages.YES;
}
return shouldContinue;
}
Aggregations