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


Java FilePath.getName方法代码示例

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


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

示例1: setRenamedOrMovedTarget

import com.intellij.openapi.vcs.FilePath; //导入方法依赖的package包/类
public void setRenamedOrMovedTarget(final FilePath target) {
  myMoved = myRenamed = false;

  if ((getBeforeRevision() != null) || (getAfterRevision() == null)) {
    // not external rename or move
    return;
  }
  final FilePath localPath = ChangesUtil.getFilePath(this);
  if (localPath.getIOFile().getAbsolutePath().equals(target.getIOFile().getAbsolutePath())) {
    // not rename or move
    return;
  }

  if (Comparing.equal(target.getParentPath(), localPath.getParentPath())) {
    myRenamed = true;
  } else {
    myMoved = true;
  }
  myCopied = false;

  myRenamedTargetName = target.getName();
  myRenameOrMoveCached = true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ExternallyRenamedChange.java

示例2: getRanges

import com.intellij.openapi.vcs.FilePath; //导入方法依赖的package包/类
public PreparedFragmentedContent getRanges(Change change) throws VcsException {
  FilePath filePath = ChangesUtil.getFilePath(change);

  final RangesCalculator calculator = new RangesCalculator();
  calculator.execute(change, filePath, myRangesCache, LineStatusTrackerManager.getInstance(myProject));
  final VcsException exception = calculator.getException();
  if (exception != null) {
    LOG.info(exception);
    throw exception;
  }
  List<BeforeAfter<TextRange>> ranges = calculator.getRanges();
  if (ranges == null || ranges.isEmpty()) return null;
  FragmentedContent fragmentedContent = new FragmentedContent(calculator.getOldDocument(), calculator.getDocument(), ranges, change);
  VirtualFile file = filePath.getVirtualFile();
  if (file == null) {
    file = LocalFileSystem.getInstance().refreshAndFindFileByPath(filePath.getPath());
  }
  return new PreparedFragmentedContent(myProject, fragmentedContent,
                                  filePath.getName(), filePath.getFileType(),
                                  change.getBeforeRevision() == null ? null : change.getBeforeRevision().getRevisionNumber(),
                                  change.getAfterRevision() == null ? null : change.getAfterRevision().getRevisionNumber(), filePath, file);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:FragmentedDiffRequestFromChange.java

示例3: render

import com.intellij.openapi.vcs.FilePath; //导入方法依赖的package包/类
@Override
public void render(ChangesBrowserNodeRenderer renderer, boolean selected, boolean expanded, boolean hasFocus) {
  // todo would be good to have render code in one place
  final LocallyDeletedChange change = (LocallyDeletedChange)getUserObject();
  final FilePath filePath = change.getPath();

  final String fileName = filePath.getName();
  VirtualFile vFile = filePath.getVirtualFile();
  final Color changeColor = FileStatus.NOT_CHANGED.getColor();
  renderer.appendFileName(vFile, fileName, changeColor);

  if (renderer.isShowFlatten()) {
    final File parentFile = filePath.getIOFile().getParentFile();
    if (parentFile != null) {
      renderer.append(spaceAndThinSpace() + parentFile.getPath(), SimpleTextAttributes.GRAYED_ATTRIBUTES);
    }
  }
  else if (getCount() != 1 || getDirectoryCount() != 0) {
    appendCount(renderer);
  }

  final Icon addIcon = change.getAddIcon();
  if (addIcon != null) {
    renderer.setIcon(addIcon);
  } else {
    if (filePath.isDirectory() || !isLeaf()) {
      renderer.setIcon(PlatformIcons.DIRECTORY_CLOSED_ICON);
    }
    else {
      renderer.setIcon(filePath.getFileType().getIcon());
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:ChangesBrowserLocallyDeletedNode.java

示例4: addFile

import com.intellij.openapi.vcs.FilePath; //导入方法依赖的package包/类
private void addFile(FilePath file, CvsConfiguration cvsConfiguration) {
  final CheckoutFileOperation operation =
    new CheckoutFileOperation(file.getVirtualFileParent(), cvsConfiguration, file.getName(),
                              CvsEntriesManager.getInstance().getEntryFor(file.getVirtualFileParent(), file.getName()),
                              cvsConfiguration.MAKE_NEW_FILES_READONLY, file.isDirectory());
  addOperation(operation);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:CheckoutFilesOperation.java

示例5: rollbackChanges

import com.intellij.openapi.vcs.FilePath; //导入方法依赖的package包/类
public void rollbackChanges(List<Change> changes, final List<VcsException> exceptions,
                            @NotNull final RollbackProgressListener listener) {
  listener.determinate();
  for (Change change : changes) {
    final FilePath filePath = ChangesUtil.getFilePath(change);
    listener.accept(change);
    final VirtualFile parent = filePath.getVirtualFileParent();
    final String name = filePath.getName();

    switch (change.getType()) {
      case DELETED:
        restoreFile(parent, name);
        break;

      case MODIFICATION:
        restoreFile(parent, name);
        break;

      case MOVED:
        CvsUtil.removeEntryFor(CvsVfsUtil.getFileFor(parent, name));
        break;

      case NEW:
        CvsUtil.removeEntryFor(CvsVfsUtil.getFileFor(parent, name));
        break;
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:CvsRollbackEnvironment.java

示例6: getModuleName

import com.intellij.openapi.vcs.FilePath; //导入方法依赖的package包/类
public static String getModuleName(FilePath path) {
  if (path.isDirectory()) {
    return CvsEntriesManager.getInstance().getRepositoryFor(path.getVirtualFile());
  } else {
    return CvsEntriesManager.getInstance().getRepositoryFor(path.getVirtualFileParent()) + "/" + path.getName();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:CvsUtil.java

示例7: getName

import com.intellij.openapi.vcs.FilePath; //导入方法依赖的package包/类
protected String getName(FilePath path) {
  return path.getName();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:VirtualFileListCellRenderer.java

示例8: 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 Change change = getUserObject();
  final FilePath filePath = ChangesUtil.getFilePath(change);
  final String fileName = filePath.getName();
  VirtualFile vFile = filePath.getVirtualFile();

  if (myDecorator != null) {
    myDecorator.preDecorate(change, renderer, renderer.isShowFlatten());
  }

  final Color changeColor = change.getFileStatus().getColor();
  renderer.appendFileName(vFile, fileName, changeColor);

  final String originText = change.getOriginText(myProject);
  if (originText != null) {
    renderer.append(spaceAndThinSpace() + originText, SimpleTextAttributes.REGULAR_ATTRIBUTES);
  }

  if (renderer.isShowFlatten()) {
    final File parentFile = filePath.getIOFile().getParentFile();
    if (parentFile != null) {
      renderer.append(spaceAndThinSpace() + FileUtil.getLocationRelativeToUserHome(parentFile.getPath()), SimpleTextAttributes.GRAYED_ATTRIBUTES);
    }
    appendSwitched(renderer);
  }
  else if (getCount() != 1 || getDirectoryCount() != 0) {
    appendSwitched(renderer);
    appendCount(renderer);
  }
  else {
    appendSwitched(renderer);
  }

  final Icon addIcon = change.getAdditionalIcon();
  if (addIcon != null) {
    renderer.setIcon(addIcon);
  } else {
    if (filePath.isDirectory() || !isLeaf()) {
      renderer.setIcon(PlatformIcons.DIRECTORY_CLOSED_ICON);
    }
    else {
      renderer.setIcon(filePath.getFileType().getIcon());
    }
  }

  if (myDecorator != null) {
    myDecorator.decorate(change, renderer, renderer.isShowFlatten());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:51,代码来源:ChangesBrowserChangeNode.java

示例9: createForFile

import com.intellij.openapi.vcs.FilePath; //导入方法依赖的package包/类
public static GetFileContentOperation createForFile(FilePath filePath) throws CannotFindCvsRootException {
  String pathInRepository = CvsEntriesManager.getInstance().getRepositoryFor(filePath.getVirtualFileParent()) + "/" + filePath.getName();
  return new GetFileContentOperation(new File(pathInRepository),
                                     CvsRootProvider.createOn(filePath.getIOFile()),
                                     RevisionOrDateImpl.createOn(filePath.getVirtualFileParent(), filePath.getName()));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:GetFileContentOperation.java

示例10: filePath

import com.intellij.openapi.vcs.FilePath; //导入方法依赖的package包/类
public static String filePath(FilePath newFilePath) {
  return newFilePath.getName() + " (" + newFilePath.getParentPath().getPath() + ")";
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:TreeConflictRefreshablePanel.java


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