當前位置: 首頁>>代碼示例>>Java>>正文


Java VirtualFile.getNameWithoutExtension方法代碼示例

本文整理匯總了Java中com.intellij.openapi.vfs.VirtualFile.getNameWithoutExtension方法的典型用法代碼示例。如果您正苦於以下問題:Java VirtualFile.getNameWithoutExtension方法的具體用法?Java VirtualFile.getNameWithoutExtension怎麽用?Java VirtualFile.getNameWithoutExtension使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.vfs.VirtualFile的用法示例。


在下文中一共展示了VirtualFile.getNameWithoutExtension方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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

示例2: getGotoDeclarationTargets

import com.intellij.openapi.vfs.VirtualFile; //導入方法依賴的package包/類
@Nullable
@Override
public PsiElement[] getGotoDeclarationTargets(@Nullable PsiElement psiElement, int i, Editor editor) {
    if (psiElement == null) {
        return PsiElement.EMPTY_ARRAY;
    }
    Project project = psiElement.getProject();
    if (!PlatformPatterns
            .psiElement(StringLiteralExpression.class)
            .withLanguage(PhpLanguage.INSTANCE)
            .accepts(psiElement.getContext())
    ) {
        return PsiElement.EMPTY_ARRAY;
    }
    PsiFile containingFile = psiElement.getContainingFile();
    VirtualFile virtualFile = containingFile.getVirtualFile();
    String filename = virtualFile.getNameWithoutExtension();
    String controllerName = CakeUtil.controllerBaseNameFromControllerFileName(filename);
    if (controllerName == null) {
        return PsiElement.EMPTY_ARRAY;
    }

    PsiDirectory appDir = PsiUtil.getAppDirectoryFromFile(containingFile);
    String templatePath = String.format("View/%s/%s.ctp", controllerName, psiElement.getText());
    VirtualFile relativeFile = VfsUtil.findRelativeFile(appDir, templatePath);
    if (relativeFile != null) {
        Collection<VirtualFile> files = new HashSet<>();
        files.add(relativeFile);
        return PsiUtil.convertVirtualFilesToPsiFiles(project, files).toArray(new PsiElement[files.size()]);
    }
    return PsiElement.EMPTY_ARRAY;
}
 
開發者ID:dmeybohm,項目名稱:chocolate-cakephp,代碼行數:33,代碼來源:TemplateGotoDeclarationHandler.java

示例3: getFileNameWithoutExtension

import com.intellij.openapi.vfs.VirtualFile; //導入方法依賴的package包/類
@Nullable
public static String getFileNameWithoutExtension(@NotNull PsiElement psiElement) {
    PsiFile file = psiElement.getContainingFile();
    if (file == null) {
        return null;
    }
    VirtualFile virtualFile = file.getVirtualFile();
    if (virtualFile == null) {
        return null;
    }
    return virtualFile.getNameWithoutExtension();
}
 
開發者ID:dmeybohm,項目名稱:chocolate-cakephp,代碼行數:13,代碼來源:PsiUtil.java

示例4: deleteWindowDescriptions

