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


Java VirtualFile.getPath方法代码示例

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


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

示例1: getVirtualFile

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
private void getVirtualFile(String sourceName, VirtualFile virtualFile[], String compileRoot)
        throws Exception {
    if (!ArrayUtils.isEmpty(virtualFile)) {
        VirtualFile arr$[] = virtualFile;
        int len$ = arr$.length;
        for (int i$ = 0; i$ < len$; i$++) {
            VirtualFile vf = arr$[i$];
            String srcName;
            if (StringUtils.indexOf(vf.toString(), "$") != -1)
                srcName = StringUtils.substring(vf.toString(), StringUtils.lastIndexOf(vf.toString(), "/") + 1, StringUtils.indexOf(vf.toString(), "$"));
            else
                srcName = StringUtils.substring(vf.toString(), StringUtils.lastIndexOf(vf.toString(), "/") + 1, StringUtils.length(vf.toString()) - 6);
            String dstName = StringUtils.substring(sourceName, 0, StringUtils.length(sourceName) - 5);
            if (StringUtils.equals(srcName, dstName)) {
                String outRoot = (new StringBuilder()).append(StringUtils.substring(compileRoot, 0, StringUtils.lastIndexOf(compileRoot, "/"))).append("/out").toString();
                String packagePath = StringUtils.substring(vf.getPath(), StringUtils.length(compileRoot), StringUtils.length(vf.getPath()));
                File s = new File(vf.getPath());
                File t = new File((new StringBuilder()).append(outRoot).append(packagePath).toString());
                FileUtil.copy(s, t);
            }
            if (!ArrayUtils.isEmpty(virtualFile))
                getVirtualFile(sourceName, vf.getChildren(), compileRoot);
        }

    }
}
 
开发者ID:serical,项目名称:patcher,代码行数:27,代码来源:ClassesExportAction.java

示例2: findInRoots

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
private static void findInRoots(final Set<VirtualFile> found, VirtualFile[] roots, String relativePath) {
    if (relativePath == null) return;

    for (VirtualFile root : roots) {
        String probeName;
        if (isArchive(root)) {
            probeName = root.getPath() + '!' + relativePath;
        } else {
            probeName = root.getPath() + relativePath;
        }
        VirtualFile virtualFile = root.getFileSystem().findFileByPath(probeName);
        if (virtualFile != null) {
            found.add(virtualFile);
        }
    }
}
 
开发者ID:Jamling,项目名称:SmartQQ4IntelliJ,代码行数:17,代码来源:VFSUtils.java

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

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

示例5: BPMNEditorDiagramTab

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
public BPMNEditorDiagramTab(@NotNull BPMNFileEditor editor, Project project, Module module, @NotNull VirtualFile file) {
    setLayout(new BorderLayout());

    this.myProject = project;
    this.myEditor = editor;
    this.myModule = module;
    this.myFile = file;

    this.fileTab = new BPMNFileTab(new File(file.getPath()), false, false);
    installResizeHandler();

    JPanel toolbarPanel = new JPanel();
    toolbarPanel.setLayout(new BoxLayout(toolbarPanel, BoxLayout.X_AXIS));
    toolbarPanel.setBorder(null);

    toolbarPanel.add(createSaveToolBar());
    toolbarPanel.add(new StyleToolBar(fileTab));
    toolbarPanel.add(createEditToolBar());

    add(toolbarPanel, BorderLayout.NORTH);
    add(fileTab.getViewToolBar(), BorderLayout.EAST);
    add(fileTab.getAlignToolBar(), BorderLayout.WEST);

    add(fileTab.getDiagramPane());
}
 
开发者ID:Blenta,项目名称:intellij-bpmn-editor,代码行数:26,代码来源:BPMNEditorDiagramTab.java

