use of com.intellij.openapi.project.ProjectManager in project ideavim by JetBrains.
the class VimPlugin method showMessage.
public static void showMessage(@Nullable String msg) {
ProjectManager pm = ProjectManager.getInstance();
Project[] projects = pm.getOpenProjects();
for (Project project : projects) {
StatusBar bar = WindowManager.getInstance().getStatusBar(project);
if (bar != null) {
if (msg == null || msg.length() == 0) {
bar.setInfo("");
} else {
bar.setInfo("VIM - " + msg);
}
}
}
}
use of com.intellij.openapi.project.ProjectManager in project intellij-community by JetBrains.
the class DefaultProjectLocator method getProjectsForFile.
@NotNull
@Override
public Collection<Project> getProjectsForFile(VirtualFile file) {
final ProjectManager projectManager = ProjectManager.getInstance();
if (projectManager == null || file == null) {
return new HashSet<>();
}
final Project[] openProjects = projectManager.getOpenProjects();
return Arrays.asList(openProjects);
}
use of com.intellij.openapi.project.ProjectManager in project android by JetBrains.
the class IdeSdks method setJdkPath.
// Must run inside a WriteAction
public void setJdkPath(@NotNull File path) {
if (checkForJdk(path)) {
ApplicationManager.getApplication().assertWriteAccessAllowed();
File canonicalPath = resolvePath(path);
Sdk chosenJdk = null;
if (myIdeInfo.isAndroidStudio()) {
// Delete all JDKs in Android Studio. We want to have only one.
List<Sdk> jdks = ProjectJdkTable.getInstance().getSdksOfType(JavaSdk.getInstance());
for (final Sdk jdk : jdks) {
ProjectJdkTable.getInstance().removeJdk(jdk);
}
} else {
for (Sdk jdk : ProjectJdkTable.getInstance().getSdksOfType(JavaSdk.getInstance())) {
if (pathsEqual(jdk.getHomePath(), canonicalPath.getPath())) {
chosenJdk = jdk;
break;
}
}
}
if (chosenJdk == null) {
if (canonicalPath.isDirectory()) {
chosenJdk = createJdk(canonicalPath);
if (chosenJdk == null) {
// Unlikely to happen
throw new IllegalStateException("Failed to create IDEA JDK from '" + path.getPath() + "'");
}
updateAndroidSdks(chosenJdk);
ProjectManager projectManager = ApplicationManager.getApplication().getComponent(ProjectManager.class);
Project[] openProjects = projectManager.getOpenProjects();
for (Project project : openProjects) {
applyJdkToProject(project, chosenJdk);
}
} else {
throw new IllegalStateException("The resolved path '" + canonicalPath.getPath() + "' was not found");
}
}
}
}
use of com.intellij.openapi.project.ProjectManager in project android by JetBrains.
the class NewProjects method createProject.
@NotNull
public static Project createProject(@NotNull String projectName, @NotNull String projectPath) throws ConfigurationException {
ProjectManager projectManager = ProjectManager.getInstance();
Project newProject = projectManager.createProject(projectName, projectPath);
if (newProject == null) {
throw new NullPointerException("Failed to create a new IDEA project");
}
return newProject;
}
Aggregations