当前位置: 首页>>代码示例>>Java>>正文


Java ProjectManager.getOpenProjects方法代码示例

本文整理汇总了Java中com.intellij.openapi.project.ProjectManager.getOpenProjects方法的典型用法代码示例。如果您正苦于以下问题:Java ProjectManager.getOpenProjects方法的具体用法?Java ProjectManager.getOpenProjects怎么用?Java ProjectManager.getOpenProjects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.project.ProjectManager的用法示例。


在下文中一共展示了ProjectManager.getOpenProjects方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findProject

import com.intellij.openapi.project.ProjectManager; //导入方法依赖的package包/类
@Nullable
public Project findProject() {
  final ProjectManager projectManager = ProjectManager.getInstance();
  for (Project project : projectManager.getOpenProjects()) {
    if (myProjectId.equals(getProjectId(project))) return project;
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ExternalSystemTaskId.java

示例2: findProject

import com.intellij.openapi.project.ProjectManager; //导入方法依赖的package包/类
@NotNull
private static Project findProject(@NotNull IntegrationKey key) {
  final ProjectManager projectManager = ProjectManager.getInstance();
  for (Project project : projectManager.getOpenProjects()) {
    if (key.getIdeProjectName().equals(project.getName()) && key.getIdeProjectLocationHash().equals(project.getLocationHash())) {
      return project;
    }
  }
  return projectManager.getDefaultProject();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ExternalSystemFacadeManager.java

示例3: guessProjectForFile

import com.intellij.openapi.project.ProjectManager; //导入方法依赖的package包/类
@Nullable
public Project guessProjectForFile(final VirtualFile file) {
  ProjectManager projectManager = ProjectManager.getInstance();
  if (projectManager == null) return null;

  final Project[] projects = projectManager.getOpenProjects();
  if (projects.length == 1) {
    return !projects[0].isDisposed() ? projects[0] : null;
  }
  else {
    return null;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:DefaultProjectLocator.java

示例4: getProjectsForFile

import com.intellij.openapi.project.ProjectManager; //导入方法依赖的package包/类
@NotNull
@Override
public Collection<Project> getProjectsForFile(VirtualFile file) {
  final ProjectManager projectManager = ProjectManager.getInstance();
  if (projectManager == null || file == null) { return new HashSet<Project>(); }
  final Project[] openProjects = projectManager.getOpenProjects();
  return Arrays.asList(openProjects);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:DefaultProjectLocator.java

示例5: findAnyGradleHome

import com.intellij.openapi.project.ProjectManager; //导入方法依赖的package包/类
@Nullable
public static File findAnyGradleHome(boolean interactive) {
  // Try cheapest option first:
  String lastUsedGradleHome = getLastUsedGradleHome();
  if (!lastUsedGradleHome.isEmpty()) {
    File path = new File(lastUsedGradleHome);
    if (isValidGradleHome(path)) {
      return path;
    }
  }

  ProjectManager projectManager = ProjectManager.getInstance();
  for (Project project : projectManager.getOpenProjects()) {
    File gradleHome = findGradleHome(project);
    if (gradleHome != null) {
      return gradleHome;
    }
  }

  if (interactive) {
    ChooseGradleHomeDialog chooseGradleHomeDialog = new ChooseGradleHomeDialog();
    chooseGradleHomeDialog.setTitle("Choose Gradle Installation");
    String description = "A Gradle installation is necessary to stop all daemons.\n" +
                         "Please select the home directory of a Gradle installation, otherwise the project won't be closed.";
    chooseGradleHomeDialog.setDescription(description);
    if (!chooseGradleHomeDialog.showAndGet()) {
      return null;
    }
    String enteredPath = chooseGradleHomeDialog.getEnteredGradleHomePath();
    File gradleHomePath = new File(enteredPath);
    if (isValidGradleHome(gradleHomePath)) {
      chooseGradleHomeDialog.storeLastUsedGradleHomePath();
      return gradleHomePath;
    }
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:GradleUtil.java

示例6: noProjectsAreOpen

import com.intellij.openapi.project.ProjectManager; //导入方法依赖的package包/类
private boolean noProjectsAreOpen() {
    logger.info("Checking that at least one project is open.");
    ProjectManager projectManager = ProjectManager.getInstance();
    Project[] openProjects = projectManager.getOpenProjects();
    return openProjects.length == 0;
}
 
开发者ID:testmycode,项目名称:tmc-intellij,代码行数:7,代码来源:ProjectExecutor.java


注:本文中的com.intellij.openapi.project.ProjectManager.getOpenProjects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。