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


Java FileStatus类代码示例

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


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

示例1: testAdd

import com.intellij.openapi.vcs.FileStatus; //导入依赖的package包/类
@Test
public void testAdd() throws Exception {
  enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
  enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE);

  final VirtualFile d1 = createDirInCommand(myWorkingCopyDir, "d1");

  final VirtualFile f11 = createFileInCommand(d1, "f11.txt", "123\n456");
  final VirtualFile f12 = createFileInCommand(d1, "f12.txt", "----");

  // r1, addition without history
  checkin();

  final SvnVcs vcs = SvnVcs.getInstance(myProject);
  vcs.invokeRefreshSvnRoots();
  final CommittedChangesProvider<SvnChangeList,ChangeBrowserSettings> committedChangesProvider = vcs.getCommittedChangesProvider();
  final List<SvnChangeList> changeListList =
    committedChangesProvider.getCommittedChanges(committedChangesProvider.createDefaultSettings(),
                                                 new SvnRepositoryLocation(myRepoUrl), 0);
  checkList(changeListList, 1, new Data[] {new Data(absPath(f11), FileStatus.ADDED, null),
    new Data(absPath(f12), FileStatus.ADDED, null), new Data(absPath(d1), FileStatus.ADDED, null)});
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:SvnCommittedViewTest.java

示例2: testCopyDir

