Java Code Examples for com.intellij.openapi.vcs.FileStatus#MODIFIED

The following examples show how to use com.intellij.openapi.vcs.FileStatus#MODIFIED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MultipleItemAction.java    From azure-devops-intellij with MIT License 6 votes vote down vote up
/**
 * This method enables the action if one or more items are selected.
 *
 * @param project
 * @param files
 * @return
 */
protected boolean isEnabled(final Project project, final VirtualFile[] files) {
    if (files.length == 0 || project == null) {
        return false;
    }

    final FileStatusManager fileStatusManager = FileStatusManager.getInstance(project);
    for (VirtualFile file : files) {
        final FileStatus fileStatus = fileStatusManager.getStatus(file);
        if (fileStatus != FileStatus.NOT_CHANGED && fileStatus != FileStatus.MODIFIED && fileStatus != FileStatus.HIJACKED) {
            return false;
        }
    }

    return true;
}
 
Example 2
Source File: ShelvedChangeList.java    From consulo with Apache License 2.0 6 votes vote down vote up
public List<ShelvedChange> getChanges(Project project) {
  if (myChanges == null) {
    try {
      myChanges = new ArrayList<>();
      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;
}
 
Example 3
Source File: ChangelistConflictFileStatusProvider.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
@Nullable
public FileStatus getFileStatus(VirtualFile virtualFile) {
  ChangelistConflictTracker.Options options = myConflictTracker.getOptions();
  if (!options.TRACKING_ENABLED) {
    return null;
  }
  boolean conflict = myConflictTracker.hasConflict(virtualFile);
  if (conflict && options.HIGHLIGHT_CONFLICTS) {
    return CHANGELIST_CONFLICT;
  }
  else if (options.HIGHLIGHT_NON_ACTIVE_CHANGELIST) {
    FileStatus status = myChangeListManager.getStatus(virtualFile);
    if (status == FileStatus.MODIFIED || status == FileStatus.ADDED) {
      if (!myConflictTracker.isFromActiveChangelist(virtualFile)) {
        return status == FileStatus.MODIFIED ? MODIFIED_OUTSIDE : ADDED_OUTSIDE;
      }
    }
  }
  return null;
}
 
Example 4
Source File: ShelvedBinaryFile.java    From consulo with Apache License 2.0 5 votes vote down vote up
public FileStatus getFileStatus() {
  if (BEFORE_PATH == null) {
    return FileStatus.ADDED;
  }
  if (SHELVED_PATH == null) {
    return FileStatus.DELETED;
  }
  return FileStatus.MODIFIED;
}
 
Example 5
Source File: Change.java    From consulo with Apache License 2.0 4 votes vote down vote up
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;
}