import com.intellij.openapi.vfs.VirtualFile; //導入方法依賴的package包/類
public static void deleteWindowDescriptions(@NotNull final Task task, @NotNull final VirtualFile taskDir) {
  for (Map.Entry<String, TaskFile> entry : task.getTaskFiles().entrySet()) {
    String name = entry.getKey();
    VirtualFile virtualFile = taskDir.findFileByRelativePath(name);
    if (virtualFile == null) {
      continue;
    }
    String windowsFileName = virtualFile.getNameWithoutExtension() + EduNames.WINDOWS_POSTFIX;
    VirtualFile parentDir = virtualFile.getParent();
    deleteWindowsFile(parentDir, windowsFileName);
  }
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:13,代碼來源:EduUtils.java

示例5: isActiveSubtaskTest

import com.intellij.openapi.vfs.VirtualFile; //導入方法依賴的package包/類
private boolean isActiveSubtaskTest(VirtualFile virtualFile) {
  if (!(myTask instanceof TaskWithSubtasks)) {
    return true;
  }

  if (!virtualFile.getName().contains(EduNames.SUBTASK_MARKER)) {
    return false;
  }
  String nameWithoutExtension = virtualFile.getNameWithoutExtension();
  int stepMarkerStart = nameWithoutExtension.indexOf(EduNames.SUBTASK_MARKER);
  int stepIndex = Integer.valueOf(nameWithoutExtension.substring(EduNames.SUBTASK_MARKER.length() + stepMarkerStart));
  return stepIndex == ((TaskWithSubtasks)myTask).getActiveSubtaskIndex();
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:14,代碼來源:CCTaskDirectoryNode.java

示例6: build

import com.intellij.openapi.vfs.VirtualFile; //導入方法依賴的package包/類
public static void build(Project project, VirtualFile virtualFile) {
    if (virtualFile == null) return;

    Options options = OptionsHelper.load(project);
    if (options == null) {
        OptionForm.show(project, virtualFile);
        return;
    }
    if (!OptionsHelper.verify(options)) {
        OptionForm.show(project, virtualFile);
        return;
    }

    String apkNameWithoutExtension = virtualFile.getNameWithoutExtension();

    File apkFile = new File(virtualFile.getPath());
    File parentFile = apkFile.getParentFile();
    String tempPath = parentFile + File.separator + "temp";
    String outPath = parentFile + File.separator + "channels";

    ProgressManager.getInstance().run(new Task.Backgroundable(project, "Build Channel") {
        @Override
        public void run(@NotNull ProgressIndicator progressIndicator) {
            log.info("build type -> " + options.buildType);
            if (OptionsHelper.BUILD_TYPE_UPDATE.equals(options.buildType)) {
                updateAndroidManifestXml(progressIndicator, virtualFile, tempPath, options,
                        apkNameWithoutExtension, outPath, apkFile);
            } else if (OptionsHelper.BUILD_TYPE_ADD.equals(options.buildType)) {
                addChannelFileToMETAINF(progressIndicator, options, apkFile, outPath, tempPath,
                        apkNameWithoutExtension);
            } else {
                writeApkComment(progressIndicator, options, apkFile, outPath, tempPath, apkNameWithoutExtension);
            }
        }
    });
}
 
開發者ID:nukc,項目名稱:ApkMultiChannelPlugin,代碼行數:37,代碼來源:BuildHelper.java

示例7: createFileMap

import com.intellij.openapi.vfs.VirtualFile; //導入方法依賴的package包/類
@Override
public void createFileMap(@NotNull VirtualFile file) {
    fileMap.clear();
    VirtualFile parent = file.getParent();
    VirtualFile[] childs = parent.getChildren();
    languages = new String[childs.length];
    int cnt = 0;
    for (VirtualFile each : childs) {
        languages[cnt] = each.getNameWithoutExtension();
        fileMap.put(languages[cnt], each);
        cnt++;
    }
}
 
開發者ID:PioBeat,項目名稱:GravSupport,代碼行數:14,代碼來源:LanguageFolderStrategy.java

示例8: smartCheck

import com.intellij.openapi.vfs.VirtualFile; //導入方法依賴的package包/類
private static void smartCheck(@NotNull final AnswerPlaceholder placeholder,
                              @NotNull final Project project,
                              @NotNull final VirtualFile answerFile,
                              @NotNull final TaskFile answerTaskFile,
                              @NotNull final TaskFile usersTaskFile,
                              @NotNull final PyStudyTestRunner testRunner,
                              @NotNull final VirtualFile virtualFile,
                              @NotNull final Document usersDocument) {
  VirtualFile fileWindows = null;
  VirtualFile windowCopy = null;
  try {
    final int index = placeholder.getIndex();
    String windowCopyName = answerFile.getNameWithoutExtension() + index + EduNames.WINDOW_POSTFIX + answerFile.getExtension();
    windowCopy = answerFile.copy(project, answerFile.getParent(), windowCopyName);
    final FileDocumentManager documentManager = FileDocumentManager.getInstance();
    final Document windowDocument = documentManager.getDocument(windowCopy);
    if (windowDocument != null) {
      TaskFile windowTaskFile = answerTaskFile.getTask().copy().getTaskFile(StudyUtils.pathRelativeToTask(virtualFile));
      if (windowTaskFile == null) {
        return;
      }
      EduDocumentListener listener = new EduDocumentListener(windowTaskFile);
      windowDocument.addDocumentListener(listener);
      int start = placeholder.getOffset();
      int end = start + placeholder.getRealLength();
      final AnswerPlaceholder userAnswerPlaceholder = usersTaskFile.getAnswerPlaceholders().get(placeholder.getIndex());
      int userStart = userAnswerPlaceholder.getOffset();
      int userEnd = userStart + userAnswerPlaceholder.getRealLength();
      String text = usersDocument.getText(new TextRange(userStart, userEnd));
      windowDocument.replaceString(start, end, text);
      ApplicationManager.getApplication().runWriteAction(() -> documentManager.saveDocument(windowDocument));
      fileWindows = EduUtils.flushWindows(windowTaskFile, windowCopy);
      Process smartTestProcess = testRunner.createCheckProcess(project, windowCopy.getPath());
      final CapturingProcessHandler handler = new CapturingProcessHandler(smartTestProcess, null, windowCopy.getPath());
      final ProcessOutput output = handler.runProcess();
      final Course course = StudyTaskManager.getInstance(project).getCourse();
      if (course != null) {
        boolean res = StudyTestsOutputParser.getTestsOutput(output, course.isAdaptive()).isSuccess();
        StudyTaskManager.getInstance(project).setStatus(userAnswerPlaceholder, res ? StudyStatus.Solved : StudyStatus.Failed);
      }
    }
  }
  catch (ExecutionException | IOException e) {
    LOG.error(e);
  }
  finally {
    StudyUtils.deleteFile(windowCopy);
    StudyUtils.deleteFile(fileWindows);
  }
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:51,代碼來源:PyStudySmartChecker.java


注:本文中的com.intellij.openapi.vfs.VirtualFile.getNameWithoutExtension方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。