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


Java StorageScheme.DIRECTORY_BASED属性代码示例

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


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

示例1: isSameProject

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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ProjectUtil.java

示例2: ConversionContextImpl

public ConversionContextImpl(String projectPath) throws CannotConvertException {
  myProjectFile = new File(projectPath);

  File modulesFile;
  if (myProjectFile.isDirectory()) {
    myStorageScheme = StorageScheme.DIRECTORY_BASED;
    myProjectBaseDir = myProjectFile;
    mySettingsBaseDir = new File(myProjectBaseDir.getAbsolutePath(), Project.DIRECTORY_STORE_FOLDER);
    modulesFile = new File(mySettingsBaseDir, "modules.xml");
    myWorkspaceFile = new File(mySettingsBaseDir, "workspace.xml");
  }
  else {
    myStorageScheme = StorageScheme.DEFAULT;
    myProjectBaseDir = myProjectFile.getParentFile();
    modulesFile = myProjectFile;
    myWorkspaceFile = new File(StringUtil.trimEnd(projectPath, ProjectFileType.DOT_DEFAULT_EXTENSION) + WorkspaceFileType.DOT_DEFAULT_EXTENSION);
  }

  myModuleFiles = modulesFile.exists() ? findModuleFiles(JDomConvertingUtil.loadDocument(modulesFile).getRootElement()) : new File[0];
  myPerformedConversionIds = loadPerformedConversionIds();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ConversionContextImpl.java

示例3: isSameProject

private static boolean isSameProject(String path, Project p) {
  final IProjectStore projectStore = ((ProjectEx)p).getStateStore();

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

  final VirtualFile existingBaseDir = projectStore.getProjectBaseDir();
  if (existingBaseDir == null) return false; // could be null if not yet initialized

  final File openFile = new File(toOpen);
  if (openFile.isDirectory()) {
    return FileUtil.pathsEqual(toOpen, existingBaseDir.getPath());
  }
  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.getPath());
  }

  return FileUtil.pathsEqual(toOpen, existing);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:ProjectUtil.java

示例4: doCreate

private static void doCreate(@NotNull AddModuleWizard wizard) throws IOException {
  // TODO: Now we need to add as module if file does not exist
  ProjectBuilder projectBuilder = wizard.getProjectBuilder();

  try {
    File projectFilePath = new File(wizard.getNewProjectFilePath());
    File projectDirPath = projectFilePath.isDirectory() ? projectFilePath : projectFilePath.getParentFile();
    LOG.assertTrue(projectDirPath != null, "Cannot create project in '" + projectFilePath + "': no parent file exists");
    ensureExists(projectDirPath);

    if (StorageScheme.DIRECTORY_BASED == wizard.getStorageScheme()) {
      File ideaDirPath = new File(projectDirPath, DIRECTORY_STORE_FOLDER);
      ensureExists(ideaDirPath);
    }

    boolean unitTestMode = ApplicationManager.getApplication().isUnitTestMode();
    ProjectManagerEx projectManager = ProjectManagerEx.getInstanceEx();
    Project project = projectManager.newProject(wizard.getProjectName(), projectDirPath.getPath(), true, false);
    if (project == null) {
      return;
    }
    if (!unitTestMode) {
      project.save();
    }
    if (projectBuilder != null) {
      if (!projectBuilder.validate(null, project)) {
        return;
      }
      projectBuilder.commit(project, null, EMPTY_MODULES_PROVIDER);
    }
    if (!unitTestMode) {
      project.save();
    }
  }
  finally {
    if (projectBuilder != null) {
      projectBuilder.cleanup();
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:AndroidImportProjectAction.java

示例5: getLocationHash

@NotNull
@NonNls
@Override
public String getLocationHash() {
  String str = getPresentableUrl();
  if (str == null) str = getName();

  final String prefix = getStateStore().getStorageScheme() == StorageScheme.DIRECTORY_BASED ? "" : getName();
  return prefix + Integer.toHexString(str.hashCode());
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:ProjectImpl.java

示例6: update

@Override
public void update(AnActionEvent e) {
  final Presentation presentation = e.getPresentation();

  final Project project = PlatformDataKeys.PROJECT.getData(e.getDataContext());
  boolean visible = project != null;

  if (project instanceof ProjectEx) {
    visible = ((ProjectEx)project).getStateStore().getStorageScheme() != StorageScheme.DIRECTORY_BASED;
  }

  presentation.setVisible(visible);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:SaveAsDirectoryBasedFormatAction.java

示例7: updateData

public void updateData(WizardContext context) {
  StorageScheme format =
    FILE_BASED.equals(myStorageFormatCombo.getSelectedItem()) ? StorageScheme.DEFAULT : StorageScheme.DIRECTORY_BASED;
  context.setProjectStorageFormat(format);
  setDefaultFormat(isDefault());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:ProjectFormatPanel.java


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