本文整理汇总了Java中com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile方法的典型用法代码示例。如果您正苦于以下问题:Java VfsUtilCore.virtualToIoFile方法的具体用法?Java VfsUtilCore.virtualToIoFile怎么用?Java VfsUtilCore.virtualToIoFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.vfs.VfsUtilCore
的用法示例。
在下文中一共展示了VfsUtilCore.virtualToIoFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveCustomDirectoryLocation
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
private void saveCustomDirectoryLocation(final Project project) {
final HybrisProjectSettings hybrisProjectSettings = HybrisProjectSettingsComponent.getInstance(project)
.getState();
final File customDirectory = hybrisProjectDescriptor.getExternalExtensionsDirectory();
final File hybrisDirectory = hybrisProjectDescriptor.getHybrisDistributionDirectory();
final File baseDirectory = VfsUtilCore.virtualToIoFile(project.getBaseDir());
final Path projectPath = Paths.get(baseDirectory.getAbsolutePath());
final Path hybrisPath = Paths.get(hybrisDirectory.getAbsolutePath());
final Path relativeHybrisPath = projectPath.relativize(hybrisPath);
hybrisProjectSettings.setHybrisDirectory(relativeHybrisPath.toString());
if (customDirectory != null) {
final Path customPath = Paths.get(customDirectory.getAbsolutePath());
final Path relativeCustomPath = hybrisPath.relativize(customPath);
hybrisProjectSettings.setCustomDirectory(relativeCustomPath.toString());
}
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:17,代码来源:ImportProjectProgressModalWindow.java
示例2: getState
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
@Nullable
@Override
public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment environment) throws ExecutionException {
if (!myImported) {
myImported = true;
return new ImportedTestRunnableState(this, VfsUtilCore.virtualToIoFile(myFile));
}
if (myConfiguration != null) {
try {
return myConfiguration.getState(executor, environment);
}
catch (Throwable e) {
if (myTargetId != null && getTarget() == null) {
throw new ExecutionException("The target " + myTargetId + " does not exist");
}
LOG.info(e);
throw new ExecutionException("Unable to run the configuration: settings are corrupted");
}
}
throw new ExecutionException("Unable to run the configuration: failed to detect test framework");
}
示例3: testCopyFormsRuntimeToArtifact
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
public void testCopyFormsRuntimeToArtifact() throws IOException {
VirtualFile file = createFile("src/A.java", "class A{}");
VirtualFile srcRoot = file.getParent();
Module module = addModule("a", srcRoot);
Artifact a = addArtifact(root().module(module));
make(a);
assertOutput(a, fs().file("A.class"));
File dir = PathManagerEx.findFileUnderCommunityHome("plugins/ui-designer/testData/build/copyFormsRuntimeToArtifact");
FileUtil.copyDir(dir, VfsUtilCore.virtualToIoFile(srcRoot));
srcRoot.refresh(false, false);
make(a);
File outputDir = VfsUtilCore.virtualToIoFile(getOutputDir(a));
assertTrue(new File(outputDir, "A.class").exists());
assertTrue(new File(outputDir, "B.class").exists());
assertTrue(new File(outputDir, AbstractLayout.class.getName().replace('.', '/') + ".class").exists());
}
示例4: getWorkspaceSourceSetsWithTargetDirectory
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
/**
* If we have a target directory but no resource module, we'll assume the res dir is just
* target/res.
*/
@Test
public void getWorkspaceSourceSetsWithTargetDirectory() {
AndroidFacet facet = mockWorkspaceFacet();
File rootFile = VfsUtilCore.virtualToIoFile(root);
File targetFile = VfsUtilCore.virtualToIoFile(target);
List<AndroidSourceSet> sourceSets = AndroidSourceSet.getSourceSets(facet, target);
assertThat(sourceSets).hasSize(1);
AndroidSourceSet sourceSet = sourceSets.get(0);
AndroidProjectPaths paths = sourceSet.getPaths();
assertThat(sourceSet.getName()).isEqualTo("com.google.target");
assertThat(paths.getModuleRoot()).isEqualTo(rootFile);
assertThat(paths.getSrcDirectory(null)).isEqualTo(targetFile);
assertThat(paths.getTestDirectory(null)).isEqualTo(targetFile);
assertThat(paths.getResDirectory()).isEqualTo(new File(targetFile, "res"));
assertThat(paths.getAidlDirectory(null)).isEqualTo(targetFile);
assertThat(paths.getManifestDirectory()).isEqualTo(targetFile);
}
示例5: createDirs
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
/**
* @return path to the project
*/
private void createDirs(@NotNull Collection<String> mockRoots) throws IOException {
File baseDir;
if (mockRoots.isEmpty()) {
return;
}
baseDir = VfsUtilCore.virtualToIoFile(myProject.getBaseDir());
int maxDepth = findMaxDepthAboveProject(mockRoots);
File projectDir = createChild(baseDir, maxDepth - 1);
cd(projectDir.getPath());
for (String path : mockRoots) {
File file = new File(projectDir, path);
file.mkdirs();
File mockDir = new File(file, DOT_MOCK);
mockDir.mkdirs();
myFilesToDelete.add(mockDir);
mockDir.deleteOnExit();
LocalFileSystem.getInstance().refreshAndFindFileByIoFile(mockDir);
}
}
示例6: createFileContent
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
public ContentRevision createFileContent(VcsRevisionNumber revisionNumber, VirtualFile file) {
if (file == null) {
return null;
}
VirtualFile vcsRoot = VcsUtil.getVcsRootFor(project, file);
if (vcsRoot == null) {
return null;
}
HgRevisionNumber hgRevisionNumber = (HgRevisionNumber) revisionNumber;
if (hgRevisionNumber.isWorkingVersion()) {
throw new IllegalStateException("Should not compare against working copy");
}
HgFile hgFile = new HgFile(vcsRoot, VfsUtilCore.virtualToIoFile(file));
return HgContentRevision.create(project, hgFile, hgRevisionNumber);
}
示例7: getResourceSourceSetsWithTargetDirectory
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
/**
* If we have a resource module and a target directory, then we can get the res dir from the
* module, and use the target directory for everything else.
*/
@Test
public void getResourceSourceSetsWithTargetDirectory() {
AndroidFacet facet = mockResourceFacet();
File resourceFile = VfsUtilCore.virtualToIoFile(resource);
File targetFile = VfsUtilCore.virtualToIoFile(target);
List<AndroidSourceSet> sourceSets = AndroidSourceSet.getSourceSets(facet, target);
assertThat(sourceSets).hasSize(1);
AndroidSourceSet sourceSet = sourceSets.get(0);
AndroidProjectPaths paths = sourceSet.getPaths();
assertThat(sourceSet.getName()).isEqualTo("com.google.target");
assertThat(paths.getModuleRoot()).isEqualTo(resourceFile);
assertThat(paths.getSrcDirectory(null)).isEqualTo(targetFile);
assertThat(paths.getTestDirectory(null)).isEqualTo(targetFile);
assertThat(paths.getResDirectory()).isEqualTo(new File(resourceFile, "res"));
assertThat(paths.getAidlDirectory(null)).isEqualTo(targetFile);
assertThat(paths.getManifestDirectory()).isEqualTo(targetFile);
}
示例8: estimateIsCustomExtension
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
protected static boolean estimateIsCustomExtension(@NotNull final VirtualFile file) {
final File itemsfile = VfsUtilCore.virtualToIoFile(file);
final String itemsfilePath = normalize(itemsfile.getAbsolutePath());
if (itemsfilePath.contains(normalize(HybrisConstants.HYBRIS_OOTB_MODULE_PREFIX))) {
return false;
}
if (itemsfilePath.contains(normalize(HybrisConstants.PLATFORM_EXT_MODULE_PREFIX))) {
return false;
}
return true;
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:13,代码来源:TypeSystemValidationUtils.java
示例9: getCustomWidgetsJarUrl
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
/**
* Returns the URL for the theme editor custom widgets jar
*/
@Nullable
public static URL getCustomWidgetsJarUrl() {
String homePath = FileUtil.toSystemIndependentName(PathManager.getHomePath());
StringBuilder notFoundPaths = new StringBuilder();
for (String path : CUSTOM_WIDGETS_JAR_PATHS) {
String jarPath = homePath + path;
VirtualFile root = LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(jarPath));
if (root != null) {
File rootFile = VfsUtilCore.virtualToIoFile(root);
if (rootFile.exists()) {
try {
LOG.debug("Theme editor custom widgets found at " + jarPath);
return rootFile.toURI().toURL();
}
catch (MalformedURLException e) {
LOG.error(e);
}
}
}
else {
notFoundPaths.append(jarPath).append('\n');
}
}
LOG.error("Unable to find theme-editor-widgets.jar in paths:\n" + notFoundPaths.toString());
return null;
}
示例10: testAddModuleWithNondefaultLocationWithinProject
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
/**
* Module should be imported and its locations should be set to path relative to parent project root.
*/
public void testAddModuleWithNondefaultLocationWithinProject() throws IOException {
final String modulePath = "directory/module";
final GradleSettingsFile file = getSimpleTestFile();
File moduleLocation = new File(VfsUtilCore.virtualToIoFile(file.getFile().getParent()), modulePath);
assertModuleWithNonDefaultLocation(file, ":mymodule", modulePath, moduleLocation);
}
示例11: getMergeHead
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
/**
* @param root the vcs root
* @return the path to merge head file
*/
@Nullable
private static File getMergeHead(@NotNull VirtualFile root) {
File gitDir = new File(VfsUtilCore.virtualToIoFile(root), GitUtil.DOT_GIT);
File f = new File(gitDir, GitRepositoryFiles.MERGE_HEAD);
if (f.exists()) {
return f;
}
return null;
}
示例12: getTemplateRootFolder
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
/**
* @return the root folder containing templates
*/
@Nullable
public static File getTemplateRootFolder() {
String homePath = FileUtil.toSystemIndependentName(PathManager.getHomePath());
// Release build?
VirtualFile root = LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(homePath + BUNDLED_TEMPLATE_PATH));
if (root == null) {
// Development build?
for (String path : DEVELOPMENT_TEMPLATE_PATHS) {
root = LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(homePath + path));
if (root != null) {
break;
}
}
}
if (root != null) {
File rootFile = VfsUtilCore.virtualToIoFile(root);
if (templateRootIsValid(rootFile)) {
return rootFile;
}
}
// Fall back to SDK template root
AndroidSdkData sdkData = AndroidSdkUtils.tryToChooseAndroidSdk();
if (sdkData != null) {
File location = sdkData.getLocation();
File folder = new File(location, FD_TOOLS + File.separator + FD_TEMPLATES);
if (folder.isDirectory()) {
return folder;
}
}
return null;
}
示例13: showNotificationForUnlinkedGradleProject
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
private static void showNotificationForUnlinkedGradleProject(@NotNull final Project project) {
if (!PropertiesComponent.getInstance(project).getBoolean(SHOW_UNLINKED_GRADLE_POPUP, true)
|| !GradleSettings.getInstance(project).getLinkedProjectsSettings().isEmpty()
|| project.getUserData(ExternalSystemDataKeys.NEWLY_IMPORTED_PROJECT) == Boolean.TRUE
|| project.getBaseDir() == null) {
return;
}
File baseDir = VfsUtilCore.virtualToIoFile(project.getBaseDir());
final File gradleFile = new File(baseDir, GradleConstants.DEFAULT_SCRIPT_NAME);
if (gradleFile.exists()) {
String message = String.format("%s<br>\n%s",
GradleBundle.message("gradle.notifications.unlinked.project.found.msg", IMPORT_EVENT_DESCRIPTION),
GradleBundle.message("gradle.notifications.do.not.show"));
GradleNotification.getInstance(project).showBalloon(
GradleBundle.message("gradle.notifications.unlinked.project.found.title"),
message, NotificationType.INFORMATION, new NotificationListener.Adapter() {
@Override
protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
notification.expire();
if (IMPORT_EVENT_DESCRIPTION.equals(e.getDescription())) {
final ProjectDataManager projectDataManager = ServiceManager.getService(ProjectDataManager.class);
GradleProjectImportBuilder gradleProjectImportBuilder = new GradleProjectImportBuilder(projectDataManager);
final GradleProjectImportProvider gradleProjectImportProvider = new GradleProjectImportProvider(gradleProjectImportBuilder);
AddModuleWizard wizard = new AddModuleWizard(null, gradleFile.getPath(), gradleProjectImportProvider);
if ((wizard.getStepCount() <= 0 || wizard.showAndGet())) {
ImportModuleAction.createFromWizard(project, wizard);
}
}
else if (DO_NOT_SHOW_EVENT_DESCRIPTION.equals(e.getDescription())) {
PropertiesComponent.getInstance(project).setValue(SHOW_UNLINKED_GRADLE_POPUP, false, true);
}
}
}
);
}
}
示例14: test
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
public void test() throws Exception {
@SuppressWarnings("SpellCheckingInspection")
VirtualFile virtualFile = myFixture.copyFileToProject("xmlpull/designtime.xml", "res/layout/designtime.xml");
assertNotNull(virtualFile);
File file = VfsUtilCore.virtualToIoFile(virtualFile);
LayoutlibCallback callback = new DummyCallback();
LayoutFilePullParser parser = LayoutFilePullParser.create(callback, file);
assertEquals(START_TAG, parser.nextTag());
assertEquals("LinearLayout", parser.getName());
assertEquals(START_TAG, parser.nextTag());
assertEquals("TextView", parser.getName());
assertEquals("@+id/first", parser.getAttributeValue(ANDROID_URI, ATTR_ID));
assertEquals(END_TAG, parser.nextTag());
assertEquals(START_TAG, parser.nextTag());
assertEquals("TextView", parser.getName());
assertEquals("fill_parent", parser.getAttributeValue(ANDROID_URI, ATTR_LAYOUT_WIDTH)); // auto converted from match_parent
assertEquals("wrap_content", parser.getAttributeValue(ANDROID_URI, ATTR_LAYOUT_HEIGHT));
assertEquals("Designtime Text", parser.getAttributeValue(ANDROID_URI, ATTR_TEXT)); // overriding runtime text attribute
assertEquals("@android:color/darker_gray", parser.getAttributeValue(ANDROID_URI, "textColor"));
assertEquals(END_TAG, parser.nextTag());
assertEquals(START_TAG, parser.nextTag());
assertEquals("TextView", parser.getName());
assertEquals("@+id/blank", parser.getAttributeValue(ANDROID_URI, ATTR_ID));
assertEquals("", parser.getAttributeValue(ANDROID_URI, ATTR_TEXT)); // Don't unset when no framework attribute is defined
assertEquals(END_TAG, parser.nextTag());
assertEquals(START_TAG, parser.nextTag());
assertEquals("ListView", parser.getName());
assertEquals("@+id/listView", parser.getAttributeValue(ANDROID_URI, ATTR_ID));
assertNull(parser.getAttributeValue(ANDROID_URI, "fastScrollAlwaysVisible")); // Cleared by overriding defined framework attribute
}
示例15: runInfo
import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
@NotNull
private CommandExecutor runInfo() throws SvnBindException {
SvnVcs vcs = SvnVcs.getInstance(myProject);
File workingDirectory = VfsUtilCore.virtualToIoFile(myWorkingCopyDir);
Command command = new Command(SvnCommandName.info);
command.setTarget(SvnTarget.fromFile(workingDirectory));
command.setWorkingDirectory(workingDirectory);
command.put("--xml");
CommandRuntime runtime = new CommandRuntime(vcs, new AuthenticationService(vcs, true));
return runtime.runWithAuthenticationAttempt(command);
}