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


Java VirtualFile.getExtension方法代碼示例

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


在下文中一共展示了VirtualFile.getExtension方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: maybeGetProcessorPath

import com.intellij.openapi.vfs.VirtualFile; //導入方法依賴的package包/類
private String maybeGetProcessorPath()
{
  int jdkVersion = findJdkVersion();
  if( jdkVersion >= 9 )
  {
    PathsList pathsList = ProjectRootManager.getInstance( _ijProject ).orderEntries().withoutSdk().librariesOnly().getPathsList();
    for( VirtualFile path: pathsList.getVirtualFiles() )
    {
      String extension = path.getExtension();
      if( extension != null && extension.equals( "jar" ) && path.getNameWithoutExtension().contains( "manifold-" ) )
      {
        try
        {
          return " -processorpath " + new File( new URL( path.getUrl() ).getFile() ).getAbsolutePath() ;
        }
        catch( MalformedURLException e )
        {
          return "";
        }
      }
    }
  }
  return "";
}
 
開發者ID:manifold-systems,項目名稱:manifold-ij,代碼行數:25,代碼來源:ManProject.java

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

示例4: 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.getExtension方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。