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


Java FilePath.getPath方法代码示例

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


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

示例1: getFile

import com.intellij.openapi.vcs.FilePath; //导入方法依赖的package包/类
@Nullable
@Override
protected VirtualFile getFile(@NotNull AnActionEvent e) {
  VcsFileRevision revision = getFileRevision(e);
  if (revision == null) return null;

  final FileType currentFileType = myAnnotation.getFile().getFileType();
  FilePath filePath =
    (revision instanceof VcsFileRevisionEx ? ((VcsFileRevisionEx)revision).getPath() : VcsUtil.getFilePath(myAnnotation.getFile()));
  return new VcsVirtualFile(filePath.getPath(), revision, VcsFileSystem.getInstance()) {
    @NotNull
    @Override
    public FileType getFileType() {
      FileType type = super.getFileType();
      if (!type.isBinary()) return type;
      if (!currentFileType.isBinary()) return currentFileType;
      return PlainTextFileType.INSTANCE;
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:AnnotateRevisionAction.java

示例2: clearChanges

import com.intellij.openapi.vcs.FilePath; //导入方法依赖的package包/类
private void clearChanges(Collection<Change> changes) {
  for (Change change : changes) {
    ContentRevision revision = change.getAfterRevision();
    if (revision != null) {
      FilePath filePath = revision.getFile();
      String path = filePath.getPath();
      final Conflict wasRemoved = myConflicts.remove(path);
      final VirtualFile file = filePath.getVirtualFile();
      if (wasRemoved != null && file != null) {
        myEditorNotifications.updateNotifications(file);
        // we need to update status
        myFileStatusManager.fileStatusChanged(file);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ChangelistConflictTracker.java

示例3: sortFilePathsByGitRoot

import com.intellij.openapi.vcs.FilePath; //导入方法依赖的package包/类
/**
 * Sort files by vcs root
 *
 * @param files        files to sort.
 * @param ignoreNonGit if true, non-git files are ignored
 * @return the map from root to the files under the root
 * @throws VcsException if non git files are passed when {@code ignoreNonGit} is false
 */
@NotNull
public static Map<VirtualFile, List<FilePath>> sortFilePathsByGitRoot(@NotNull Collection<FilePath> files, boolean ignoreNonGit)
  throws VcsException {
  Map<VirtualFile, List<FilePath>> rc = new HashMap<VirtualFile, List<FilePath>>();
  for (FilePath p : files) {
    VirtualFile root = getGitRootOrNull(p);
    if (root == null) {
      if (ignoreNonGit) {
        continue;
      }
      else {
        throw new VcsException("The file " + p.getPath() + " is not under Git");
      }
    }
    List<FilePath> l = rc.get(root);
    if (l == null) {
      l = new ArrayList<FilePath>();
      rc.put(root, l);
    }
    l.add(p);
  }
  return rc;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:GitUtil.java

示例4: getTitle

import com.intellij.openapi.vcs.FilePath; //导入方法依赖的package包/类
@NotNull
public static String getTitle(@NotNull FilePath path1, @NotNull FilePath path2, @NotNull String separator) {
  if ((path1.isDirectory() || path2.isDirectory()) && path1.getPath().equals(path2.getPath())) return path1.getPath();
  if (path1.isDirectory() ^ path2.isDirectory()) return getContentTitle(path1) + " vs " + getContentTitle(path2);

  FilePath parent1 = path1.getParentPath();
  FilePath parent2 = path2.getParentPath();
  return getRequestTitle(path1.getName(), path1.getPath(), parent1 != null ? parent1.getPath() : null,
                         path2.getName(), path2.getPath(), parent2 != null ? parent2.getPath() : null,
                         separator);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:DiffRequestFactoryImpl.java

示例5: createBinaryDiffRequest

import com.intellij.openapi.vcs.FilePath; //导入方法依赖的package包/类
private static SimpleDiffRequest createBinaryDiffRequest(final Project project, final Change change) throws VcsException {
  final FilePath filePath = ChangesUtil.getFilePath(change);
  final SimpleDiffRequest request = new SimpleDiffRequest(project, filePath.getPath());
  try {
    request.setContents(createBinaryFileContent(project, change.getBeforeRevision(), filePath.getName()),
                        createBinaryFileContent(project, change.getAfterRevision(), filePath.getName()));
    return request;
  }
  catch (IOException e) {
    throw new VcsException(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:ShowDiffAction.java

示例6: staticFrom

import com.intellij.openapi.vcs.FilePath; //导入方法依赖的package包/类
private static StaticFilePath staticFrom(final FilePath fp) {
  final String path = fp.getPath();
  if (fp.isNonLocal() && (! FileUtil.isAbsolute(path) || VcsUtil.isPathRemote(path))) {
    return new StaticFilePath(fp.isDirectory(), fp.getIOFile().getPath().replace('\\', '/'), fp.getVirtualFile());
  }
  return new StaticFilePath(fp.isDirectory(), new File(fp.getIOFile().getPath().replace('\\', '/')).getAbsolutePath(), fp.getVirtualFile());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:TreeModelBuilder.java

示例7: FileHistorySessionPartner

import com.intellij.openapi.vcs.FilePath; //导入方法依赖的package包/类
public FileHistorySessionPartner(final VcsHistoryProvider vcsHistoryProvider,
                                 @NotNull final FilePath path,
                                 final AbstractVcs vcs,
                                 final FileHistoryRefresherI refresherI) {
  myVcsHistoryProvider = vcsHistoryProvider;
  myPath = path;
  myLimitHistoryCheck = new LimitHistoryCheck(vcs.getProject(), path.getPath());
  myVcs = vcs;
  myRefresherI = refresherI;
  Consumer<List<VcsFileRevision>> sessionRefresher = new Consumer<List<VcsFileRevision>>() {
    public void consume(List<VcsFileRevision> vcsFileRevisions) {
      // TODO: Logic should be revised to we could just append some revisions to history panel instead of creating and showing new history
      // TODO: session
      mySession.getRevisionList().addAll(vcsFileRevisions);
      final VcsHistorySession copy = mySession.copyWithCachedRevision();
      ApplicationManager.getApplication().invokeLater(new Runnable() {
        public void run() {
          ensureHistoryPanelCreated().getHistoryPanelRefresh().consume(copy);
        }
      });
    }
  };
  myBuffer = new BufferedListConsumer<VcsFileRevision>(5, sessionRefresher, 1000) {
    @Override
    protected void invokeConsumer(@NotNull Runnable consumerRunnable) {
      // Do not invoke in arbitrary background thread as due to parallel execution this could lead to cases when invokeLater() (from
      // sessionRefresher) is scheduled at first for history session with (as an example) 10 revisions (new buffered list) and then with
      // 5 revisions (previous buffered list). And so incorrect UI is shown to the user.
      consumerRunnable.run();
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:FileHistorySessionPartner.java

示例8: annotate

import com.intellij.openapi.vcs.FilePath; //导入方法依赖的package包/类
@NotNull
@Override
public FileAnnotation annotate(@NotNull final FilePath path, @NotNull final VcsRevisionNumber revision) throws VcsException {
  setProgressIndicatorText(GitBundle.message("getting.history", path.getName()));
  List<VcsFileRevision> revisions = GitHistoryUtils.history(myProject, path, null, revision);

  GitFileRevision fileRevision = new GitFileRevision(myProject, path, (GitRevisionNumber)revision);
  VcsVirtualFile file = new VcsVirtualFile(path.getPath(), fileRevision, VcsFileSystem.getInstance());

  setProgressIndicatorText(GitBundle.message("computing.annotation", path.getName()));
  return annotate(path, revision, revisions, file);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:GitAnnotationProvider.java

示例9: getContentTitle

import com.intellij.openapi.vcs.FilePath; //导入方法依赖的package包/类
@NotNull
public static String getContentTitle(@NotNull FilePath path) {
  if (path.isDirectory()) return path.getPath();
  FilePath parent = path.getParentPath();
  return getContentTitle(path.getName(), path.getPath(), parent != null ? parent.getPath() : null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:DiffRequestFactoryImpl.java

示例10: convertRevisionToAir

import com.intellij.openapi.vcs.FilePath; //导入方法依赖的package包/类
@Nullable
private static AirContentRevision convertRevisionToAir(final ContentRevision cr, final Long ts) {
  if (cr == null) return null;
  final FilePath fp = cr.getFile();
  final StaticPathDescription description = new StaticPathDescription(fp.isDirectory(),
                                                                      ts == null ? fp.getIOFile().lastModified() : ts, fp.getPath());
  if (cr instanceof BinaryContentRevision) {
    return new AirContentRevision() {
      public boolean isBinary() {
        return true;
      }
      public String getContentAsString() {
        throw new IllegalStateException();
      }
      public byte[] getContentAsBytes() throws VcsException {
        return ((BinaryContentRevision) cr).getBinaryContent();
      }
      public String getRevisionNumber() {
        return ts != null ? null : cr.getRevisionNumber().asString();
      }
      @NotNull
      public PathDescription getPath() {
        return description;
      }

      @Override
      public Charset getCharset() {
        return null;
      }
    };
  } else {
    return new AirContentRevision() {
      public boolean isBinary() {
        return false;
      }
      public String getContentAsString() throws VcsException {
        return cr.getContent();
      }
      public byte[] getContentAsBytes() throws VcsException {
        throw new IllegalStateException();
      }
      public String getRevisionNumber() {
        return ts != null ? null : cr.getRevisionNumber().asString();
      }
      @NotNull
      public PathDescription getPath() {
        return description;
      }

      @Override
      public Charset getCharset() {
        return fp.getCharset();
      }
    };
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:57,代码来源:IdeaTextPatchBuilder.java

示例11: refreshDotSvnAndEntries

import com.intellij.openapi.vcs.FilePath; //导入方法依赖的package包/类
private void refreshDotSvnAndEntries(@NotNull FilePath filePath) {
  final File svn = new File(filePath.getPath(), SvnUtil.SVN_ADMIN_DIR_NAME);

  filesToRefresh.add(svn);
  filesToRefresh.add(new File(svn, SvnUtil.ENTRIES_FILE_NAME));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:SvnChangeProviderContext.java


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