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

Java ChangeList类代码示例

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

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



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

示例1: update

import com.intellij.openapi.vcs.changes.ChangeList; //导入依赖的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


示例2: setDefaultSelection

import com.intellij.openapi.vcs.changes.ChangeList; //导入依赖的package包/类
public void setDefaultSelection(final ChangeList defaultSelection) {
  if (defaultSelection == null) {
    myExistingListsCombo.setSelectedIndex(0);
  }
  else {
    myExistingListsCombo.setSelectedItem(defaultSelection);
  }


  if (defaultSelection != null) {
    myRbExisting.setSelected(true);
  }
  else {
    myRbNew.setSelected(true);
  }

  updateEnabledItems();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ChangeListChooserPanel.java


示例3: getRevisionNumbers

import com.intellij.openapi.vcs.changes.ChangeList; //导入依赖的package包/类
@Nullable
public List<VcsRevisionNumber> getRevisionNumbers(@NotNull DataProvider dataProvider) {
  VcsRevisionNumber revisionNumber = VcsDataKeys.VCS_REVISION_NUMBER.getData(dataProvider);
  if (revisionNumber != null) {
    return Collections.singletonList(revisionNumber);
  }

  ChangeList[] changeLists = VcsDataKeys.CHANGE_LISTS.getData(dataProvider);
  if (changeLists != null && changeLists.length > 0) {
    List<CommittedChangeList> committedChangeLists = ContainerUtil.findAll(changeLists, CommittedChangeList.class);

    if (!committedChangeLists.isEmpty()) {
      ContainerUtil.sort(committedChangeLists, CommittedChangeListByDateComparator.DESCENDING);

      return ContainerUtil.mapNotNull(committedChangeLists, CommittedChangeListToRevisionNumberFunction.INSTANCE);
    }
  }

  VcsFileRevision[] fileRevisions = VcsDataKeys.VCS_FILE_REVISIONS.getData(dataProvider);
  if (fileRevisions != null && fileRevisions.length > 0) {
    return ContainerUtil.mapNotNull(fileRevisions, FileRevisionToRevisionNumberFunction.INSTANCE);
  }

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


示例4: createActions

import com.intellij.openapi.vcs.changes.ChangeList; //导入依赖的package包/类
public VcsCommittedViewAuxiliary createActions(DecoratorManager decoratorManager, RepositoryLocation repositoryLocation) {
  AnAction copyHashAction = new AnAction("Copy &Hash", "Copy hash to clipboard", PlatformIcons.COPY_ICON) {
    @Override
    public void actionPerformed(AnActionEvent e) {
      ChangeList[] changeLists = e.getData(VcsDataKeys.CHANGE_LISTS);
      if (changeLists != null && changeLists[0] instanceof HgCommittedChangeList) {
        HgRevisionNumber revisionNumber = ((HgCommittedChangeList)changeLists[0]).getRevision();
        CopyPasteManager.getInstance().setContents(new StringSelection(revisionNumber.getChangeset()));
      }
    }
  };
  return new VcsCommittedViewAuxiliary(Collections.singletonList(copyHashAction), new Runnable() {
    public void run() {
    }
  }, Collections.singletonList(copyHashAction));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:HgCachingCommittedChangesProvider.java


示例5: update

import com.intellij.openapi.vcs.changes.ChangeList; //导入依赖的package包/类
public void update(final AnActionEvent e) {
  final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
  final Presentation presentation = e.getPresentation();

  if (project == null) {
    presentation.setEnabled(false);
    presentation.setVisible(false);
    return;
  }

  presentation.setText(SvnBundle.message("configure.branches.item"));
  presentation.setDescription(SvnBundle.message("configure.branches.item"));
  presentation.setIcon(SvnIcons.ConfigureBranches);

  presentation.setVisible(true);
  
  final ChangeList[] cls = e.getData(VcsDataKeys.CHANGE_LISTS);
  presentation.setEnabled((cls != null) && (cls.length > 0) &&
                          (SvnVcs.getInstance(project).getName().equals(((CommittedChangeList) cls[0]).getVcs().getName())) &&
                          (((SvnChangeList) cls[0]).getRoot() != null));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ConfigureBranchesAction.java


示例6: checkSame

import com.intellij.openapi.vcs.changes.ChangeList; //导入依赖的package包/类
private void checkSame() {
  final CheckSamePattern<SVNURL> sameBranch = new CheckSamePattern<SVNURL>();
  final CheckSamePattern<VirtualFile> sameRoot = new CheckSamePattern<VirtualFile>();

  for (ChangeList changeList : myChangeListsList) {
    final SvnChangeList svnChangeList = (SvnChangeList) changeList;
    sameBranch.iterate(svnChangeList.getBranchUrl());
    sameRoot.iterate(svnChangeList.getRoot());

    if ((! sameBranch.isSame()) || (! sameRoot.isSame())) {
      break;
    }
  }
  isValid = sameBranch.isSame() && sameRoot.isSame();
  mySameBranch = sameBranch.getSameValue();
  myVcsRoot = sameRoot.getSameValue();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:SelectedChangeListsChecker.java


示例7: update

import com.intellij.openapi.vcs.changes.ChangeList; //导入依赖的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);
      }
      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:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:AbstractCommitChangesAction.java


示例8: removeActiveChangeList

import com.intellij.openapi.vcs.changes.ChangeList; //导入依赖的package包/类
private static void removeActiveChangeList(final Project project, final ChangeList[] lists, final boolean empty) {
  List<LocalChangeList> remainingLists = ChangeListManager.getInstance(project).getChangeListsCopy();
  remainingLists.removeAll(Arrays.asList(lists));
  String[] names = new String[remainingLists.size()];
  for(int i=0; i<remainingLists.size(); i++) {
    names [i] = remainingLists.get(i).getName();
  }
  int nameIndex = Messages.showChooseDialog(project,
                                            empty ? VcsBundle.message("changes.remove.active.empty.prompt") : VcsBundle.message("changes.remove.active.prompt"),
                                            VcsBundle.message("changes.remove.active.title"),
                                            Messages.getQuestionIcon(), names, names [0]);
  if (nameIndex < 0) return;
  ChangeListManager.getInstance(project).setDefaultChangeList(remainingLists.get(nameIndex));
  for(ChangeList list: lists) {
    final ChangeListManager changeListManager = ChangeListManager.getInstance(project);
    // we can't use findRealByCopy() because isDefault will differ between our copy and the real list
    changeListManager.removeChangeList(list.getName());
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:RemoveChangeListAction.java


示例9: changeListRenamed

import com.intellij.openapi.vcs.changes.ChangeList; //导入依赖的package包/类
public void changeListRenamed(final ChangeList list, final String oldName) {
  if (Comparing.equal(list.getName(), oldName)) {
    return;
  }
  if (SvnChangeProvider.ourDefaultListName.equals(list.getName())) {
    changeListRemoved(list);
    return;
  }
  final List<String> paths = getPathsFromChanges(list.getChanges());
  for (String path : paths) {
    try {
      myVcs.createChangelistClient().doAddToChangelist(new File[]{new File(path)}, SVNDepth.EMPTY, list.getName(), null);
    }
    catch (SVNException e) {
      LOG.info(e);
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:SvnChangelistListener.java


示例10: changesMoved

import com.intellij.openapi.vcs.changes.ChangeList; //导入依赖的package包/类
public void changesMoved(final Collection<Change> changes, final ChangeList fromList, final ChangeList toList) {
  if (fromList.getName().equals(toList.getName())) {
    return;
  }
  if (SvnChangeProvider.ourDefaultListName.equals(toList.getName())) {
    changeListRemoved(toList);
    return;
  }
  final String[] fromLists = SvnChangeProvider.ourDefaultListName.equals(fromList.getName()) ? null : new String[] {fromList.getName()};
  final List<String> paths = getPathsFromChanges(changes);
  for (final String path : paths) {
    try {
      myVcs.createChangelistClient().doAddToChangelist(new File[]{new File(path)}, SVNDepth.EMPTY, toList.getName(), fromLists);
    }
    catch (SVNException e) {
      LOG.info(e);
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:SvnChangelistListener.java


示例11: update

import com.intellij.openapi.vcs.changes.ChangeList; //导入依赖的package包/类
public void update(final AnActionEvent e) {
  final Project project = PlatformDataKeys.PROJECT.getData(e.getDataContext());
  final Presentation presentation = e.getPresentation();

  if (project == null) {
    presentation.setEnabled(false);
    presentation.setVisible(false);
    return;
  }

  presentation.setText(SvnBundle.message("configure.branches.item"));
  presentation.setDescription(SvnBundle.message("configure.branches.item"));
  presentation.setIcon(SvnIcons.ConfigureBranches);

  presentation.setVisible(true);
  
  final ChangeList[] cls = e.getData(VcsDataKeys.CHANGE_LISTS);
  presentation.setEnabled((cls != null) && (cls.length > 0) &&
                          (SvnVcs.getInstance(project).getName().equals(((CommittedChangeList) cls[0]).getVcs().getName())) &&
                          (((SvnChangeList) cls[0]).getRoot() != null));
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:ConfigureBranchesAction.java


示例12: getChangeList

import com.intellij.openapi.vcs.changes.ChangeList; //导入依赖的package包/类
private List<Change> getChangeList(VcsRevisionNumber revisionNumber) {
    List<Change> changes = vcsCache.get(revisionNumber);
    if (changes == null) {
        try {
            changes = new LinkedList<Change>();
            AbstractVcs vcs = ProjectLevelVcsManager.getInstance(project).getVcsFor(file);
            if (vcs == null) { // VcsVirtualFile
                vcs = ProjectLevelVcsManager.getInstance(project).findVcsByName(vcsName);
            }
            Pair oneList = vcs.getCommittedChangesProvider().getOneList(file, revisionNumber);
            changes.addAll(((ChangeList) oneList.getFirst()).getChanges());
        } catch (VcsException ex) {
        }
        vcsCache.put(revisionNumber, changes);
    }
    return changes;
}
 
开发者ID:janotav,项目名称:ali-idea-plugin,代码行数:18,代码来源:DevMotivePanel.java


示例13: confirmActiveChangeListRemoval

import com.intellij.openapi.vcs.changes.ChangeList; //导入依赖的package包/类
static boolean confirmActiveChangeListRemoval(@Nonnull Project project, @Nonnull List<? extends LocalChangeList> lists, boolean empty) {
  List<LocalChangeList> remainingLists = ChangeListManager.getInstance(project).getChangeListsCopy();
  remainingLists.removeAll(lists);

  // don't ask "Which changelist to make active" if there is only one option anyway
  // unless there are some changes to be moved - give user a chance to cancel deletion
  if (remainingLists.size() == 1 && empty) {
    ChangeListManager.getInstance(project).setDefaultChangeList(remainingLists.get(0));
    return true;
  }

  String[] remainingListsNames = remainingLists.stream().map(ChangeList::getName).toArray(String[]::new);
  int nameIndex = Messages.showChooseDialog(project, empty
                                                     ? VcsBundle.message("changes.remove.active.empty.prompt")
                                                     : VcsBundle.message("changes.remove.active.prompt"),
                                            VcsBundle.message("changes.remove.active.title"), Messages.getQuestionIcon(),
                                            remainingListsNames, remainingListsNames[0]);
  if (nameIndex < 0) return false;
  ChangeListManager.getInstance(project).setDefaultChangeList(remainingLists.get(nameIndex));
  return true;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:RemoveChangeListAction.java


示例14: getRevisionNumbers

import com.intellij.openapi.vcs.changes.ChangeList; //导入依赖的package包/类
@Nullable
public List<VcsRevisionNumber> getRevisionNumbers(@Nonnull DataProvider dataProvider) {
  VcsRevisionNumber revisionNumber = dataProvider.getDataUnchecked(VcsDataKeys.VCS_REVISION_NUMBER);
  if (revisionNumber != null) {
    return Collections.singletonList(revisionNumber);
  }

  ChangeList[] changeLists = dataProvider.getDataUnchecked(VcsDataKeys.CHANGE_LISTS);
  if (changeLists != null && changeLists.length > 0) {
    List<CommittedChangeList> committedChangeLists = ContainerUtil.findAll(changeLists, CommittedChangeList.class);

    if (!committedChangeLists.isEmpty()) {
      ContainerUtil.sort(committedChangeLists, CommittedChangeListByDateComparator.DESCENDING);

      return ContainerUtil.mapNotNull(committedChangeLists, CommittedChangeListToRevisionNumberFunction.INSTANCE);
    }
  }

  VcsFileRevision[] fileRevisions = dataProvider.getDataUnchecked(VcsDataKeys.VCS_FILE_REVISIONS);
  if (fileRevisions != null && fileRevisions.length > 0) {
    return ContainerUtil.mapNotNull(fileRevisions, FileRevisionToRevisionNumberFunction.INSTANCE);
  }

  return null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:26,代码来源:VcsRevisionNumberArrayRule.java


示例15: fillCompletionVariants

import com.intellij.openapi.vcs.changes.ChangeList; //导入依赖的package包/类
@Override
public void fillCompletionVariants(@NotNull CompletionParameters parameters, @NotNull CompletionResultSet result) {
  PsiFile file = parameters.getOriginalFile();
  Document document = PsiDocumentManager.getInstance(file.getProject()).getDocument(file);
  if (document != null) {
    DataContext dataContext = document.getUserData(CommitMessage.DATA_CONTEXT_KEY);
    if (dataContext != null) {
      result.stopHere();
      if (parameters.getInvocationCount() > 0) {
        ChangeList[] lists = VcsDataKeys.CHANGE_LISTS.getData(dataContext);
        if (lists != null) {
          String prefix = TextFieldWithAutoCompletionListProvider.getCompletionPrefix(parameters);
          CompletionResultSet insensitive = result.caseInsensitive().withPrefixMatcher(new CamelHumpMatcher(prefix));
          for (ChangeList list : lists) {
            for (Change change : list.getChanges()) {
              ContentRevision revision = change.getAfterRevision() == null ? change.getBeforeRevision() : change.getAfterRevision();
              if (revision != null) {
                FilePath filePath = revision.getFile();
                LookupElementBuilder element = LookupElementBuilder.create(filePath.getName()).
                    withIcon(filePath.getFileType().getIcon());
                insensitive.addElement(element);
              }
            }
          }
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:CommitCompletionContributor.java


示例16: actionPerformed

import com.intellij.openapi.vcs.changes.ChangeList; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
  final Project project = e.getData(CommonDataKeys.PROJECT);
  final ChangeList[] changeLists = e.getData(VcsDataKeys.CHANGE_LISTS);
  if (changeLists != null && changeLists.length > 0 && changeLists [0] instanceof CommittedChangeList) {
    showDetailsPopup(project, (CommittedChangeList) changeLists [0]);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ChangeListDetailsAction.java


示例17: actionPerformed

import com.intellij.openapi.vcs.changes.ChangeList; //导入依赖的package包/类
@Override
protected void actionPerformed(@NotNull final VcsContext context) {
  Collection<FilePath> filePaths = getFilePaths(context);
  final List<ChangeList> selectedChangeLists = new ArrayList<ChangeList>();
  final ChangeList[] selectionFromContext = context.getSelectedChangeLists();
  if (selectionFromContext != null) {
    Collections.addAll(selectedChangeLists, selectionFromContext);
  }
  final List<CommittedChangeList> incomingChanges = CommittedChangesCache.getInstance(context.getProject()).getCachedIncomingChanges();
  final List<CommittedChangeList> intersectingChanges = new ArrayList<CommittedChangeList>();
  if (incomingChanges != null) {
    for(CommittedChangeList changeList: incomingChanges) {
      if (!selectedChangeLists.contains(changeList)) {
        for(Change change: changeList.getChanges()) {
          if (filePaths.contains(ChangesUtil.getFilePath(change))) {
            intersectingChanges.add(changeList);
            break;
          }
        }
      }
    }
  }
  if (intersectingChanges.size() > 0) {
    int rc = Messages.showOkCancelDialog(
      context.getProject(), VcsBundle.message("get.committed.changes.intersecting.prompt", intersectingChanges.size(), selectedChangeLists.size()),
      VcsBundle.message("get.committed.changes.title"), Messages.getQuestionIcon());
    if (rc != Messages.OK) return;
  }
  super.actionPerformed(context);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:GetCommittedChangelistAction.java


示例18: update

import com.intellij.openapi.vcs.changes.ChangeList; //导入依赖的package包/类
@Override
protected void update(final VcsContext vcsContext, final Presentation presentation) {
  super.update(vcsContext, presentation);
  final ChangeList[] changeLists = vcsContext.getSelectedChangeLists();
  presentation.setEnabled(presentation.isEnabled() &&
                          CommittedChangesCache.getInstance(vcsContext.getProject()).getCachedIncomingChanges() != null &&
                          changeLists != null &&  changeLists.length > 0);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:GetCommittedChangelistAction.java


示例19: getFilePaths

import com.intellij.openapi.vcs.changes.ChangeList; //导入依赖的package包/类
private static Collection<FilePath> getFilePaths(final VcsContext context) {
  final Set<FilePath> files = new HashSet<FilePath>();
  final ChangeList[] selectedChangeLists = context.getSelectedChangeLists();
  if (selectedChangeLists != null) {
    for(ChangeList changelist: selectedChangeLists) {
      for(Change change: changelist.getChanges()) {
        files.add(ChangesUtil.getFilePath(change));
      }
    }
  }
  return files;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:GetCommittedChangelistAction.java


示例20: allSelectedChangeListsAreRevertable

import com.intellij.openapi.vcs.changes.ChangeList; //导入依赖的package包/类
private static boolean allSelectedChangeListsAreRevertable(@NotNull AnActionEvent e) {
  ChangeList[] changeLists = e.getData(VcsDataKeys.CHANGE_LISTS);
  if (changeLists == null) {
    return true;
  }
  for (ChangeList list : changeLists) {
    if (list instanceof CommittedChangeList) {
      if (!((CommittedChangeList)list).isModifiable()) {
        return false;
      }
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:RevertSelectedChangesAction.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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