本文整理汇总了Java中com.intellij.openapi.vcs.FileStatus.MODIFIED属性的典型用法代码示例。如果您正苦于以下问题:Java FileStatus.MODIFIED属性的具体用法?Java FileStatus.MODIFIED怎么用?Java FileStatus.MODIFIED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.intellij.openapi.vcs.FileStatus
的用法示例。
在下文中一共展示了FileStatus.MODIFIED属性的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: getFileStatus
@Override
@Nullable
public FileStatus getFileStatus(@NotNull 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;
}
示例3: createPropertyChange
@NotNull
private Change createPropertyChange(@NotNull Change change, @NotNull Status svnStatus, @Nullable Status deletedStatus)
throws SVNException {
final File ioFile = ChangesUtil.getFilePath(change).getIOFile();
final File beforeFile = deletedStatus != null ? deletedStatus.getFile() : ioFile;
// TODO: There are cases when status output is like (on newly added file with some properties that is locally deleted)
// <entry path="some_path"> <wc-status item="missing" revision="-1" props="modified"> </wc-status> </entry>
// TODO: For such cases in current logic we'll have Change with before revision containing SVNRevision.UNDEFINED
// TODO: Analyze if this logic is OK or we should update flow somehow (for instance, to have null before revision)
ContentRevision beforeRevision =
!svnStatus.isProperty(StatusType.STATUS_ADDED) || deletedStatus != null ? createPropertyRevision(change, beforeFile, true) : null;
ContentRevision afterRevision = !svnStatus.isProperty(StatusType.STATUS_DELETED) ? createPropertyRevision(change, ioFile, false) : null;
FileStatus status =
deletedStatus != null ? FileStatus.MODIFIED : SvnStatusConvertor.convertPropertyStatus(svnStatus.getPropertiesStatus());
return new Change(beforeRevision, afterRevision, status);
}
示例4: getFileStatus
public FileStatus getFileStatus() {
if (BEFORE_PATH == null) {
return FileStatus.ADDED;
}
if (SHELVED_PATH == null) {
return FileStatus.DELETED;
}
return FileStatus.MODIFIED;
}
示例5: isStatusForAddition
@Override
protected boolean isStatusForAddition(FileStatus status) {
return status == FileStatus.UNKNOWN ||
status == FileStatus.MODIFIED ||
status == FileStatus.MERGED_WITH_CONFLICTS ||
status == FileStatus.ADDED;
}
示例6: actionPerformed
@Override
public void actionPerformed(final CvsContext context) {
VirtualFile[] selectedFiles = context.getSelectedFiles();
int modifiedFiles = 0;
VirtualFile firstModifiedFile = null;
for(VirtualFile file: selectedFiles) {
if (FileStatusManager.getInstance(context.getProject()).getStatus(file) == FileStatus.MODIFIED) {
if (firstModifiedFile == null) {
firstModifiedFile = file;
}
modifiedFiles++;
}
}
if (modifiedFiles > 0) {
String message;
if (modifiedFiles == 1) {
message = CvsBundle.message("unedit.confirmation.single", firstModifiedFile.getPresentableUrl());
}
else {
message = CvsBundle.message("unedit.confirmation.multiple", modifiedFiles);
}
if (Messages.showOkCancelDialog(context.getProject(), message, CvsBundle.message("unedit.confirmation.title"), Messages.getQuestionIcon()) != Messages.OK) {
return;
}
}
super.actionPerformed(context);
}
示例7: 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;
}
示例8: 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);
}
示例9: 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);
}
示例10: 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;
}
示例11: 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));
}
}
}
示例12: 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);
}
示例13: getStatus
public static FileStatus getStatus(VirtualFile file, Entry entry) {
if (file == null) {
return getFileStatusForAbsentFile(entry);
}
if (entry == null) {
return getFileStatusForAbsentEntry(file);
}
if (entry.isDirectory()) {
return FileStatus.NOT_CHANGED;
}
if (entry.isAddedFile()) {
return FileStatus.ADDED;
}
if (entry.isRemoved()) {
return FileStatus.DELETED;
}
if (entry.isResultOfMerge()) {
if (entry.isConflict()) {
return FileStatus.MERGED_WITH_CONFLICTS;
}
else {
return FileStatus.MERGE;
}
}
Date revisionDate = entry.getLastModified();
if (revisionDate == null) {
return FileStatus.MODIFIED;
}
final long entryDate = revisionDate.getTime();
final long fileDate = CvsVfsUtil.getTimeStamp(file);
if (LOG.isDebugEnabled()) {
LOG.debug("getStatus() for " + file.getPath() + ": entry date " + entryDate + ", file date " + fileDate);
}
return (timeStampsAreEqual(entryDate, fileDate)) ? FileStatus.NOT_CHANGED : FileStatus.MODIFIED;
}
示例14: convertStatus
@NotNull
public static FileStatus convertStatus(@Nullable final Status status) {
if (status == null) {
return FileStatus.UNKNOWN;
}
if (status.is(StatusType.STATUS_UNVERSIONED)) {
return FileStatus.UNKNOWN;
}
else if (status.is(StatusType.STATUS_MISSING)) {
return FileStatus.DELETED_FROM_FS;
}
else if (status.is(StatusType.STATUS_EXTERNAL)) {
return SvnFileStatus.EXTERNAL;
}
else if (status.is(StatusType.STATUS_OBSTRUCTED)) {
return SvnFileStatus.OBSTRUCTED;
}
else if (status.is(StatusType.STATUS_IGNORED)) {
return FileStatus.IGNORED;
}
else if (status.is(StatusType.STATUS_ADDED)) {
return FileStatus.ADDED;
}
else if (status.is(StatusType.STATUS_DELETED)) {
return FileStatus.DELETED;
}
else if (status.is(StatusType.STATUS_REPLACED)) {
return SvnFileStatus.REPLACED;
}
else if (status.getContentsStatus() == StatusType.STATUS_CONFLICTED ||
status.getPropertiesStatus() == StatusType.STATUS_CONFLICTED) {
if (status.getContentsStatus() == StatusType.STATUS_CONFLICTED &&
status.getPropertiesStatus() == StatusType.STATUS_CONFLICTED) {
return FileStatus.MERGED_WITH_BOTH_CONFLICTS;
}
else if (status.getContentsStatus() == StatusType.STATUS_CONFLICTED) {
return FileStatus.MERGED_WITH_CONFLICTS;
}
return FileStatus.MERGED_WITH_PROPERTY_CONFLICTS;
}
else if (status.getContentsStatus() == StatusType.STATUS_MODIFIED ||
status.getPropertiesStatus() == StatusType.STATUS_MODIFIED) {
return FileStatus.MODIFIED;
}
else if (status.isSwitched()) {
return FileStatus.SWITCHED;
}
else if (status.isCopied()) {
return FileStatus.ADDED;
}
return FileStatus.NOT_CHANGED;
}