Search in sources :

Example 21 with SvnChangeList

use of org.jetbrains.idea.svn.history.SvnChangeList in project intellij-community by JetBrains.

the class SvnSelectRevisionUtil method chooseCommittedChangeList.

@Nullable
public static SvnChangeList chooseCommittedChangeList(final Project project, final SvnRepositoryLocation location, final VirtualFile root) {
    try {
        final SvnCommittedChangesTableModel model = new SvnCommittedChangesTableModel(location, project, root, SvnVcs.getInstance(project).getCommittedChangesProvider().getColumns());
        final ChangesBrowserDialog dlg = new ChangesBrowserDialog(project, model, ChangesBrowserDialog.Mode.Choose, null);
        if (dlg.showAndGet()) {
            return (SvnChangeList) dlg.getSelectedChangeList();
        }
        model.onBeforeClose();
    } catch (VcsException e) {
        Messages.showErrorDialog(e.getMessage(), SvnBundle.message("error.cannot.load.revisions"));
    }
    return null;
}
Also used : SvnCommittedChangesTableModel(org.jetbrains.idea.svn.history.SvnCommittedChangesTableModel) SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList) VcsException(com.intellij.openapi.vcs.VcsException) ChangesBrowserDialog(com.intellij.openapi.vcs.changes.committed.ChangesBrowserDialog) Nullable(org.jetbrains.annotations.Nullable)

Example 22 with SvnChangeList

use of org.jetbrains.idea.svn.history.SvnChangeList in project intellij-community by JetBrains.

the class ToBeMergedDialog method refreshListStatus.

private void refreshListStatus(@NotNull final List<SvnChangeList> changeLists) {
    if (myDisposed)
        return;
    ApplicationManager.getApplication().executeOnPooledThread(() -> {
        int cnt = 10;
        for (SvnChangeList list : changeLists) {
            // at the moment we calculate only "merged" since we don;t have branch copy point
            myStatusMap.put(list.getNumber(), toListMergeStatus(myMergeChecker.checkList(list)));
            --cnt;
            if (cnt <= 0) {
                ApplicationManager.getApplication().invokeLater(() -> {
                    myRevisionsList.revalidate();
                    myRevisionsList.repaint();
                });
                cnt = 10;
            }
        }
        myRevisionsList.revalidate();
        myRevisionsList.repaint();
    });
}
Also used : SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList)

Example 23 with SvnChangeList

use of org.jetbrains.idea.svn.history.SvnChangeList in project intellij-community by JetBrains.

the class ToBeMergedDialog method addRevisionListListeners.

private void addRevisionListListeners() {
    final int checkboxWidth = new JCheckBox().getPreferredSize().width;
    new ClickListener() {

        @Override
        public boolean onClick(@NotNull MouseEvent e, int clickCount) {
            final int idx = myRevisionsList.rowAtPoint(e.getPoint());
            if (idx >= 0) {
                final Rectangle baseRect = myRevisionsList.getCellRect(idx, 0, false);
                baseRect.setSize(checkboxWidth, baseRect.height);
                if (baseRect.contains(e.getPoint())) {
                    toggleInclusion(myRevisionsModel.getRowValue(idx));
                    myRevisionsList.repaint(baseRect);
                }
            }
            return true;
        }
    }.installOn(myRevisionsList);
    myRevisionsList.addKeyListener(new KeyAdapter() {

        @Override
        public void keyReleased(KeyEvent e) {
            if (KeyEvent.VK_SPACE == e.getKeyCode()) {
                List<SvnChangeList> selected = myRevisionsList.getSelectedObjects();
                if (!selected.isEmpty()) {
                    selected.forEach(ToBeMergedDialog.this::toggleInclusion);
                    myRevisionsList.repaint();
                    e.consume();
                }
            }
        }
    });
}
Also used : KeyEvent(java.awt.event.KeyEvent) MouseEvent(java.awt.event.MouseEvent) KeyAdapter(java.awt.event.KeyAdapter) Collections.singletonList(java.util.Collections.singletonList) SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList) List(java.util.List) ContainerUtilRt.emptyList(com.intellij.util.containers.ContainerUtilRt.emptyList)

Example 24 with SvnChangeList

use of org.jetbrains.idea.svn.history.SvnChangeList in project intellij-community by JetBrains.

the class ToBeMergedDialog method initUI.