示例6: generateJson

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
@SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
private static void generateJson(VirtualFile parentDir, Course course) {
  final Gson gson = new GsonBuilder().setPrettyPrinting().excludeFieldsWithoutExposeAnnotation().
    registerTypeAdapter(Task.class, new StudySerializationUtils.Json.TaskAdapter()).create();
  final String json = gson.toJson(course);
  final File courseJson = new File(parentDir.getPath(), EduNames.COURSE_META_FILE);
  OutputStreamWriter outputStreamWriter = null;
  try {
    outputStreamWriter = new OutputStreamWriter(new FileOutputStream(courseJson), "UTF-8");
    outputStreamWriter.write(json);
  }
  catch (Exception e) {
    Messages.showErrorDialog(e.getMessage(), "Failed to Generate Json");
    LOG.info(e);
  }
  finally {
    try {
      if (outputStreamWriter != null) {
        outputStreamWriter.close();
      }
    }
    catch (IOException e1) {
      //close silently
    }
  }
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:27,代码来源:CCCreateCourseArchive.java

示例7: actionPerformed

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
    // TODO: insert action logic here

    VirtualFile data = e.getData(PlatformDataKeys.VIRTUAL_FILE);
    String path = data.getPath();
    String packagename = path.substring(path.indexOf("main/java") + 10, path.length()).replaceAll("/", ".");

    System.out.println(path);
    System.out.println(packagename);

    JsonDialog jsonDialog = new JsonDialog(path, packagename, e);
    jsonDialog.setSize(620, 440);
    jsonDialog.setAlwaysOnTop(true);
    jsonDialog.setVisible(true);


}
 
开发者ID:zhouzhuo810,项目名称:ApiCreator,代码行数:19,代码来源:MainAction.java

示例8: createDictionaryFromFile

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
/**
   * Generates dictionary file for application, initializes it's terms for parser and creates
   * {@link ApplicationDictionary} psi class for the Project.
   *
   * @param applicationName Name of the application
   * @param applicationFile VirtualFile of the application bundle
   * @return Dictionary psi class for the application or null if creation failed
   */
  @Nullable
  public synchronized ApplicationDictionary createDictionaryFromFile(@NotNull String applicationName,
                                                                     @NotNull VirtualFile applicationFile) {
//    if (isInIgnoreList(applicationName, applicationFile)) return null;
    final File appIoFile = new File(applicationFile.getPath());
    final DictionaryInfo dictionaryInfo = dictionaryRegistryService.createAndInitializeInfo(appIoFile, applicationName);
    if (dictionaryInfo != null) {
      return createDictionaryFromInfo(dictionaryInfo);
    }
    LOG.warn("Failed to get initialized dictionary info for " + applicationName + " from " + applicationFile);
    return null;
  }
 
开发者ID:ant-druha,项目名称:AppleScript-IDEA,代码行数:21,代码来源:AppleScriptProjectDictionaryService.java

