Ejemplo n.º 1
0
 @Deprecated
 public IProjectHandler getProjectHandler(Project project) {
   MPSPlugin.assertNotInEDT();
   IProjectStore projectStore = ((ProjectEx) project).getStateStore();
   File mpsProject = project.getComponent(MPSProject.class).getProjectFile();
   File projectFile =
       (projectStore.getStorageScheme() == StorageScheme.DEFAULT
           ? mpsProject.getParentFile()
           : mpsProject);
   String projectPath = projectFile.getAbsolutePath();
   return getProjectHandler(projectPath);
 }
Ejemplo n.º 2
0
  private static boolean isSameProject(String path, @NotNull Project project) {
    IProjectStore projectStore = (IProjectStore) ServiceKt.getStateStore(project);

    String toOpen = FileUtil.toSystemIndependentName(path);
    String existing = projectStore.getProjectFilePath();

    String existingBaseDir = projectStore.getProjectBasePath();
    if (existingBaseDir == null) {
      // could be null if not yet initialized
      return false;
    }

    final File openFile = new File(toOpen);
    if (openFile.isDirectory()) {
      return FileUtil.pathsEqual(toOpen, existingBaseDir);
    }
    if (StorageScheme.DIRECTORY_BASED == projectStore.getStorageScheme()) {
      // todo: check if IPR is located not under the project base dir
      return FileUtil.pathsEqual(
          FileUtil.toSystemIndependentName(openFile.getParentFile().getPath()), existingBaseDir);
    }

    return FileUtil.pathsEqual(toOpen, existing);
  }