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


Java ChangeList类代码示例

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


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


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