use of com.intellij.openapi.application.ApplicationInfo in project flutter-intellij by flutter.
the class FlutterStudioProjectOpenProcessor method canOpenProject.
@Override
public boolean canOpenProject(@Nullable VirtualFile file) {
if (file == null)
return false;
ApplicationInfo info = ApplicationInfo.getInstance();
final PubRoot root = PubRoot.forDirectory(file);
return root != null && root.declaresFlutter();
}
use of com.intellij.openapi.application.ApplicationInfo in project flutter-intellij by flutter.
the class DeviceService method daemonStopped.
private void daemonStopped(String details) {
if (project.isDisposed())
return;
final DeviceDaemon current = deviceDaemon.getNow();
if (current == null || current.isRunning()) {
// The active daemon didn't die, so it must be some older process. Just log it.
LOG.info("A Flutter device daemon stopped.\n" + details);
return;
}
// If we haven't tried restarting recently, try again.
final long now = System.currentTimeMillis();
final long millisSinceLastRestart = now - lastRestartTime.get();
if (millisSinceLastRestart > TimeUnit.SECONDS.toMillis(20)) {
LOG.info("A Flutter device daemon stopped. Automatically restarting it.\n" + details);
refreshDeviceDaemon();
lastRestartTime.set(now);
return;
}
// Display as a notification to the user.
final ApplicationInfo info = ApplicationInfo.getInstance();
FlutterMessages.showWarning("Flutter daemon terminated", "Consider re-starting " + info.getVersionName() + ".");
}
use of com.intellij.openapi.application.ApplicationInfo in project flutter-intellij by flutter.
the class FlutterProjectOpenProcessor method canOpenProject.
@Override
public boolean canOpenProject(@Nullable VirtualFile file) {
if (file == null)
return false;
ApplicationInfo info = ApplicationInfo.getInstance();
if (FlutterUtils.isAndroidStudio()) {
return false;
}
final PubRoot root = PubRoot.forDirectory(file);
return root != null && root.declaresFlutter();
}
use of com.intellij.openapi.application.ApplicationInfo in project liferay-ide by liferay.
the class LiferayNamePathComponent method validateNameAndPath.
public boolean validateNameAndPath(WizardContext context, boolean defaultFormat) throws ConfigurationException {
String name = getNameValue();
if (StringUtil.isEmptyOrSpaces(name)) {
ApplicationInfo applicationInfo = ApplicationInfo.getInstance();
throw new ConfigurationException(IdeBundle.message("prompt.new.project.file.name", applicationInfo.getVersionName(), context.getPresentationName()));
}
String projectDirectory = getPath();
if (StringUtil.isEmptyOrSpaces(projectDirectory)) {
throw new ConfigurationException(IdeBundle.message("prompt.enter.project.file.location", context.getPresentationName()));
}
if (_shouldBeAbsolute && !new File(projectDirectory).isAbsolute()) {
throw new ConfigurationException(StringUtil.capitalize(IdeBundle.message("file.location.should.be.absolute", context.getPresentationName())));
}
String message = IdeBundle.message("directory.project.file.directory", context.getPresentationName());
if (!ProjectWizardUtil.createDirectoryIfNotExists(message, projectDirectory, isPathChangedByUser())) {
return false;
}
File file = new File(projectDirectory);
if (file.exists() && !file.canWrite()) {
String msg = String.format("Directory '%s' is not seem to be writable. Please consider another location.", projectDirectory);
throw new ConfigurationException(msg);
}
ProjectManager projectManager = ProjectManager.getInstance();
for (Project project : projectManager.getOpenProjects()) {
if (ProjectUtil.isSameProject(projectDirectory, project)) {
String msg = String.format("Directory '%s' is already taken by the project '%s'. Please consider another location.", projectDirectory, project.getName());
throw new ConfigurationException(msg);
}
}
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 azure-tools-for-java by Microsoft.
the class QualtricsSurveyAction method getRequestUrl.
private String getRequestUrl() {
IdeaPluginDescriptor pluginDescriptor = PluginManager.getPlugin(PluginId.getId("com.microsoft.tooling.msservices.intellij.azure"));
ApplicationInfo applicationInfo = ApplicationInfo.getInstance();
String toolkit = pluginDescriptor.getVersion();
String ide = String.format("%s %s", applicationInfo.getFullVersion(), applicationInfo.getBuild());
String os = System.getProperty("os.name");
String jdk = String.format("%s %s", System.getProperty("java.vendor"), System.getProperty("java.version"));
String id = AppInsightsClient.getInstallationId();
return String.format(SURVEY_URL, toolkit, ide, os, jdk, id);
}
Aggregations