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;
}
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);
}
}
}
}
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();
}
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);
}
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;
}
Aggregations