use of org.jetbrains.idea.svn.actions.CleanupWorker in project intellij-community by JetBrains.
the class CopiesPanel method updateList.
private void updateList(@NotNull final List<WCInfo> infoList, @NotNull final List<WorkingCopyFormat> supportedFormats) {
myPanel.removeAll();
final Insets nullIndent = new Insets(1, 3, 1, 0);
final GridBagConstraints gb = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(2, 2, 0, 0), 0, 0);
gb.insets.left = 4;
myPanel.add(myRefreshLabel, gb);
gb.insets.left = 1;
final LocalFileSystem lfs = LocalFileSystem.getInstance();
final Insets topIndent = new Insets(10, 3, 0, 0);
for (final WCInfo wcInfo : infoList) {
final Collection<WorkingCopyFormat> upgradeFormats = getUpgradeFormats(wcInfo, supportedFormats);
final VirtualFile vf = lfs.refreshAndFindFileByIoFile(new File(wcInfo.getPath()));
final VirtualFile root = (vf == null) ? wcInfo.getVcsRoot() : vf;
final JEditorPane editorPane = new JEditorPane(UIUtil.HTML_MIME, "");
editorPane.setEditable(false);
editorPane.setFocusable(true);
editorPane.setBackground(UIUtil.getPanelBackground());
editorPane.setOpaque(false);
editorPane.addHyperlinkListener(new HyperlinkListener() {
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
if (CONFIGURE_BRANCHES.equals(e.getDescription())) {
if (!checkRoot(root, wcInfo.getPath(), " invoke Configure Branches"))
return;
BranchConfigurationDialog.configureBranches(myProject, root);
} else if (FIX_DEPTH.equals(e.getDescription())) {
final int result = Messages.showOkCancelDialog(myVcs.getProject(), "You are going to checkout into '" + wcInfo.getPath() + "' with 'infinity' depth.\n" + "This will update your working copy to HEAD revision as well.", "Set Working Copy Infinity Depth", Messages.getWarningIcon());
if (result == Messages.OK) {
// update of view will be triggered by roots changed event
SvnCheckoutProvider.checkout(myVcs.getProject(), new File(wcInfo.getPath()), wcInfo.getRootUrl(), SVNRevision.HEAD, Depth.INFINITY, false, null, wcInfo.getFormat());
}
} else if (CHANGE_FORMAT.equals(e.getDescription())) {
changeFormat(wcInfo, upgradeFormats);
} else if (MERGE_FROM.equals(e.getDescription())) {
if (!checkRoot(root, wcInfo.getPath(), " invoke Merge From"))
return;
mergeFrom(wcInfo, root, editorPane);
} else if (CLEANUP.equals(e.getDescription())) {
if (!checkRoot(root, wcInfo.getPath(), " invoke Cleanup"))
return;
new CleanupWorker(myVcs, singletonList(root)).execute();
}
}
}
private boolean checkRoot(VirtualFile root, final String path, final String actionName) {
if (root == null) {
Messages.showWarningDialog(myProject, "Invalid working copy root: " + path, "Can not " + actionName);
return false;
}
return true;
}
});
editorPane.setBorder(null);
editorPane.setText(formatWc(wcInfo, upgradeFormats));
final JPanel copyPanel = new JPanel(new GridBagLayout());
final GridBagConstraints gb1 = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, nullIndent, 0, 0);
gb1.insets.top = 1;
gb1.gridwidth = 3;
gb.insets = topIndent;
gb.fill = GridBagConstraints.HORIZONTAL;
++gb.gridy;
final JPanel contForCopy = new JPanel(new BorderLayout());
contForCopy.add(copyPanel, BorderLayout.WEST);
myPanel.add(contForCopy, gb);
copyPanel.add(editorPane, gb1);
gb1.insets = nullIndent;
}
myPanel.revalidate();
myPanel.repaint();
}
use of org.jetbrains.idea.svn.actions.CleanupWorker in project intellij-community by JetBrains.
the class SvnVcs method cleanup17copies.
/**
* TODO: This seems to be related to some issues when upgrading from 1.6 to 1.7. So it is not currently required for 1.8 and later
* TODO: formats. And should be removed when 1.6 working copies are no longer supported by IDEA.
*/
private void cleanup17copies() {
Runnable callCleanupWorker = () -> {
if (myProject.isDisposed())
return;
new CleanupWorker(this, emptyList()) {
@Override
protected void fillRoots() {
for (WCInfo info : getAllWcInfos()) {
if (WorkingCopyFormat.ONE_DOT_SEVEN.equals(info.getFormat())) {
VirtualFile file = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(info.getRootInfo().getIoFile());
if (file == null) {
LOG.info("Wasn't able to find virtual file for wc root: " + info.getPath());
} else {
myRoots.add(file);
}
}
}
}
}.execute();
};
myCopiesRefreshManager.waitRefresh(() -> ApplicationManager.getApplication().invokeLater(callCleanupWorker));
}
Aggregations