Search in sources :

Example 1 with MergeInfoHolder

use of org.jetbrains.idea.svn.mergeinfo.MergeInfoHolder in project intellij-community by JetBrains.

the class RootsAndBranches method prepareData.

private JPanel prepareData(final Map<String, SvnMergeInfoRootPanelManual> panels, final Map<String, MergeInfoHolder> holders, List<WCInfoWithBranches> roots) {
    final JPanel mainPanel = new JPanel(new GridBagLayout());
    boolean onlyOneRoot = roots.size() == 1;
    final GridBagConstraints gb = new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0);
    mainPanel.add(myToolbarComponent, gb);
    ++gb.gridy;
    for (final WCInfoWithBranches root : roots) {
        if (root == null) {
            continue;
        }
        final SvnMergeInfoRootPanelManual panel = new SvnMergeInfoRootPanelManual(myProject, wcInfoWithBranches -> {
            final WCInfoWithBranches newInfo = myDataLoader.reloadInfo(wcInfoWithBranches);
            if (newInfo == null) {
                myProject.getMessageBus().syncPublisher(SvnVcs.WC_CONVERTED).run();
                return wcInfoWithBranches;
            }
            return newInfo;
        }, () -> {
            final MergeInfoHolder holder = getHolder(root.getPath());
            if (holder != null) {
                holder.refresh(false);
            }
        }, onlyOneRoot, root);
        panels.put(root.getPath(), panel);
        holders.put(root.getPath(), createHolder(panel));
        final JPanel contentPanel = panel.getContentPanel();
        mainPanel.add(contentPanel, gb);
        ++gb.gridy;
    }
    if (panels.size() == 1) {
        for (SvnMergeInfoRootPanelManual panel : panels.values()) {
            panel.setOnlyOneRoot(true);
        }
    }
    return mainPanel;
}
Also used : WCInfoWithBranches(org.jetbrains.idea.svn.dialogs.WCInfoWithBranches) MergeInfoHolder(org.jetbrains.idea.svn.mergeinfo.MergeInfoHolder)

Example 2 with MergeInfoHolder

use of org.jetbrains.idea.svn.mergeinfo.MergeInfoHolder in project intellij-community by JetBrains.

the class RootsAndBranches method refreshByLists.

public void refreshByLists(final List<CommittedChangeList> committedChangeLists) {
    if (!committedChangeLists.isEmpty()) {
        final SvnChangeList svnList = (SvnChangeList) committedChangeLists.get(0);
        final String wcPath = svnList.getWcPath();
        if (wcPath != null) {
            final MergeInfoHolder holder = getHolder(wcPath);
            if (holder != null) {
                holder.refresh(true);
            }
        }
    }
}
Also used : MergeInfoHolder(org.jetbrains.idea.svn.mergeinfo.MergeInfoHolder)

Example 3 with MergeInfoHolder

use of org.jetbrains.idea.svn.mergeinfo.MergeInfoHolder in project intellij-community by JetBrains.

the class RootsAndBranches method turnFromHereHighlighting.

public void turnFromHereHighlighting() {
    myHighlightingOn = true;
    for (MergeInfoHolder holder : myHolders.values()) {
        holder.updateMixedRevisionsForPanel();
    }
    myManager.repaintTree();
}
Also used : MergeInfoHolder(org.jetbrains.idea.svn.mergeinfo.MergeInfoHolder)

Example 4 with MergeInfoHolder

use of org.jetbrains.idea.svn.mergeinfo.MergeInfoHolder in project intellij-community by JetBrains.

the class RootsAndBranches method createPanels.

