本文整理汇总了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);
}
示例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();
}
示例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);
}
示例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();
}
}
}
示例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());
}
示例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);
}
示例7: updateData
public void updateData(WizardContext context) {
StorageScheme format =
FILE_BASED.equals(myStorageFormatCombo.getSelectedItem()) ? StorageScheme.DEFAULT : StorageScheme.DIRECTORY_BASED;
context.setProjectStorageFormat(format);
setDefaultFormat(isDefault());
}