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


Java FileStatus.DELETED属性代码示例

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


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

示例1: getChanges

public List<ShelvedChange> getChanges(Project project) {
  if (myChanges == null) {
    try {
      myChanges = new ArrayList<ShelvedChange>();
      final List<? extends FilePatch> list = ShelveChangesManager.loadPatchesWithoutContent(project, PATH, null);
      for (FilePatch patch : list) {
        FileStatus status;
        if (patch.isNewFile()) {
          status = FileStatus.ADDED;
        }
        else if (patch.isDeletedFile()) {
          status = FileStatus.DELETED;
        }
        else {
          status = FileStatus.MODIFIED;
        }
        myChanges.add(new ShelvedChange(PATH, patch.getBeforeName(), patch.getAfterName(), status));
      }
    }
    catch (Exception e) {
      LOG.error("Failed to parse the file patch: [" + PATH + "]", e);
    }
  }
  return myChanges;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ShelvedChangeList.java

示例2: createChange

@NotNull
public static Change createChange(@NotNull Project project, @NotNull VirtualFile root,
                                  @Nullable String fileBefore,
                                  @Nullable HgRevisionNumber revisionBefore,
                                  @Nullable String fileAfter,
                                  HgRevisionNumber revisionAfter,
                                  FileStatus aStatus) {

  HgContentRevision beforeRevision =
    fileBefore == null || aStatus == FileStatus.ADDED ? null
                                                      : HgContentRevision
      .create(project, new HgFile(root, new File(root.getPath(), fileBefore)), revisionBefore);
  if (revisionAfter == null && fileBefore != null) {
    ContentRevision currentRevision =
      CurrentContentRevision.create(new HgFile(root, new File(root.getPath(), fileBefore)).toFilePath());
    return new Change(beforeRevision, currentRevision, aStatus);
  }
  HgContentRevision afterRevision =
    fileAfter == null || aStatus == FileStatus.DELETED ? null :
    HgContentRevision.create(project, new HgFile(root, new File(root.getPath(), fileAfter)), revisionAfter);
  return new Change(beforeRevision, afterRevision, aStatus);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:HgHistoryUtil.java

示例3: createChange

private Change createChange(final String path, final FileStatus status) {
  final ContentRevision beforeRevision = createBeforeRevision(path);
  final DiffContentRevision afterRevision = createAfterRevision(path);
  if (myReverse) {
    if (status == FileStatus.ADDED) {
      return new Change(afterRevision, null);
    }
    if (status == FileStatus.DELETED) {
      return new Change(null, beforeRevision);
    }
    return new Change(afterRevision, beforeRevision, status);
  }
  return new Change(status == FileStatus.ADDED ? null : beforeRevision,
                    status == FileStatus.DELETED ? null : afterRevision,
                    status);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:SvnDiffEditor.java

示例4: getChange

public Change getChange(Project project) {
  // todo unify with
  if (myChange == null) {
    File baseDir = new File(project.getBaseDir().getPath());

    File file = getAbsolutePath(baseDir, myBeforePath);
    FilePath beforePath = VcsUtil.getFilePath(file, false);
    beforePath.refresh();
    ContentRevision beforeRevision = null;
    if (myFileStatus != FileStatus.ADDED) {
      beforeRevision = new CurrentContentRevision(beforePath) {
        @Override
        @NotNull
        public VcsRevisionNumber getRevisionNumber() {
          return new TextRevisionNumber(VcsBundle.message("local.version.title"));
        }
      };
    }
    ContentRevision afterRevision = null;
    if (myFileStatus != FileStatus.DELETED) {
      FilePath afterPath = VcsUtil.getFilePath(getAbsolutePath(baseDir, myAfterPath), false);
      afterRevision = new PatchedContentRevision(project, beforePath, afterPath);
    }
    myChange = new Change(beforeRevision, afterRevision, myFileStatus);
  }
  return myChange;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:ShelvedChange.java

示例5: getFileStatus

public FileStatus getFileStatus() {
  if (BEFORE_PATH == null) {
    return FileStatus.ADDED;
  }
  if (SHELVED_PATH == null) {
    return FileStatus.DELETED;
  }
  return FileStatus.MODIFIED;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ShelvedBinaryFile.java

示例6: calcStatus

@NotNull
protected static FileStatus calcStatus(boolean old, boolean current) {
  if (old) {
    if (!current) {
      return FileStatus.DELETED;
    }
  }
  else if (current) {
    return FileStatus.ADDED;
  }
  return FileStatus.NOT_CHANGED;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:DefaultInspectionToolPresentation.java

示例7: getElementsChanged

public static <T extends PsiElement> Map<T, FileStatus> getElementsChanged(PsiElement file,
                                                                           PsiElement oldFile,
                                                                           final PsiFilter<T> filter) {
  final HashMap<T, FileStatus> result = new HashMap<T, FileStatus>();
  final List<T> oldElements = new ArrayList<T>();
  final List<T> elements = new ArrayList<T>();

  if (file == null) {
    oldFile.accept(filter.createVisitor(oldElements));
    calculateStatuses(elements, oldElements, result, filter);
    return result;
  }

  final Project project = file.getProject();

  file.accept(filter.createVisitor(elements));
  final VirtualFile vf = file.getContainingFile().getVirtualFile();
  FileStatus status = vf == null ? null : FileStatusManager.getInstance(project).getStatus(vf);
  if (status == null && oldFile == null) {
    status = FileStatus.ADDED;
  }
  if (status == FileStatus.ADDED ||
      status == FileStatus.DELETED ||
      status == FileStatus.DELETED_FROM_FS ||
      status == FileStatus.UNKNOWN) {
    for (T element : elements) {
      result.put(element, status);
    }
    return result;
  }

  if (oldFile == null) return result;
  oldFile.accept(filter.createVisitor(oldElements));
  calculateStatuses(elements, oldElements, result, filter);

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

示例8: getFileStatusForAbsentFile

private static FileStatus getFileStatusForAbsentFile(Entry entry) {
  if (entry == null || entry.isDirectory()) {
    return FileStatus.UNKNOWN;
  }
  if (entry.isRemoved()) {
    return FileStatus.DELETED;
  }
  return FileStatus.DELETED_FROM_FS;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:CvsStatusProvider.java

示例9: convertPropertyStatus

@NotNull
public static FileStatus convertPropertyStatus(final StatusType status) {
  if (status == null) {
    return FileStatus.UNKNOWN;
  }
  if (StatusType.STATUS_UNVERSIONED.equals(status)) {
    return FileStatus.UNKNOWN;
  }
  else if (StatusType.STATUS_MISSING.equals(status)) {
    return FileStatus.DELETED_FROM_FS;
  }
  else if (StatusType.STATUS_EXTERNAL.equals(status)) {
    return SvnFileStatus.EXTERNAL;
  }
  else if (StatusType.STATUS_OBSTRUCTED.equals(status)) {
    return SvnFileStatus.OBSTRUCTED;
  }
  else if (StatusType.STATUS_IGNORED.equals(status)) {
    return FileStatus.IGNORED;
  }
  else if (StatusType.STATUS_ADDED.equals(status)) {
    return FileStatus.ADDED;
  }
  else if (StatusType.STATUS_DELETED.equals(status)) {
    return FileStatus.DELETED;
  }
  else if (StatusType.STATUS_REPLACED.equals(status)) {
    return SvnFileStatus.REPLACED;
  }
  else if (status == StatusType.STATUS_CONFLICTED) {
    return FileStatus.MERGED_WITH_PROPERTY_CONFLICTS;
  }
  else if (status == StatusType.STATUS_MODIFIED) {
    return FileStatus.MODIFIED;
  }
  return FileStatus.NOT_CHANGED;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:SvnStatusConvertor.java

示例10: createChange

@NotNull
private Change createChange(@NotNull SvnTarget target1, @NotNull SvnTarget target2, @NotNull DiffPath diffPath) throws SvnBindException {
  // TODO: 1) Unify logic of creating Change instance with SvnDiffEditor and SvnChangeProviderContext
  // TODO: 2) If some directory is switched, files inside it are returned as modified in "svn diff --summarize", even if they are equal
  // TODO: to branch files by content - possibly add separate processing of all switched files
  // TODO: 3) Properties change is currently not added as part of result change like in SvnChangeProviderContext.patchWithPropertyChange

  SvnTarget subTarget1 = SvnUtil.append(target1, diffPath.path, true);
  String relativePath = SvnUtil.getRelativeUrl(SvnUtil.toDecodedString(target1), SvnUtil.toDecodedString(subTarget1));

  if (relativePath == null) {
    throw new SvnBindException("Could not get relative path for " + target1 + " and " + subTarget1);
  }

  SvnTarget subTarget2 = SvnUtil.append(target2, FileUtil.toSystemIndependentName(relativePath));

  FilePath target1Path = createFilePath(subTarget1, diffPath.isDirectory());
  FilePath target2Path = createFilePath(subTarget2, diffPath.isDirectory());

  FileStatus status = SvnStatusConvertor
    .convertStatus(SvnStatusHandler.getStatus(diffPath.itemStatus), SvnStatusHandler.getStatus(diffPath.propertiesStatus));

  // statuses determine changes needs to be done to "target1" to get "target2" state
  ContentRevision beforeRevision = status == FileStatus.ADDED
                                   ? null
                                   : createRevision(target1Path, target2Path, target1.getPegRevision(), status);
  ContentRevision afterRevision = status == FileStatus.DELETED
                                  ? null
                                  : createRevision(target2Path, target1Path, target2.getPegRevision(), status);

  return createChange(status, beforeRevision, afterRevision);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:CmdDiffClient.java

示例11: addDir

public void addDir(String path, String copyFromPath, long copyFromRevision) throws SVNException {
  FileStatus status = FileStatus.ADDED;
  if (myChanges.containsKey(path) && myChanges.get(path).getFileStatus() == FileStatus.DELETED) {
    // replaced file
    myChanges.remove(path);
    status = FileStatus.MODIFIED;
  }
  Change change = createChange(path, status);
  myChanges.put(path, change);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:SvnDiffEditor.java

示例12: addFile

public void addFile(String path, String copyFromPath, long copyFromRevision) throws SVNException {
  FileStatus status = FileStatus.ADDED;
  if (myChanges.containsKey(path) && myChanges.get(path).getFileStatus() == FileStatus.DELETED) {
    // replaced file
    myChanges.remove(path);
    status = FileStatus.MODIFIED;
  }
  Change change = createChange(path, status);
  myChanges.put(path, change);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:SvnDiffEditor.java

示例13: convertStatus

private static FileStatus convertStatus(@Nullable ContentRevision beforeRevision, @Nullable ContentRevision afterRevision) {
  if (beforeRevision == null) return FileStatus.ADDED;
  if (afterRevision == null) return FileStatus.DELETED;
  return FileStatus.MODIFIED;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:Change.java

示例14: parseChanges

/**
 * Parse changes from lines
 *
 * @param project        the context project
 * @param vcsRoot        the git root
 * @param thisRevision   the current revision
 * @param parentRevision the parent revision for this change list
 * @param s              the lines to parse
 * @param changes        a list of changes to update
 * @param ignoreNames    a set of names ignored during collection of the changes
 * @throws VcsException if the input format does not matches expected format
 */
public static void parseChanges(Project project,
                                VirtualFile vcsRoot,
                                @Nullable GitRevisionNumber thisRevision,
                                @Nullable GitRevisionNumber parentRevision,
                                StringScanner s,
                                Collection<Change> changes,
                                final Set<String> ignoreNames) throws VcsException {
  while (s.hasMoreData()) {
    FileStatus status = null;
    if (s.isEol()) {
      s.nextLine();
      continue;
    }
    if ("CADUMRT".indexOf(s.peek()) == -1) {
      // exit if there is no next character
      return;
    }
    String[] tokens = s.line().split("\t");
    final ContentRevision before;
    final ContentRevision after;
    final String path = tokens[tokens.length - 1];
    switch (tokens[0].charAt(0)) {
      case 'C':
      case 'A':
        before = null;
        status = FileStatus.ADDED;
        after = GitContentRevision.createRevision(vcsRoot, path, thisRevision, project, false, false, true);
        break;
      case 'U':
        status = FileStatus.MERGED_WITH_CONFLICTS;
      case 'M':
        if (status == null) {
          status = FileStatus.MODIFIED;
        }
        before = GitContentRevision.createRevision(vcsRoot, path, parentRevision, project, false, true, true);
        after = GitContentRevision.createRevision(vcsRoot, path, thisRevision, project, false, false, true);
        break;
      case 'D':
        status = FileStatus.DELETED;
        before = GitContentRevision.createRevision(vcsRoot, path, parentRevision, project, true, true, true);
        after = null;
        break;
      case 'R':
        status = FileStatus.MODIFIED;
        before = GitContentRevision.createRevision(vcsRoot, tokens[1], parentRevision, project, true, true, true);
        after = GitContentRevision.createRevision(vcsRoot, path, thisRevision, project, false, false, true);
        break;
      case 'T':
        status = FileStatus.MODIFIED;
        before = GitContentRevision.createRevision(vcsRoot, path, parentRevision, project, true, true, true);
        after = GitContentRevision.createRevisionForTypeChange(project, vcsRoot, path, thisRevision, true);
        break;
      default:
        throw new VcsException("Unknown file status: " + Arrays.asList(tokens));
    }
    if (ignoreNames == null || !ignoreNames.contains(path)) {
      changes.add(new Change(before, after, status));
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:72,代码来源:GitChangeUtils.java

示例15: parseChange

private static Change parseChange(final Project project, final VirtualFile vcsRoot, final List<GitRevisionNumber> parentRevisions,
                                  final GitLogStatusInfo statusInfo, final VcsRevisionNumber thisRevision) throws VcsException {
  final ContentRevision before;
  final ContentRevision after;
  FileStatus status = null;
  final String path = statusInfo.getFirstPath();
  @Nullable GitRevisionNumber firstParent = parentRevisions.isEmpty() ? null : parentRevisions.get(0);

  switch (statusInfo.getType()) {
    case ADDED:
      before = null;
      status = FileStatus.ADDED;
      after = GitContentRevision.createRevision(vcsRoot, path, thisRevision, project, false, false, true);
      break;
    case UNRESOLVED:
      status = FileStatus.MERGED_WITH_CONFLICTS;
    case MODIFIED:
      if (status == null) {
        status = FileStatus.MODIFIED;
      }
      final FilePath filePath = GitContentRevision.createPath(vcsRoot, path, false, true, true);
      before = GitContentRevision.createRevision(vcsRoot, path, firstParent, project, false, false, true);
      after = GitContentRevision.createRevision(filePath, thisRevision, project, null);
      break;
    case DELETED:
      status = FileStatus.DELETED;
      final FilePath filePathDeleted = GitContentRevision.createPath(vcsRoot, path, true, true, true);
      before = GitContentRevision.createRevision(filePathDeleted, firstParent, project, null);
      after = null;
      break;
    case COPIED:
    case RENAMED:
      status = FileStatus.MODIFIED;
      String secondPath = statusInfo.getSecondPath();
      final FilePath filePathAfterRename = GitContentRevision.createPath(vcsRoot, secondPath == null ? path : secondPath,
                                                                         false, false, true);
      before = GitContentRevision.createRevision(vcsRoot, path, firstParent, project, true, true, true);
      after = GitContentRevision.createRevision(filePathAfterRename, thisRevision, project, null);
      break;
    case TYPE_CHANGED:
      status = FileStatus.MODIFIED;
      final FilePath filePath2 = GitContentRevision.createPath(vcsRoot, path, false, true, true);
      before = GitContentRevision.createRevision(vcsRoot, path, firstParent, project, false, false, true);
      after = GitContentRevision.createRevision(filePath2, thisRevision, project, null);
      break;
    default:
      throw new AssertionError("Unknown file status: " + statusInfo);
  }
  return new Change(before, after, status);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:50,代码来源:GitChangesParser.java


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