private void createPanels(final RepositoryLocation location, final Runnable afterRefresh) {
    final Task.Backgroundable backgroundable = new Task.Backgroundable(myProject, "Subversion: loading working copies data..", false) {

        public void run(@NotNull final ProgressIndicator indicator) {
            indicator.setIndeterminate(true);
            final Map<String, SvnMergeInfoRootPanelManual> panels = new HashMap<>();
            final Map<String, MergeInfoHolder> holders = new HashMap<>();
            final List<WCInfoWithBranches> roots = myDataLoader.loadRoots();
            SwingUtilities.invokeLater(() -> {
                if (myDisposed)
                    return;
                final JPanel mainPanel = prepareData(panels, holders, roots);
                myMergePanels.clear();
                myHolders.clear();
                myMergePanels.putAll(panels);
                myHolders.putAll(holders);
                if (myPanelWrapper != null) {
                    myPanelWrapper.removeAll();
                    if (myMergePanels.isEmpty()) {
                        final JPanel emptyPanel = new JPanel(new GridBagLayout());
                        final GridBagConstraints gb = new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0);
                        final JLabel label = new JLabel("No Subversion 1.5 working copies\nof 1.5 repositories in the project");
                        label.setUI(new MultiLineLabelUI());
                        emptyPanel.add(label, gb);
                        gb.fill = GridBagConstraints.HORIZONTAL;
                        myPanelWrapper.add(emptyPanel, gb);
                    } else {
                        for (MergeInfoHolder holder : myHolders.values()) {
                            holder.updateMixedRevisionsForPanel();
                        }
                        myPanelWrapper.add(mainPanel, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
                    }
                    myPanelWrapper.repaint();
                } else {
                    myPanel = mainPanel;
                }
                if (afterRefresh != null) {
                    afterRefresh.run();
                }
            });
        }
    };
    ProgressManager.getInstance().run(backgroundable);
}
Also used : Task(com.intellij.openapi.progress.Task) HashMap(java.util.HashMap) NotNull(org.jetbrains.annotations.NotNull) MergeInfoHolder(org.jetbrains.idea.svn.mergeinfo.MergeInfoHolder) MultiLineLabelUI(com.intellij.openapi.ui.MultiLineLabelUI) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) WCInfoWithBranches(org.jetbrains.idea.svn.dialogs.WCInfoWithBranches)

Example 5 with MergeInfoHolder

use of org.jetbrains.idea.svn.mergeinfo.MergeInfoHolder in project intellij-community by JetBrains.

the class RootsAndBranches method getStatus.

@Nullable
public ListMergeStatus getStatus(final CommittedChangeList list, final boolean ignoreEnabled) {
    if (!(list instanceof SvnChangeList)) {
        return null;
    }
    final SvnChangeList svnList = (SvnChangeList) list;
    final String wcPath = svnList.getWcPath();
    MergeInfoHolder holder = null;
    if (wcPath == null) {
        for (Map.Entry<String, SvnMergeInfoRootPanelManual> entry : myMergePanels.entrySet()) {
            final SvnMergeInfoRootPanelManual panelManual = entry.getValue();
            if ((panelManual.getBranch() != null) && (panelManual.getBranch().getUrl() != null) && svnList.allPathsUnder(panelManual.getBranch().getUrl())) {
                holder = getHolder(entry.getKey());
            }
        }
    } else {
        holder = getHolder(wcPath);
    }
    if (holder != null) {
        return holder.check(list, ignoreEnabled);
    }
    return null;
}
Also used : HashMap(java.util.HashMap) Map(java.util.Map) MergeInfoHolder(org.jetbrains.idea.svn.mergeinfo.MergeInfoHolder) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

MergeInfoHolder (org.jetbrains.idea.svn.mergeinfo.MergeInfoHolder)5 HashMap (java.util.HashMap)2 WCInfoWithBranches (org.jetbrains.idea.svn.dialogs.WCInfoWithBranches)2 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 Task (com.intellij.openapi.progress.Task)1 MultiLineLabelUI (com.intellij.openapi.ui.MultiLineLabelUI)1 Map (java.util.Map)1 NotNull (org.jetbrains.annotations.NotNull)1 Nullable (org.jetbrains.annotations.Nullable)1