當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。