• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Change类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_force_checkout_in_case_of_local_changes_that_would_be_overwritten_by_checkout

import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
public void test_force_checkout_in_case_of_local_changes_that_would_be_overwritten_by_checkout() {
  // IDEA-99849
  prepareLocalChangesOverwrittenBy(myUltimate);

  GitBranchWorker brancher = new GitBranchWorker(myProject, myPlatformFacade, myGit, new TestUiHandler() {
    @Override
    public int showSmartOperationDialog(@NotNull Project project,
                                        @NotNull List<Change> changes,
                                        @NotNull Collection<String> paths,
                                        @NotNull String operation,
                                        @Nullable String forceButton) {
      return GitSmartOperationDialog.FORCE_EXIT_CODE;
    }
  });
  brancher.checkoutNewBranchStartingFrom("new_branch", "feature", myRepositories);

  assertEquals("Notification about successful branch creation is incorrect",
               "Checked out new branch <b><code>new_branch</code></b> from <b><code>feature</code></b>",
               myVcsNotifier.getLastNotification().getContent());
  assertCurrentBranch("new_branch");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:GitBranchWorkerTest.java


示例2: findRowContainingFile

import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
private int findRowContainingFile(@NotNull TreeNode root, @NotNull final VirtualFile toSelect) {
  final Ref<Integer> row = Ref.create(-1);
  TreeUtil.traverse(root, new TreeUtil.Traverse() {
    @Override
    public boolean accept(Object node) {
      if (node instanceof DefaultMutableTreeNode) {
        Object userObject = ((DefaultMutableTreeNode)node).getUserObject();
        if (userObject instanceof Change) {
          if (matches((Change)userObject, toSelect)) {
            TreeNode[] path = ((DefaultMutableTreeNode)node).getPath();
            row.set(myTree.getRowForPath(new TreePath(path)));
          }
        }
      }

      return row.get() == -1;
    }
  });
  return row.get();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ChangesTreeList.java


示例3: checkFilesAreInList

import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
/**
 * Updates the change list manager and checks that the given files are in the default change list.
 * @param only Set this to true if you want ONLY the specified files to be in the change list.
 *             If set to false, the change list may contain some other files apart from the given ones.
 * @param files Files to be checked.
 */
public void checkFilesAreInList(boolean only, VirtualFile... files) {
  ensureUpToDate();

  final Collection<Change> changes = peer.getDefaultChangeList().getChanges();
  if (only) {
    Assert.assertEquals(changes.size(), files.length);
  }
  final Collection<VirtualFile> filesInChangeList = new HashSet<VirtualFile>();
  for (Change c : changes) {
    filesInChangeList.add(c.getVirtualFile());
  }
  for (VirtualFile f : files) {
    Assert.assertTrue(filesInChangeList.contains(f));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:HgTestChangeListManager.java


示例4: showLocalCommit

import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
private void showLocalCommit() {
  final Collection<FilePath> files = gatherChangedPaths();

  // for changes to be detected, we need switch to background change list manager update thread and back to dispatch thread
  // so callback is used; ok to be called after VCS update markup closed: no remote operations
  final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
  changeListManager.invokeAfterUpdate(new Runnable() {
    public void run() {
      Collection<Change> changes = new ArrayList<Change>();
      for (FilePath file : files) {
        ContainerUtil.addIfNotNull(changes, changeListManager.getChange(file));
      }

      CommitChangeListDialog.commitChanges(myProject, changes, null, null, myMerger.getComment());
      prepareAndShowResults();
    }
  }, InvokeAfterUpdateMode.SYNCHRONOUS_CANCELLABLE, myTitle,
    new Consumer<VcsDirtyScopeManager>() {
      public void consume(final VcsDirtyScopeManager vcsDirtyScopeManager) {
        vcsDirtyScopeManager.filePathsDirty(files, null);
      }
    }, null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:SvnIntegrateChangesTask.java


示例5: testRollbackRenameDir

import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
@Test
public void testRollbackRenameDir() throws Exception {
  final VirtualFile child = prepareDirectoriesForRename();
  renameFileInCommand(child, "newchild");

  final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
  changeListManager.ensureUpToDate(false);
  final Change change = changeListManager.getChange(myWorkingCopyDir.findChild("newchild"));
  Assert.assertNotNull(change);

  final List<VcsException> exceptions = new ArrayList<VcsException>();
  SvnVcs.getInstance(myProject).getRollbackEnvironment().rollbackChanges(Collections.singletonList(change), exceptions,
                                                                         RollbackProgressListener.EMPTY);
  Assert.assertTrue(exceptions.isEmpty());
  Assert.assertFalse(new File(myWorkingCopyDir.getPath(), "newchild").exists());
  Assert.assertTrue(new File(myWorkingCopyDir.getPath(), "child").exists());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:SvnRenameTest.java


示例6: valueChanged

import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
@Override
public void valueChanged(@Nullable ListSelectionEvent event) {
  if (event != null && event.getValueIsAdjusting()) return;
  int rows = getGraphTable().getSelectedRowCount();
  if (rows < 1 || rows > MAX_SELECTED_COMMITS) {
    myChangesLoadingPane.stopLoading();
    myChangesBrowser.getViewer().setEmptyText(rows < 1 ? "" : "Too many commits selected.");
    myChangesBrowser.setChangesToDisplay(Collections.<Change>emptyList());
  }
  else {
    List<Change> selectedChanges = getSelectedChanges();
    if (selectedChanges != null) {
      myChangesLoadingPane.stopLoading();
      myChangesBrowser.setChangesToDisplay(selectedChanges);
    }
    else {
      myChangesBrowser.setChangesToDisplay(Collections.<Change>emptyList());
      setDefaultEmptyText(myChangesBrowser);
      myChangesLoadingPane.startLoading();
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:MainFrame.java


示例7: insertPathsChanges

import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
private void insertPathsChanges(Map<String, Long> paths, CommittedChangeList list, long listId) throws VcsException {
  final PreparedStatement insert = myConnection.getOrCreatePreparedStatement(SqliteTables.PREPARED_INSERT_PATH_2_REVS,
    new ThrowableConvertor<Connection, PreparedStatement, SQLException>() {
      @Override
      public PreparedStatement convert(Connection connection) throws SQLException {
        return connection.prepareStatement("INSERT INTO " + SqliteTables.PATHS_2_REVS.TABLE_NAME +
          " ( " + StringUtil.join(Arrays.asList(SqliteTables.PATHS_2_REVS.PATH_FK, SqliteTables.PATHS_2_REVS.REVISION_FK,
          SqliteTables.PATHS_2_REVS.TYPE, SqliteTables.PATHS_2_REVS.COPY_PATH_ID, SqliteTables.PATHS_2_REVS.DELETE_PATH_ID,
          SqliteTables.PATHS_2_REVS.VISIBLE), " , ") +
          ") VALUES (?,?,?,?,?,?)", Statement.RETURN_GENERATED_KEYS);
      }
    });
  try {
    insert.setLong(2, listId);
    final Collection<Change> withMoved = list.getChangesWithMovedTrees();
    final Set<Change> simple = new HashSet<Change>(list.getChanges());
    for (Change change : withMoved) {
      insertOneChange(paths, insert, change, simple.contains(change));
    }
  }
  catch (SQLException e) {
    throw new VcsException(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:VcsSqliteLayer.java


示例8: zip

import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
@Override
public CommittedChangeList zip(final RepositoryLocationGroup group, final List<CommittedChangeList> lists) {
  if (lists.size() == 1) {
    return lists.get(0);
  }
  final CommittedChangeList victim = ReceivedChangeList.unwrap(lists.get(0));
  final ReceivedChangeList result = new ReceivedChangeList(victim);
  result.setForcePartial(false);
  final Set<Change> baseChanges = new HashSet<Change>();

  for (CommittedChangeList list : lists) {
    baseChanges.addAll(ReceivedChangeList.unwrap(list).getChanges());

    final Collection<Change> changes = list.getChanges();
    for (Change change : changes) {
      if (! result.getChanges().contains(change)) {
        result.addChange(change);
      }
    }
  }
  result.setForcePartial(baseChanges.size() != result.getChanges().size());
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:CommittedChangesCache.java


示例9: zip

import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
public CommittedChangeList zip(final RepositoryLocationGroup group, final List<CommittedChangeList> lists) {
  if (lists.size() == 1) {
    return lists.get(0);
  }
  final CommittedChangeList result = lists.get(0);
  for (int i = 1; i < lists.size(); i++) {
    final CommittedChangeList list = lists.get(i);
    for (Change change : list.getChanges()) {
      final Collection<Change> resultChanges = result.getChanges();
      if (! resultChanges.contains(change)) {
        resultChanges.add(change);
      }
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:VcsCommittedListsZipperAdapter.java


示例10: updateChangesImpl

import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
private static void updateChangesImpl(final Collection<Change> changes, final ChangeWrapper wrapper) {
  Collection<File> deletedOrReplaced = ContainerUtil.newHashSet();
  Collection<File> toRefresh = ContainerUtil.newHashSet();
  for (Change change : changes) {
    if ((! wrapper.beforeNull(change)) && (wrapper.movedOrRenamedOrReplaced(change) || (wrapper.afterNull(change)))) {
      deletedOrReplaced.add(wrapper.getBeforeFile(change));
    } else if (!wrapper.beforeNull(change)) {
      toRefresh.add(wrapper.getBeforeFile(change));
    }
    if ((! wrapper.afterNull(change)) &&
        (wrapper.beforeNull(change) || (! Comparing.equal(change.getAfterRevision().getFile(), change.getBeforeRevision().getFile())))
       ) {
      toRefresh.add(wrapper.getAfterFile(change));
    }
  }

  refreshFiles(toRefresh);
  refreshDeletedOrReplaced(deletedOrReplaced);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:RefreshVFsSynchronously.java


示例11: processIntersection

import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
private void processIntersection(@NotNull ContinuationContext context, @NotNull Intersection intersection) {
  //noinspection EnumSwitchStatementWhichMissesCases
  switch (myInteraction.selectLocalChangesAction(myMergeAll)) {
    case shelve:
      context.next(new ShelveLocalChangesTask(myMergeContext, myInteraction, intersection));
      break;
    case cancel:
      context.cancelEverything();
      break;
    case inspect:
      // here's cast is due to generic's bug
      @SuppressWarnings("unchecked") Collection<Change> changes = (Collection<Change>)intersection.getChangesSubset().values();
      myInteraction
        .showIntersectedLocalPaths(ContainerUtil.sorted(ChangesUtil.getPaths(changes), FilePathByPathComparator.getInstance()));
      context.cancelEverything();
      break;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:LocalChangesPromptTask.java


示例12: testDoubleMoveBack

import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
@Test
public void testDoubleMoveBack() throws Exception {
  enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
  final VirtualFile file = createFileInCommand("a.txt", "old content");
  final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
  changeListManager.ensureUpToDate(false);

  final LocalChangeList list = changeListManager.addChangeList("test", null);
  final LocalChangeList target = changeListManager.addChangeList("target", null);
  changeListManager.moveChangesTo(list, new Change[] {changeListManager.getChange(file)});

  myScheme.doTest(new Runnable() {
    @Override
    public void run() {
      changeListManager.moveChangesTo(target, new Change[] {changeListManager.getChange(file)});
      checkFilesAreInList(new VirtualFile[] {file}, target.getName(), changeListManager);
      changeListManager.moveChangesTo(list, new Change[] {changeListManager.getChange(file)});
      checkFilesAreInList(new VirtualFile[] {file}, list.getName(), changeListManager);
    }
  });

  checkFilesAreInList(new VirtualFile[] {file}, list.getName(), changeListManager);

  changeListManager.ensureUpToDate(false);
  checkFilesAreInList(new VirtualFile[] {file}, list.getName(), changeListManager);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:SvnConcurrentChangeListManagerTest.java


示例13: calculate

import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
private void calculate() throws VcsException {
  // TODO: Seems that filePath detection could be replaced with "svn info -r <revisionBefore>" - and not call
  // TODO: "svn log -r HEAD:<revisionBefore>" and track copies manually (which also is not correct for all cases).
  if (!searchForUrl(svnRootUrl) && !(hasAccess(repositoryUrl) && searchForUrl(repositoryUrl))) {
    filePath = searchFromHead(svnRootUrl);
  }
  else {
    if (changeList[0].getChanges().size() == 1) {
      final ContentRevision afterRevision = changeList[0].getChanges().iterator().next().getAfterRevision();

      filePath = afterRevision != null ? afterRevision.getFile() : filePath;
    }
    else {
      final Change targetChange = changeList[0].getByPath(repositoryRelativeUrl);

      filePath = targetChange == null ? searchFromHead(svnRootUrl) : filePath;
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:SingleCommittedListProvider.java


示例14: testCommitImpl

import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
private File testCommitImpl(File wc1) throws IOException {
  Assert.assertTrue(wc1.isDirectory());
  final File file = FileUtil.createTempFile(wc1, "file", ".txt");
  final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file);
  Assert.assertNotNull(vf);
  final ArrayList<VirtualFile> files = new ArrayList<VirtualFile>();
  files.add(vf);
  final List<VcsException> exceptions = myVcs.getCheckinEnvironment().scheduleUnversionedFilesForAddition(files);
  Assert.assertTrue(exceptions.isEmpty());

  final Change change = new Change(null, new CurrentContentRevision(VcsUtil.getFilePath(vf)));
  final List<VcsException> commit = myVcs.getCheckinEnvironment().commit(Collections.singletonList(change), "commit");
  Assert.assertTrue(commit.isEmpty());
  ++ myExpectedCreds;
  ++ myExpectedCert;
  return file;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:SvnNativeClientAuthTest.java


示例15: addOrReplaceChange

import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
private static void addOrReplaceChange(final List<Change> changes, final Change c) {
  final ContentRevision beforeRev = c.getBeforeRevision();
  // todo!!! further improvements needed
  if (beforeRev != null) {
    final String beforeName = beforeRev.getFile().getName();
    final String beforeAbsolutePath = beforeRev.getFile().getIOFile().getAbsolutePath();
    for(Change oldChange: changes) {
      ContentRevision rev = oldChange.getAfterRevision();
      // first compare name, which is many times faster - to remove 99% not matching
      if (rev != null && (rev.getFile().getName().equals(beforeName)) && rev.getFile().getIOFile().getAbsolutePath().equals(beforeAbsolutePath)) {
        changes.remove(oldChange);
        if (oldChange.getBeforeRevision() != null || c.getAfterRevision() != null) {
          changes.add(new Change(oldChange.getBeforeRevision(), c.getAfterRevision()));
        }
        return;
      }
    }
  }
  changes.add(c);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:CommittedChangesTreeBrowser.java


示例16: testMovePackageToParent

import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
@Test
public void testMovePackageToParent() throws Exception {
  enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
  final VirtualFile child = createDirInCommand(myWorkingCopyDir, "child");
  final VirtualFile grandChild = createDirInCommand(child, "grandChild");
  createFileInCommand(grandChild, "a.txt", "a");
  checkin();
  final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);

  moveFileInCommand(grandChild, myWorkingCopyDir);
  refreshVfs();   // wait for end of refresh operations initiated from SvnFileSystemListener
  changeListManager.ensureUpToDate(false);
  final List<Change> changes = new ArrayList<Change>(changeListManager.getDefaultChangeList().getChanges());
  Assert.assertEquals(listToString(changes), 2, changes.size());
  sortChanges(changes);
  verifyChange(changes.get(0), "child" + File.separatorChar + "grandChild", "grandChild");
  verifyChange(changes.get(1), "child" + File.separatorChar + "grandChild" + File.separatorChar + "a.txt", "grandChild" + File.separatorChar + "a.txt");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:SvnRenameTest.java


示例17: testRollbackRenameDir

import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
@Test
public void testRollbackRenameDir() throws Exception {
  final VirtualFile child = prepareDirectoriesForRename();
  renameFileInCommand(child, "newchild");

  final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
  insideInitializedChangeListManager(changeListManager, new Runnable() {
    @Override
    public void run() {
      changeListManager.ensureUpToDate(false);
      final Change change = changeListManager.getChange(myWorkingCopyDir.findChild("newchild"));
      Assert.assertNotNull(change);

      final List<VcsException> exceptions = new ArrayList<VcsException>();
      SvnVcs.getInstance(myProject).getRollbackEnvironment().rollbackChanges(Collections.singletonList(change), exceptions,
                                                                             RollbackProgressListener.EMPTY);
      Assert.assertTrue(exceptions.isEmpty());
      Assert.assertFalse(new File(myWorkingCopyDir.getPath(), "newchild").exists());
      Assert.assertTrue(new File(myWorkingCopyDir.getPath(), "child").exists());
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:SvnRenameTest.java


示例18: getChange

import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
@Nullable
private static Change getChange(@NotNull DiffRequestPresentable presentable) {
  if (presentable instanceof DiffRequestPresentableProxy) {
    try {
      presentable = ((DiffRequestPresentableProxy)presentable).init();
    }
    catch (VcsException e) {
      LOG.info(e);
      return null;
    }
  }
  if (presentable instanceof ChangeDiffRequestPresentable) {
    return ((ChangeDiffRequestPresentable)presentable).getChange();
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:MigrateToNewDiffUtil.java


示例19: getBig

import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
public static Set<Change> getBig(List<Change> changes) {
  final Set<Change> exclude = new HashSet<Change>();
  for (Change change : changes) {
    ContentRevision beforeRevision = change.getBeforeRevision();
    if (beforeRevision != null) {
      try {
        String content = beforeRevision.getContent();
        if (content == null) {
          final FilePath file = beforeRevision.getFile();
          LOG.info("null content for " + (file.getPath()) + ", is dir: " + (file.isDirectory()));
          continue;
        }
        if (content.length() > VcsConfiguration.ourMaximumFileForBaseRevisionSize) {
          exclude.add(change);
        }
      }
      catch (VcsException e) {
        LOG.info(e);
      }
    }
  }
  return exclude;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:SelectFilesToAddTextsToPatchPanel.java


示例20: MyChangesBrowser

import com.intellij.openapi.vcs.changes.Change; //导入依赖的package包/类
public MyChangesBrowser(@NotNull Project project,
                        @NotNull List<Change> changes,
                        @Nullable final Change currentChange,
                        @NotNull Ref<JBPopup> popup) {
  super(project, null, changes, null, false, false, null, MyUseCase.LOCAL_CHANGES, null);
  setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  setChangesToDisplay(changes);

  UiNotifyConnector.doWhenFirstShown(this, new Runnable() {
    @Override
    public void run() {
      if (currentChange != null) select(Collections.singletonList(currentChange));
    }
  });

  myPopup = popup;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ChangeGoToChangePopupAction.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DataNode类代码示例发布时间:2022-05-21
下一篇:
Java RunAsyncCallback类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap