use of com.intellij.openapi.application.ApplicationInfo 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"));
}
use of com.intellij.openapi.application.ApplicationInfo in project intellij-community by JetBrains.
the class NamePathComponent method validateNameAndPath.
public boolean validateNameAndPath(WizardContext context, boolean defaultFormat) throws ConfigurationException {
String name = getNameValue();
if (StringUtil.isEmptyOrSpaces(name)) {
ApplicationInfo info = ApplicationInfo.getInstance();
throw new ConfigurationException(IdeBundle.message("prompt.new.project.file.name", info.getVersionName(), context.getPresentationName()));
}
String projectDirectory = getPath();
if (StringUtil.isEmptyOrSpaces(projectDirectory)) {
throw new ConfigurationException(IdeBundle.message("prompt.enter.project.file.location", context.getPresentationName()));
}
if (myShouldBeAbsolute && !new File(projectDirectory).isAbsolute()) {
throw new ConfigurationException(StringUtil.capitalize(IdeBundle.message("file.location.should.be.absolute", context.getPresentationName())));
}
boolean shouldPromptCreation = isPathChangedByUser();
String message = IdeBundle.message("directory.project.file.directory", context.getPresentationName());
if (!ProjectWizardUtil.createDirectoryIfNotExists(message, projectDirectory, shouldPromptCreation)) {
return false;
}
File file = new File(projectDirectory);
if (file.exists() && !file.canWrite()) {
throw new ConfigurationException(String.format("Directory '%s' is not seem to be writable. Please consider another location.", projectDirectory));
}
for (Project p : ProjectManager.getInstance().getOpenProjects()) {
if (ProjectUtil.isSameProject(projectDirectory, p)) {
throw new ConfigurationException(String.format("Directory '%s' is already taken by the project '%s'. Please consider another location.", projectDirectory, p.getName()));
}
}
boolean shouldContinue = true;
String fileName = defaultFormat ? name + ProjectFileType.DOT_DEFAULT_EXTENSION : Project.DIRECTORY_STORE_FOLDER;
File projectFile = new File(file, fileName);
if (projectFile.exists()) {
message = IdeBundle.message("prompt.overwrite.project.file", projectFile.getAbsolutePath(), context.getPresentationName());
int answer = Messages.showYesNoDialog(message, IdeBundle.message("title.file.already.exists"), Messages.getQuestionIcon());
shouldContinue = (answer == Messages.YES);
}
return shouldContinue;
}
use of com.intellij.openapi.application.ApplicationInfo in project android by JetBrains.
the class IdeVersionReaderTest method testGetComponentName.
public void testGetComponentName() {
ApplicationInfo applicationInfo = replaceApplicationInfo();
String name = "Android Studio";
when(applicationInfo.getVersionName()).thenReturn(name);
assertEquals(name, myVersionReader.getComponentName());
verify(applicationInfo).getVersionName();
}
use of com.intellij.openapi.application.ApplicationInfo in project android by JetBrains.
the class IdeVersionReaderTest method testGetComponentVersion.
public void testGetComponentVersion() {
ApplicationInfo applicationInfo = replaceApplicationInfo();
String version = "2.0";
when(applicationInfo.getStrictVersion()).thenReturn(version);
assertEquals(version, myVersionReader.getComponentVersion(mock(Module.class)));
verify(applicationInfo).getStrictVersion();
}
use of com.intellij.openapi.application.ApplicationInfo in project android by JetBrains.
the class StringResourceViewPanel method hyperlinkUpdate.
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
StringBuilder sb = new StringBuilder("https://translate.google.com/manager/android_studio/");
// Application Version
sb.append("?asVer=");
ApplicationInfo ideInfo = ApplicationInfo.getInstance();
// @formatter:off
sb.append(ideInfo.getMajorVersion()).append('.').append(ideInfo.getMinorVersion()).append('.').append(ideInfo.getMicroVersion()).append('.').append(ideInfo.getPatchVersion());
// @formatter:on
// Package name
MergedManifest manifest = MergedManifest.get(myFacet);
String pkg = manifest.getPackage();
if (pkg != null) {
sb.append("&pkgName=");
sb.append(pkg.replace('.', '_'));
}
// Application ID
AndroidModuleInfo moduleInfo = AndroidModuleInfo.get(myFacet);
String appId = moduleInfo.getPackage();
if (appId != null) {
sb.append("&appId=");
sb.append(appId.replace('.', '_'));
}
// Version code
Integer versionCode = manifest.getVersionCode();
if (versionCode != null) {
sb.append("&apkVer=");
sb.append(versionCode.toString());
}
// If we support additional IDE languages, we can send the language used in the IDE here
//sb.append("&lang=en");
BrowserUtil.browse(sb.toString());
}
Aggregations