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


Java VirtualFile.getName方法代码示例

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


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

示例1: getIndexer

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
@NotNull
@Override
public DataIndexer<String, String, FileContent> getIndexer() {
    return virtualFile -> {
        final Map<String, String> items = new THashMap<>();

        VirtualFile file = virtualFile.getFile();
        VirtualFile parentDirectory = file.getParent();
        if (parentDirectory != null) {
            VirtualFile ancestorDirectory = parentDirectory.getParent();
            if (ancestorDirectory != null && ancestorDirectory.isDirectory()) {
                String ancestorDirectoryName = ancestorDirectory.getName();
                if (ancestorDirectoryName.equals("sysext") || ancestorDirectoryName.equals("ext")) {
                    String path = file.getPath();
                    items.put(parentDirectory.getName(), path);
                }

                // handle the case where the extension name can *not* be inferred from the directory name
            }
        }

        return items;
    };
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:25,代码来源:ExtensionNameStubIndex.java

示例2: findExtensionKeyFromFile

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
@Nullable
public static String findExtensionKeyFromFile(@NotNull VirtualFile file) {
    VirtualFile extensionRootFolder = FilesystemUtil.findExtensionRootFolder(file);
    if (extensionRootFolder == null) {
        return null;
    }

    String extensionKey = null;
    VirtualFile composerJsonFile = extensionRootFolder.findChild("composer.json");
    if (composerJsonFile != null) {
        String extensionKeyFromComposerJson = ComposerUtil.findExtensionKey(composerJsonFile);
        if (extensionKeyFromComposerJson == null) {
            extensionKey = extensionRootFolder.getName();
        } else {
            extensionKey = extensionKeyFromComposerJson;
        }
    } else {
        extensionKey = extensionRootFolder.getName();
    }

    return extensionKey;
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:23,代码来源:ExtensionUtility.java

示例3: processFile

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
@Override
public boolean processFile(final VirtualFile file) {
    final String fileName = file.getName();
    final String filePath = file.getPath();
    boolean isTarget = false;
    if(fileContent.isPython()){
        isTarget = !file.isDirectory() && !fileContent.contains(filePath);
    }else{
        isTarget = !file.isDirectory() && fileContent.contains(filePath);
    }

    if (isTarget && !this.fileContent.hasFile(fileName)) {
        fileContent.get().put(fileName, filePath);
        //System.out.println("include: " + fileName);
    }

    return true;
}
 
开发者ID:chakki-works,项目名称:watchMe,代码行数:19,代码来源:ProjectFileIterator.java

示例4: findMapFiles

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
@NotNull
private static Map<String, VirtualFile> findMapFiles(@NotNull VirtualFile baseDir,
                                                     @NotNull String filter,
                                                     @NotNull String path)
{
    Map<String, VirtualFile> files = new HashMap<>();
    if (!baseDir.isDirectory() || baseDir.getName().startsWith("."))
    {
        return files;
    }
    VirtualFile[] children = baseDir.getChildren();
    String currentPath = path.isEmpty() ? baseDir.getName() : path + "/" + baseDir.getName();
    for (VirtualFile child : children)
    {
        if (child.isDirectory())
        {
            files.putAll(findMapFiles(child, filter, currentPath));
        }
        else if (filter.equals(child.getName()))
        {
            files.put(currentPath, child);
        }
    }
    return files;
}
 
开发者ID:miche-atucha,项目名称:deps-checker,代码行数:26,代码来源:VirtualFileHelper.java

示例5: getTaskDir

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
@Nullable
public static VirtualFile getTaskDir(@NotNull VirtualFile taskFile) {
  VirtualFile parent = taskFile.getParent();

  while (parent != null) {
    String name = parent.getName();

    if (name.contains(EduNames.TASK) && parent.isDirectory()) {
      return parent;
    }
    if (EduNames.SRC.equals(name)) {
      return parent.getParent();
    }

    parent = parent.getParent();
  }
  return null;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:19,代码来源:StudyUtils.java

示例6: getSubtaskIndex

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
public static int getSubtaskIndex(@NotNull Project project, @NotNull VirtualFile file) {
  String fileName = file.getName();
  String name = FileUtil.getNameWithoutExtension(fileName);
  if (!isTestsFile(project, file)) {
    return -1;
  }
  if (!name.contains(EduNames.SUBTASK_MARKER)) {
    return 0;
  }
  int markerIndex = name.indexOf(EduNames.SUBTASK_MARKER);
  String index = name.substring(markerIndex + EduNames.SUBTASK_MARKER.length());
  if (index.isEmpty()) {
    return -1;
  }
  try {
    return Integer.valueOf(index);
  }
  catch (NumberFormatException e) {
    return -1;
  }
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:22,代码来源:CCUtils.java

示例7: ViewLookupElement

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
ViewLookupElement(PsiFile psiFile) {
    myFile = psiFile;
    VirtualFile file = psiFile.getVirtualFile();

    if (file.getNameWithoutExtension().contains(".")) {
        myName = file.getName();
        myTail = null;
    } else {
        myName = file.getNameWithoutExtension();
        myTail = "." + file.getExtension();
    }
}
 
开发者ID:nvlad,项目名称:yii2support,代码行数:13,代码来源:ViewLookupElement.java

示例8: getAreaName

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
@NotNull
protected String getAreaName() {
    VirtualFile containingDirectory = xmlTag.getContainingFile().getVirtualFile().getParent();
    String configDirectory = containingDirectory.getName();

    if (configDirectory.equals("etc")) {
        VirtualFile moduleDirectory = containingDirectory.getParent();
        if (moduleDirectory.getName().equals("app")) {
            return "primary";
        }
        return "global";
    }
    return configDirectory;
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:15,代码来源:LineMarkerXmlTagDecorator.java

示例9: isTestFile

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
@Override
public boolean isTestFile(VirtualFile file) {
  String name = file.getName();
  if (TESTS_PY.equals(name)) {
    return true;
  }
  return name.contains(FileUtil.getNameWithoutExtension(TESTS_PY)) && name.contains(EduNames.SUBTASK_MARKER);
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:9,代码来源:PyEduPluginConfigurator.java

示例10: getTaskFile

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
@Nullable
public static TaskFile getTaskFile(@NotNull final Project project, @NotNull final VirtualFile file) {
  final Course course = StudyTaskManager.getInstance(project).getCourse();
  if (course == null) {
    return null;
  }
  VirtualFile taskDir = getTaskDir(file);
  if (taskDir == null) {
    return null;
  }
  //need this because of multi-module generation
  if (EduNames.SRC.equals(taskDir.getName())) {
    taskDir = taskDir.getParent();
    if (taskDir == null) {
      return null;
    }
  }
  final String taskDirName = taskDir.getName();
  if (taskDirName.contains(EduNames.TASK)) {
    final VirtualFile lessonDir = taskDir.getParent();
    if (lessonDir != null) {
      int lessonIndex = EduUtils.getIndex(lessonDir.getName(), EduNames.LESSON);
      List<Lesson> lessons = course.getLessons();
      if (!indexIsValid(lessonIndex, lessons)) {
        return null;
      }
      final Lesson lesson = lessons.get(lessonIndex);
      int taskIndex = EduUtils.getIndex(taskDirName, EduNames.TASK);
      final List<Task> tasks = lesson.getTaskList();
      if (!indexIsValid(taskIndex, tasks)) {
        return null;
      }
      final Task task = tasks.get(taskIndex);
      return task.getFile(pathRelativeToTask(file));
    }
  }
  return null;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:39,代码来源:StudyUtils.java

示例11: pathRelativeToTask

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
public static String pathRelativeToTask(VirtualFile file) {
  VirtualFile taskDir = getTaskDir(file);
  if (taskDir == null) return file.getName();
  VirtualFile srcDir = taskDir.findChild(EduNames.SRC);
  if (srcDir != null) {
    taskDir = srcDir;
  }
  return FileUtil.getRelativePath(taskDir.getPath(), file.getPath(), '/');
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:10,代码来源:StudyUtils.java

示例12: isTestFile

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
@Override
public boolean isTestFile(VirtualFile file) {
  String name = file.getName();
  return TEST_JAVA.equals(name) || name.contains(FileUtil.getNameWithoutExtension(TEST_JAVA)) && name.contains(EduNames.SUBTASK_MARKER);
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:6,代码来源:EduJavaPluginConfigurator.java

示例13: isTestFile

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
@Override
public boolean isTestFile(VirtualFile file) {
  String name = file.getName();
  return TESTS_KT.equals(name) || LEGACY_TESTS_KT.equals(name) || name.contains(FileUtil.getNameWithoutExtension(TESTS_KT)) && name.contains(EduNames.SUBTASK_MARKER);
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:6,代码来源:EduKotlinPluginConfigurator.java

示例14: getFileTitle

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
@Override
public String getFileTitle(@NotNull Project project, @NotNull VirtualFile virtualFile) {

    String fileCustomTitle;
    try {
        Module fileModule = FileIndexFacade.getInstance(project).getModuleForFile(virtualFile);

        String projectDefaultTitle = defaultBuilder.getProjectTitle(project);
        String projectName = project.getName();
        String projectPath = project.getBasePath();

        String fileDefaultTitle = defaultBuilder.getFileTitle(project, virtualFile);
        String fileName = virtualFile.getName();
        String filePath = virtualFile.getPath();
        String fileExt = virtualFile.getExtension();

        String moduleName = null;
        String modulePath = null;
        if (fileModule != null) {
            moduleName = fileModule.getName();
            modulePath = fileModule.getModuleFilePath();
        }

        fileCustomTitle = engine.eval("fileTemplate({" +
                "projectDefaultTitle: '" + projectDefaultTitle + "'," +
                "projectName: '" + projectName + "'," +
                "projectPath: '" + projectPath + "'," +
                "fileDefaultTitle: '" + fileDefaultTitle + "'," +
                "fileName: '" + fileName + "'," +
                "filePath: '" + filePath + "'," +
                "fileExt: '" + fileExt + "'," +
                "moduleName: '" + moduleName + "'," +
                "modulePath: '" + modulePath + "'" +
                "})").toString();

    } catch (Exception e) {
        fileCustomTitle = defaultBuilder.getFileTitle(project, virtualFile);
    }

    return fileCustomTitle;
}
 
开发者ID:mabdurrahman,项目名称:custom-title-plugin,代码行数:42,代码来源:CustomFrameTitleBuilder.java


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