Search in sources :

Example 21 with CommittedChangeList

use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.

the class ChangesCacheFile method editChangelist.

public void editChangelist(long number, String message) throws IOException {
    final List<CommittedChangeList> lists = new ArrayList<>();
    final List<Boolean> present = loadAllData(lists);
    for (CommittedChangeList list : lists) {
        if (list.getNumber() == number) {
            list.setDescription(message);
            break;
        }
    }
    delete();
    Collections.reverse(lists);
    Collections.reverse(present);
    writeChanges(lists, present);
}
Also used : CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList)

Example 22 with CommittedChangeList

use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.

the class ColumnFilteringStrategy method filterChangeLists.

@NotNull
public List<CommittedChangeList> filterChangeLists(List<CommittedChangeList> changeLists) {
    final Object[] selection = myValueList.getSelectedValues();
    if (myValueList.getSelectedIndex() == 0 || selection.length == 0) {
        return changeLists;
    }
    List<CommittedChangeList> result = new ArrayList<>();
    for (CommittedChangeList changeList : changeLists) {
        if (myProviderClass == null || myProviderClass.isInstance(changeList.getVcs().getCommittedChangesProvider())) {
            for (Object value : selection) {
                //noinspection unchecked
                if (value.toString().equals(myColumn.getValue(ReceivedChangeList.unwrap(changeList)).toString())) {
                    result.add(changeList);
                    break;
                }
            }
        }
    }
    return result;
}
Also used : CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) NotNull(org.jetbrains.annotations.NotNull)

Example 23 with CommittedChangeList

use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.

the class CommittedChangeListRenderer method customize.

public void customize(JComponent tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
    if (node.getUserObject() instanceof CommittedChangeList) {
        CommittedChangeList changeList = (CommittedChangeList) node.getUserObject();
        renderChangeList(tree, changeList);
    } else if (node.getUserObject() != null) {
        append(node.getUserObject().toString(), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
    }
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList)

Example 24 with CommittedChangeList

use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.

the class GetCommittedChangelistAction method actionPerformed.

@Override
protected void actionPerformed(@NotNull final VcsContext context) {
    Collection<FilePath> filePaths = getFilePaths(context);
    final List<ChangeList> selectedChangeLists = new ArrayList<>();
    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<>();
    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);
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) ChangeList(com.intellij.openapi.vcs.changes.ChangeList) CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) Change(com.intellij.openapi.vcs.changes.Change)

Example 25 with CommittedChangeList

use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.

the class OutdatedVersionNotifier method updateAllEditors.

private void updateAllEditors() {
    if (myCache.getCachedIncomingChanges() == null) {
        requestLoadIncomingChanges();
        return;
    }
    debug("Updating editors");
    final VirtualFile[] files = myFileEditorManager.getOpenFiles();
    for (VirtualFile file : files) {
        final Pair<CommittedChangeList, Change> pair = myCache.getIncomingChangeList(file);
        final FileEditor[] fileEditors = myFileEditorManager.getEditors(file);
        for (FileEditor editor : fileEditors) {
            final OutdatedRevisionPanel oldPanel = editor.getUserData(PANEL_KEY);
            if (pair != null) {
                if (oldPanel != null) {
                    oldPanel.setChangeList(pair.first, pair.second);
                } else {
                    initPanel(pair.first, pair.second, editor);
                }
            } else if (oldPanel != null) {
                myFileEditorManager.removeTopComponent(editor, oldPanel);
                editor.putUserData(PANEL_KEY, null);
            }
        }
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) FileEditor(com.intellij.openapi.fileEditor.FileEditor) CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) Change(com.intellij.openapi.vcs.changes.Change)

Aggregations

CommittedChangeList (com.intellij.openapi.vcs.versionBrowser.CommittedChangeList)45 ChangeBrowserSettings (com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings)8 Nullable (org.jetbrains.annotations.Nullable)8 Change (com.intellij.openapi.vcs.changes.Change)7 ChangesBunch (com.intellij.openapi.vcs.changes.committed.ChangesBunch)5 VirtualFile (com.intellij.openapi.vfs.VirtualFile)5 ChangeList (com.intellij.openapi.vcs.changes.ChangeList)4 NotNull (org.jetbrains.annotations.NotNull)4 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)3 Project (com.intellij.openapi.project.Project)3 Pair (com.intellij.openapi.util.Pair)3 List (java.util.List)3 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)3 Application (com.intellij.openapi.application.Application)2 Task (com.intellij.openapi.progress.Task)2 Ref (com.intellij.openapi.util.Ref)2 VcsFileRevision (com.intellij.openapi.vcs.history.VcsFileRevision)2 VcsRevisionNumber (com.intellij.openapi.vcs.history.VcsRevisionNumber)2 ChangesBrowserSettingsEditor (com.intellij.openapi.vcs.versionBrowser.ChangesBrowserSettingsEditor)2 IOException (java.io.IOException)2