import com.intellij.openapi.vcs.FileStatus; //导入依赖的package包/类
@Test
public void testCopyDir() throws Exception {
  final File trunk = new File(myTempDirFixture.getTempDirPath(), "trunk");
  trunk.mkdir();
  Thread.sleep(100);
  final File folder = new File(trunk, "folder");
  folder.mkdir();
  Thread.sleep(100);
  new File(folder, "f1.txt").createNewFile();
  new File(folder, "f2.txt").createNewFile();
  Thread.sleep(100);

  runInAndVerifyIgnoreOutput("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk");
  runInAndVerifyIgnoreOutput("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch");

  final SvnVcs vcs = SvnVcs.getInstance(myProject);
  vcs.invokeRefreshSvnRoots();
  final CommittedChangesProvider<SvnChangeList,ChangeBrowserSettings> committedChangesProvider = vcs.getCommittedChangesProvider();
  final List<SvnChangeList> changeListList =
    committedChangesProvider.getCommittedChanges(committedChangesProvider.createDefaultSettings(),
                                                 new SvnRepositoryLocation(myRepoUrl + "/branch"), 0);
  checkList(changeListList, 2, new Data[] {new Data(new File(myWorkingCopyDir.getPath(), "branch").getAbsolutePath(), FileStatus.ADDED, "- copied from /trunk")});
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:SvnCommittedViewTest.java

示例3: createPropertyChange

import com.intellij.openapi.vcs.FileStatus; //导入依赖的package包/类
@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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:SvnChangeProviderContext.java

示例4: getChanges

import com.intellij.openapi.vcs.FileStatus; //导入依赖的package包/类
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,代码行数:26,代码来源:ShelvedChangeList.java

示例5: testDeleteDirRecursively

import com.intellij.openapi.vcs.FileStatus; //导入依赖的package包/类
@Test
public void testDeleteDirRecursively() throws Exception {
  GuiUtils.runOrInvokeAndWait(new Runnable() {
    @Override
    public void run() {
      ApplicationManager.getApplication().runWriteAction(new Runnable() {
        @Override
        public void run() {
          final VirtualFile dir = myProjectRoot.findChild("dir");
          myDirtyScope.addDirtyDirRecursively(VcsUtil.getFilePath(dir));
          FileUtil.delete(VfsUtilCore.virtualToIoFile(dir));
        }
      });
    }
  });
  assertChanges(new VirtualFile[] { dir_ctxt, subdir_dtxt },
                new FileStatus[] { DELETED, DELETED });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GitChangeProviderVersionedTest.java

示例6: update

import com.intellij.openapi.vcs.FileStatus; //导入依赖的package包/类
@Override
protected void update(final VcsContext vcsContext, final Presentation presentation) {
  super.update(vcsContext, presentation);
  if (presentation.isVisible() && presentation.isEnabled()) {
    final ChangeList[] selectedChangeLists = vcsContext.getSelectedChangeLists();
    final Change[] selectedChanges = vcsContext.getSelectedChanges();
    if (vcsContext.getPlace().equals(ActionPlaces.CHANGES_VIEW_POPUP)) {
      if (selectedChangeLists != null && selectedChangeLists.length > 0) {
        presentation.setEnabled(selectedChangeLists.length == 1 && !ContainerUtil.isEmpty(selectedChangeLists[0].getChanges()));
      }
      else {
        presentation.setEnabled (selectedChanges != null && selectedChanges.length > 0);
      }
    }
    if (presentation.isEnabled() && selectedChanges != null) {
      final ChangeListManager changeListManager = ChangeListManager.getInstance(vcsContext.getProject());
      for(Change c: selectedChanges) {
        if (c.getFileStatus() == FileStatus.HIJACKED && changeListManager.getChangeList(c) == null) {
          presentation.setEnabled(false);
          break;
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:AbstractCommitChangesAction.java

示例7: update

import com.intellij.openapi.vcs.FileStatus; //导入依赖的package包/类
public void update() {
  final int deleted = myInfoCalculator.getDeleted();
  final int modified = myInfoCalculator.getModified();
  final int cntNew = myInfoCalculator.getNew();

  myRootPanel.clear();
  if (cntNew > 0) {
    appendText(cntNew, myInfoCalculator.getIncludedNew(), FileStatus.ADDED, "commit.legend.new");
    if (modified > 0 || deleted > 0) {
      appendSpace();
    }
  }
  if (modified > 0) {
    appendText(modified, myInfoCalculator.getIncludedModified(), FileStatus.MODIFIED, "commit.legend.modified");
    if (deleted > 0) {
      appendSpace();
    }
  }
  if (deleted > 0) {
    appendText(deleted, myInfoCalculator.getIncludedDeleted(), FileStatus.DELETED, "commit.legend.deleted");
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:CommitLegendPanel.java

示例8: getStatus

import com.intellij.openapi.vcs.FileStatus; //导入依赖的package包/类
protected FileStatus getStatus(Object value, FilePath path) {
  final FileStatus fileStatus;
  if (value instanceof Change) {
    fileStatus = ((Change) value).getFileStatus();
  }
  else {
    final VirtualFile virtualFile = path.getVirtualFile();
    if (virtualFile != null) {
      fileStatus = myFileStatusManager.getStatus(virtualFile);
    }
    else {
      fileStatus = FileStatus.NOT_CHANGED;
    }
  }
  return fileStatus;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:VirtualFileListCellRenderer.java

示例9: getFileStatus

import com.intellij.openapi.vcs.FileStatus; //导入依赖的package包/类
@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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ChangelistConflictFileStatusProvider.java

示例10: createChange

import com.intellij.openapi.vcs.FileStatus; //导入依赖的package包/类
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,代码行数:17,代码来源:SvnDiffEditor.java

示例11: hasReportedProblems

import com.intellij.openapi.vcs.FileStatus; //导入依赖的package包/类
@Override
public boolean hasReportedProblems() {
  final GlobalInspectionContextImpl context = getContext();
  if (!isDisposed() && context.getUIOptions().SHOW_ONLY_DIFF) {
    for (CommonProblemDescriptor descriptor : getProblemToElements().keySet()) {
      if (getProblemStatus(descriptor) != FileStatus.NOT_CHANGED) {
        return true;
      }
    }
    if (myOldProblemElements != null) {
      for (RefEntity entity : myOldProblemElements.keySet()) {
        if (getElementStatus(entity) != FileStatus.NOT_CHANGED) {
          return true;
        }
      }
    }
    return false;
  }
  if (!getProblemElements().isEmpty()) return true;
  return !isDisposed() && context.getUIOptions().SHOW_DIFF_WITH_PREVIOUS_RUN && myOldProblemElements != null && !myOldProblemElements.isEmpty();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:DefaultInspectionToolPresentation.java

示例12: createChange

import com.intellij.openapi.vcs.FileStatus; //导入依赖的package包/类
@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,代码行数:23,代码来源:HgHistoryUtil.java

示例13: containsOnlyDiff

import com.intellij.openapi.vcs.FileStatus; //导入依赖的package包/类
private boolean containsOnlyDiff(@NotNull Map<String, Set<RefEntity>> packageContents) {
  for (String packageName : packageContents.keySet()) {
    final Set<RefEntity> refElements = packageContents.get(packageName);
    if (refElements != null){
      for (RefEntity refElement : refElements) {
        if (getElementStatus(refElement) != FileStatus.NOT_CHANGED){
          return true;
        }
      }
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:UnusedDeclarationPresentation.java

示例14: testConflictCC

import com.intellij.openapi.vcs.FileStatus; //导入依赖的package包/类
/**
 * Create a file with conflicting content.
 */
@Test
public void testConflictCC() throws Exception {
  modifyFileInBranches("z.txt", FileAction.CREATE, FileAction.CREATE);
  VirtualFile zfile = myProjectRoot.findChild("z.txt");
  assertChanges(zfile, FileStatus.MERGED_WITH_CONFLICTS);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:GitChangeProviderConflictTest.java

示例15: testDelete

import com.intellij.openapi.vcs.FileStatus; //导入依赖的package包/类
@Test
public void testDelete() throws Exception {
  enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
  enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE);

  final VirtualFile d1 = createDirInCommand(myWorkingCopyDir, "d1");

  final VirtualFile f11 = createFileInCommand(d1, "f11.txt", "123\n456");
  final VirtualFile f12 = createFileInCommand(d1, "f12.txt", "----");

  // r1, addition without history
  checkin();

  deleteFileInCommand(f11);
  
  checkin();
  update();

  deleteFileInCommand(d1);

  checkin();

  final SvnVcs vcs = SvnVcs.getInstance(myProject);
  vcs.invokeRefreshSvnRoots();
  final CommittedChangesProvider<SvnChangeList,ChangeBrowserSettings> committedChangesProvider = vcs.getCommittedChangesProvider();
  final List<SvnChangeList> changeListList =
    committedChangesProvider.getCommittedChanges(committedChangesProvider.createDefaultSettings(),
                                                 new SvnRepositoryLocation(myRepoUrl), 0);
  checkList(changeListList, 2, new Data[] {new Data(absPath(f11), FileStatus.DELETED, null)});
  checkList(changeListList, 3, new Data[] {new Data(absPath(d1), FileStatus.DELETED, null)});
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:SvnCommittedViewTest.java


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