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


Java FilePath.getParentPath方法代码示例

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


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

示例1: getPresentableRelativePath

import com.intellij.openapi.vcs.FilePath; //导入方法依赖的package包/类
@Override
public String getPresentableRelativePath(@NotNull final ContentRevision fromRevision, @NotNull final ContentRevision toRevision) {
  // need to use parent path because the old file is already not there
  FilePath fromPath = fromRevision.getFile();
  FilePath toPath = toRevision.getFile();

  if ((fromPath.getParentPath() == null) || (toPath.getParentPath() == null)) {
    return null;
  }

  final VirtualFile oldFile = fromPath.getParentPath().getVirtualFile();
  final VirtualFile newFile = toPath.getParentPath().getVirtualFile();
  if (oldFile != null && newFile != null) {
    Module oldModule = ModuleUtilCore.findModuleForFile(oldFile, myProject);
    Module newModule = ModuleUtilCore.findModuleForFile(newFile, myProject);
    if (oldModule != newModule) {
      return getPresentableRelativePathFor(oldFile);
    }
  }
  final RelativePathCalculator calculator =
    new RelativePathCalculator(toPath.getIOFile().getAbsolutePath(), fromPath.getIOFile().getAbsolutePath());
  calculator.execute();
  final String result = calculator.getResult();
  return (result == null) ? null : result.replace("/", File.separator);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ModuleVcsPathPresenter.java

示例2: append

import com.intellij.openapi.vcs.FilePath; //导入方法依赖的package包/类
public void append(final List<CommittedChangeList> changeLists) {
  final TreeState localState = (myState != null) && myBuilder.isEmpty()
                               ? myState
                               : TreeState.createOn(myStructureTree, (DefaultMutableTreeNode)myStructureTree.getModel().getRoot());

  final Set<FilePath> filePaths = new HashSet<FilePath>();
  for (CommittedChangeList changeList : changeLists) {
    for (Change change : changeList.getChanges()) {
      final FilePath path = ChangesUtil.getFilePath(change);
      if (path.getParentPath() != null) {
        filePaths.add(path.getParentPath());
      }
    }
  }

  final DefaultTreeModel model = myBuilder.buildModelFromFilePaths(filePaths);
  myStructureTree.setModel(model);
  localState.applyTo(myStructureTree, (DefaultMutableTreeNode)myStructureTree.getModel().getRoot());
  myStructureTree.revalidate();
  myStructureTree.repaint();
  initRenderer();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:StructureFilteringStrategy.java

示例3: render

import com.intellij.openapi.vcs.FilePath; //导入方法依赖的package包/类
@Override
public void render(final ChangesBrowserNodeRenderer renderer, final boolean selected, final boolean expanded, final boolean hasFocus) {
  final FilePath path = (FilePath)userObject;
  if (path.isDirectory() || !isLeaf()) {
    renderer.append(getRelativePath(safeCastToFilePath(((ChangesBrowserNode)getParent()).getUserObject()), path),
           SimpleTextAttributes.REGULAR_ATTRIBUTES);
    if (!isLeaf()) {
      appendCount(renderer);
    }
    renderer.setIcon(PlatformIcons.DIRECTORY_CLOSED_ICON);
  }
  else {
    if (renderer.isShowFlatten()) {
      renderer.append(path.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
      FilePath parentPath = path.getParentPath();
      renderer.append(spaceAndThinSpace() + FileUtil.getLocationRelativeToUserHome(parentPath.getPresentableUrl()), SimpleTextAttributes.GRAYED_ATTRIBUTES);
    }
    else {
      renderer.append(getRelativePath(safeCastToFilePath(((ChangesBrowserNode)getParent()).getUserObject()), path),
                      SimpleTextAttributes.REGULAR_ATTRIBUTES);
    }
    renderer.setIcon(path.getFileType().getIcon());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ChangesBrowserFilePathNode.java

示例4: run

import com.intellij.openapi.vcs.FilePath; //导入方法依赖的package包/类
public void run() {
  // if put directly into dirty scope, to access a copy will be created every time
  final Set<FilePath> files = myIn.getDirtyFilesNoExpand();

  for (FilePath file : files) {
    if (file.isDirectory()) {
      final VirtualFile vFile = file.getVirtualFile();
      // todo take care about this 'not valid' - right now keeping things as they used to be
      final MyDirNonRecursive me = createOrGet(file);
      if (vFile != null && vFile.isValid()) {
        for (VirtualFile child : vFile.getChildren()) {
          me.add(VcsUtil.getFilePath(child));
        }
      }
    }
    else {
      final FilePath parent = file.getParentPath();
      if (parent != null) {
        final MyDirNonRecursive item = createOrGet(parent);
        item.add(file);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:SvnScopeZipper.java

示例5: getParentCopyFromURL

import com.intellij.openapi.vcs.FilePath; //导入方法依赖的package包/类
/**
 * If the specified filepath or its parent was added with history, returns the URL of the copy source for this filepath.
 *
 * @param filePath the original filepath
 * @return the copy source url, or null if the file isn't a copy of anything
 */
@Nullable
public String getParentCopyFromURL(@NotNull FilePath filePath) {
  String result = null;
  FilePath parent = filePath;

  while (parent != null && !myCopyFromURLs.containsKey(parent)) {
    parent = parent.getParentPath();
  }

  if (parent != null) {
    String copyFromUrl = myCopyFromURLs.get(parent);

    //noinspection ConstantConditions
    result = parent == filePath
             ? copyFromUrl
             : SvnUtil.appendMultiParts(copyFromUrl, FileUtil.getRelativePath(parent.getIOFile(), filePath.getIOFile()));
  }

  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:SvnChangeProviderContext.java

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

示例7: loadEntriesFile

import com.intellij.openapi.vcs.FilePath; //导入方法依赖的package包/类
/**
 * Ensures that the contents of the 'entries' file is cached in the VFS, so that the VFS will send
 * correct events when the 'entries' file is changed externally (to be received by SvnEntriesFileListener)
 *
 * @param filePath the path of a changed file.
 */
private void loadEntriesFile(@NotNull FilePath filePath) {
  final FilePath parentPath = filePath.getParentPath();
  if (parentPath == null) {
    return;
  }
  refreshDotSvnAndEntries(parentPath);
  if (filePath.isDirectory()) {
    refreshDotSvnAndEntries(filePath);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:SvnChangeProviderContext.java

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


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