示例9: createUserTest

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
private static UserTest createUserTest(@NotNull final VirtualFile testsDir,
                                       @NotNull final Task currentTask,
                                       StudyTaskManager studyTaskManager) {
  UserTest userTest = new UserTest();
  List<UserTest> userTests = studyTaskManager.getUserTests(currentTask);
  int testNum = userTests.size() + 1;
  String inputName = EduNames.USER_TEST_INPUT + testNum;
  File inputFile = new File(testsDir.getPath(), inputName);
  String outputName = EduNames.USER_TEST_OUTPUT + testNum;
  File outputFile = new File(testsDir.getPath(), outputName);
  userTest.setInput(inputFile.getPath());
  userTest.setOutput(outputFile.getPath());
  studyTaskManager.addUserTest(currentTask, userTest);
  return userTest;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:16,代码来源:StudyEditInputAction.java

示例10: fileDeleted

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
@Override
public void fileDeleted(@NotNull VirtualFileEvent event) {
  VirtualFile removedFile = event.getFile();
  String path = removedFile.getPath();
  if (path.contains(CCUtils.GENERATED_FILES_FOLDER)) {
    return;
  }

  if (myProject == null) {
    return;
  }
  if (myProject.getBasePath() !=null && !FileUtil.isAncestor(myProject.getBasePath(), removedFile.getPath(), true)) {
    return;
  }
  Course course = StudyTaskManager.getInstance(myProject).getCourse();
  if (course == null) {
    return;
  }
  final TaskFile taskFile = StudyUtils.getTaskFile(myProject, removedFile);
  if (taskFile != null) {
    deleteTaskFile(removedFile, taskFile);
    return;
  }
  if (removedFile.getName().contains(EduNames.TASK)) {
    deleteTask(course, removedFile);
  }
  if (removedFile.getName().contains(EduNames.LESSON)) {
    deleteLesson(course, removedFile, myProject);
  }
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:31,代码来源:CCVirtualFileListener.java

示例11: getPath

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
@NotNull
private String getPath( VirtualFile dir )
{
  String url = dir.getUrl();
  String path = dir.getPath();
  if( url.startsWith( "jar:" ) && path.endsWith( "!/" ) )
  {
    path = path.substring( 0, path.length()-2 );
  }
  return path.replace( '/', File.separatorChar );
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:12,代码来源:HotSwapComponent.java

示例12: chooseAndSaveApkFile

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
private void chooseAndSaveApkFile(Project project) {
    VirtualFile apkFile = new FileChooserDialogManager.Builder(project)
            .setFileTypes(FileTypes.FILE)
            .setTitle(Strings.TITLE_ASK_APK_FILE)
            .setDescription(Strings.MESSAGE_ASK_APK_FILE)
            .withFileFilter("apk")
            .create()
            .getSelectedFile();

    if (apkFile != null) {
        apkPath = apkFile.getPath();
        PropertiesManager.putData(project, PropertyKeys.APK_PATH, apkPath);
    }
}
 
开发者ID:kaygisiz,项目名称:Dependency-Injection-Graph,代码行数:15,代码来源:GenerateDependencyInjectionGraph.java

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

示例14: actionPerformed

import com.intellij.openapi.vfs.VirtualFile; //导入方法依赖的package包/类
public void actionPerformed(AnActionEvent event) {
    SourcetrailOptions options = SourcetrailOptions.getInstance();
    String MESSAGE_SPLIT_STRING = ">>";
    VirtualFile vFile = event.getData(PlatformDataKeys.VIRTUAL_FILE);
    String fileName = vFile != null ? vFile.getPath() : null;
    LogicalPosition logicalPosition = new LogicalPosition(0,0);
    final Editor editor = event.getData(CommonDataKeys.EDITOR);
    if (editor != null)
    {
        CaretModel caretModel = editor.getCaretModel();
        if ( caretModel != null)
        {
            logicalPosition = caretModel.getLogicalPosition();
        }
    }

    String text = "setActiveToken" + MESSAGE_SPLIT_STRING +
            fileName + MESSAGE_SPLIT_STRING
            + (logicalPosition.line + 1) + MESSAGE_SPLIT_STRING + logicalPosition.column + "<EOM>";
    try
    {
        Socket socket = new Socket(options.getIp(), options.getSourcetrailPort());
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
        writer.write(text);
        writer.flush();
        socket.close();
    }
    catch(Exception e)
    {
        String errorMsg =
                "No connection to a Sourcetrail instance\n\n Make sure Sourcetrail is running and the right address is used("
                        + options.getIp() + ":" + options.getSourcetrailPort() + ")";
        Messages.showMessageDialog(errorMsg, "SourcetrailPluginError", Messages.getErrorIcon());
        e.printStackTrace();
    }

    StatusBar statusbar = WindowManager.getInstance().getStatusBar(PlatformDataKeys.PROJECT.getData(event.getDataContext()));

    JBPopupFactory.getInstance()
            .createHtmlTextBalloonBuilder("Location sent to Sourcetrail", MessageType.INFO, null)
            .setFadeoutTime(3000)
            .createBalloon()
            .show(RelativePoint.getCenterOf(statusbar.getComponent()), Balloon.Position.atRight);

}
 
开发者ID:CoatiSoftware,项目名称:idea-sourcetrail,代码行数:46,代码来源:ActivateTokenAction.java

示例15: 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.getPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。