private void initUI() {
    final ListSelectionListener selectionListener = e -> {
        List<SvnChangeList> changeLists = myRevisionsList.getSelectedObjects();
        myAlreadyMerged.clear();
        for (SvnChangeList changeList : changeLists) {
            myAlreadyMerged.addAll(getAlreadyMergedPaths(changeList));
        }
        myRepositoryChangesBrowser.setChangesToDisplay(collectChanges(changeLists, false));
        mySplitter.doLayout();
        myRepositoryChangesBrowser.repaint();
    };
    final MyListCellRenderer listCellRenderer = new MyListCellRenderer();
    myRevisionsList = new TableView<SvnChangeList>() {

        @Override
        public TableCellRenderer getCellRenderer(int row, int column) {
            return listCellRenderer;
        }

        @Override
        public void valueChanged(ListSelectionEvent e) {
            super.valueChanged(e);
            selectionListener.valueChanged(e);
        }
    };
    myRevisionsList.setExpandableItemsEnabled(false);
    new TableViewSpeedSearch<SvnChangeList>(myRevisionsList) {

        @Override
        protected String getItemText(@NotNull SvnChangeList element) {
            return element.getComment();
        }
    };
    myRevisionsList.setModelAndUpdateColumns(myRevisionsModel);
    myRevisionsList.setTableHeader(null);
    myRevisionsList.setShowGrid(false);
    final AbstractBaseTagMouseListener mouseListener = new AbstractBaseTagMouseListener() {

        @Override
        public Object getTagAt(@NotNull MouseEvent e) {
            JTable table = (JTable) e.getSource();
            int row = table.rowAtPoint(e.getPoint());
            int column = table.columnAtPoint(e.getPoint());
            if (row == -1 || column == -1)
                return null;
            listCellRenderer.customizeCellRenderer(table, table.getValueAt(row, column), table.isRowSelected(row));
            return listCellRenderer.myRenderer.getFragmentTagAt(e.getPoint().x - table.getCellRect(row, column, false).x);
        }
    };
    mouseListener.installOn(myRevisionsList);
    myMore100Action = new MoreXAction(100);
    myMore500Action = new MoreXAction(500);
    BorderLayoutPanel panel = JBUI.Panels.simplePanel().addToCenter(ScrollPaneFactory.createScrollPane(myRevisionsList)).addToTop(createToolbar().getComponent());
    mySplitter = new Splitter(false, 0.7f);
    mySplitter.setFirstComponent(panel);
    myRepositoryChangesBrowser = new RepositoryChangesBrowser(myMergeContext.getProject(), Collections.<SvnChangeList>emptyList(), emptyList(), null);
    myRepositoryChangesBrowser.getDiffAction().registerCustomShortcutSet(myRepositoryChangesBrowser.getDiffAction().getShortcutSet(), myRevisionsList);
    setChangesDecorator();
    mySplitter.setSecondComponent(myRepositoryChangesBrowser);
    mySplitter.setDividerWidth(2);
    addRevisionListListeners();
    myPanel.add(mySplitter, BorderLayout.CENTER);
}
Also used : UIUtil(com.intellij.util.ui.UIUtil) AllIcons(com.intellij.icons.AllIcons) MessageType(com.intellij.openapi.ui.MessageType) CommittedChangesTreeBrowser.collectChanges(com.intellij.openapi.vcs.changes.committed.CommittedChangesTreeBrowser.collectChanges) Change(com.intellij.openapi.vcs.changes.Change) MergeChecker(org.jetbrains.idea.svn.mergeinfo.MergeChecker) ColumnInfo(com.intellij.util.ui.ColumnInfo) MergeCalculatorTask.getBunchSize(org.jetbrains.idea.svn.integrate.MergeCalculatorTask.getBunchSize) TableCellRenderer(javax.swing.table.TableCellRenderer) Collections.singletonList(java.util.Collections.singletonList) Task(com.intellij.openapi.progress.Task) BorderLayoutPanel(com.intellij.util.ui.components.BorderLayoutPanel) JBUI(com.intellij.util.ui.JBUI) Collections.synchronizedMap(java.util.Collections.synchronizedMap) CommittedChangeListRenderer(com.intellij.openapi.vcs.changes.committed.CommittedChangeListRenderer) VcsException(com.intellij.openapi.vcs.VcsException) ListSelectionEvent(javax.swing.event.ListSelectionEvent) ContainerUtilRt.newHashSet(com.intellij.util.containers.ContainerUtilRt.newHashSet) TableView(com.intellij.ui.table.TableView) KeyEvent(java.awt.event.KeyEvent) com.intellij.ui(com.intellij.ui) Collectors(java.util.stream.Collectors) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList) List(java.util.List) ApplicationManager(com.intellij.openapi.application.ApplicationManager) NotNull(org.jetbrains.annotations.NotNull) AbstractBaseTagMouseListener(com.intellij.openapi.vcs.changes.issueLinks.AbstractBaseTagMouseListener) java.util(java.util) KeyAdapter(java.awt.event.KeyAdapter) ContainerUtil(com.intellij.util.containers.ContainerUtil) MergeCalculatorTask.loadChangeLists(org.jetbrains.idea.svn.integrate.MergeCalculatorTask.loadChangeLists) SvnMergeInfoCache(org.jetbrains.idea.svn.mergeinfo.SvnMergeInfoCache) DialogWrapper(com.intellij.openapi.ui.DialogWrapper) ListTableModel(com.intellij.util.ui.ListTableModel) ContainerUtilRt.emptyList(com.intellij.util.containers.ContainerUtilRt.emptyList) Splitter(com.intellij.openapi.ui.Splitter) ListMergeStatus(org.jetbrains.idea.svn.mergeinfo.ListMergeStatus) ChangeNodeDecorator(com.intellij.openapi.vcs.changes.ui.ChangeNodeDecorator) PopupUtil(com.intellij.openapi.ui.popup.util.PopupUtil) ActionEvent(java.awt.event.ActionEvent) MouseEvent(java.awt.event.MouseEvent) java.awt(java.awt) com.intellij.openapi.actionSystem(com.intellij.openapi.actionSystem) ChangesBrowserNodeRenderer(com.intellij.openapi.vcs.changes.ui.ChangesBrowserNodeRenderer) DumbAwareAction(com.intellij.openapi.project.DumbAwareAction) RepositoryChangesBrowser(com.intellij.openapi.vcs.changes.committed.RepositoryChangesBrowser) Pair(com.intellij.openapi.util.Pair) ObjectUtils(com.intellij.util.ObjectUtils) ListSelectionListener(javax.swing.event.ListSelectionListener) Condition(com.intellij.openapi.util.Condition) javax.swing(javax.swing) TableCellRenderer(javax.swing.table.TableCellRenderer) MouseEvent(java.awt.event.MouseEvent) Splitter(com.intellij.openapi.ui.Splitter) RepositoryChangesBrowser(com.intellij.openapi.vcs.changes.committed.RepositoryChangesBrowser) SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList) ListSelectionEvent(javax.swing.event.ListSelectionEvent) NotNull(org.jetbrains.annotations.NotNull) BorderLayoutPanel(com.intellij.util.ui.components.BorderLayoutPanel) ListSelectionListener(javax.swing.event.ListSelectionListener) AbstractBaseTagMouseListener(com.intellij.openapi.vcs.changes.issueLinks.AbstractBaseTagMouseListener) Collections.singletonList(java.util.Collections.singletonList) SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList) List(java.util.List) ContainerUtilRt.emptyList(com.intellij.util.containers.ContainerUtilRt.emptyList)

Example 25 with SvnChangeList

use of org.jetbrains.idea.svn.history.SvnChangeList in project intellij-community by JetBrains.

the class MergeCalculatorTask method loadChangeLists.

@NotNull
public static Pair<List<SvnChangeList>, Boolean> loadChangeLists(@NotNull MergeContext mergeContext, long beforeRevision, int size) throws VcsException {
    ChangeBrowserSettings settings = new ChangeBrowserSettings();
    if (beforeRevision > 0) {
        settings.CHANGE_BEFORE = String.valueOf(beforeRevision);
        settings.USE_CHANGE_BEFORE_FILTER = true;
    }
    List<SvnChangeList> changeLists = getChangeLists(mergeContext, settings, beforeRevision, size, (changeList, tree) -> changeList);
    return Pair.create(changeLists.subList(0, min(size, changeLists.size())), changeLists.size() < size + 1);
}
Also used : ChangeBrowserSettings(com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings) SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

SvnChangeList (org.jetbrains.idea.svn.history.SvnChangeList)37 VirtualFile (com.intellij.openapi.vfs.VirtualFile)23 Test (org.junit.Test)22 ChangeBrowserSettings (com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings)16 SvnRepositoryLocation (org.jetbrains.idea.svn.history.SvnRepositoryLocation)16 File (java.io.File)13 SvnVcs (org.jetbrains.idea.svn.SvnVcs)7 VfsUtilCore.virtualToIoFile (com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile)4 NotNull (org.jetbrains.annotations.NotNull)4 Change (com.intellij.openapi.vcs.changes.Change)3 ChangeList (com.intellij.openapi.vcs.changes.ChangeList)3 CommittedChangeList (com.intellij.openapi.vcs.versionBrowser.CommittedChangeList)3 Project (com.intellij.openapi.project.Project)2 VcsException (com.intellij.openapi.vcs.VcsException)2 ContainerUtilRt.emptyList (com.intellij.util.containers.ContainerUtilRt.emptyList)2 KeyAdapter (java.awt.event.KeyAdapter)2 KeyEvent (java.awt.event.KeyEvent)2 MouseEvent (java.awt.event.MouseEvent)2 ArrayList (java.util.ArrayList)2 Collections.singletonList (java.util.Collections.singletonList)2