use of com.intellij.util.containers.Convertor in project intellij-community by JetBrains.
the class MergePanel2 method setDiffRequest.
public void setDiffRequest(DiffRequest data) {
setTitle(data.getWindowTitle());
disposeMergeList();
for (int i = 0; i < EDITORS_COUNT; i++) {
getEditorPlace(i).setDocument(null);
}
LOG.assertTrue(!myDuringCreation);
myDuringCreation = true;
myProvider.putData(data.getGenericData());
try {
myData = data;
String[] titles = myData.getContentTitles();
for (int i = 0; i < myEditorsPanels.length; i++) {
LabeledComponent editorsPanel = myEditorsPanels[i];
editorsPanel.getLabel().setText(titles[i].isEmpty() ? " " : titles[i]);
}
createMergeList();
data.customizeToolbar(myPanel.resetToolbar());
myPanel.registerToolbarActions();
if (data instanceof MergeRequestImpl && myBuilder != null) {
Convertor<DialogWrapper, Boolean> preOkHook = new Convertor<DialogWrapper, Boolean>() {
@Override
public Boolean convert(DialogWrapper dialog) {
ChangeCounter counter = ChangeCounter.getOrCreate(myMergeList);
int changes = counter.getChangeCounter();
int conflicts = counter.getConflictCounter();
if (changes == 0 && conflicts == 0)
return true;
return Messages.showYesNoDialog(dialog.getRootPane(), DiffBundle.message("merge.dialog.apply.partially.resolved.changes.confirmation.message", changes, conflicts), DiffBundle.message("apply.partially.resolved.merge.dialog.title"), Messages.getQuestionIcon()) == Messages.YES;
}
};
((MergeRequestImpl) data).setActions(myBuilder, this, preOkHook);
}
} finally {
myDuringCreation = false;
}
}
use of com.intellij.util.containers.Convertor in project intellij-community by JetBrains.
the class GithubCreatePullRequestWorker method showTargetDialog.
@Nullable
public ForkInfo showTargetDialog() {
if (myAvailableForks == null) {
try {
myAvailableForks = GithubUtil.computeValueInModal(myProject, myCurrentBranch, indicator -> getAvailableForks(indicator));
} catch (ProcessCanceledException ignore) {
}
}
Convertor<String, ForkInfo> getForkPath = user -> GithubUtil.computeValueInModal(myProject, "Access to GitHub", indicator -> findRepositoryByUser(indicator, user));
GithubSelectForkDialog dialog = new GithubSelectForkDialog(myProject, myAvailableForks, getForkPath);
DialogManager.show(dialog);
if (!dialog.isOK()) {
return null;
}
return dialog.getPath();
}
use of com.intellij.util.containers.Convertor in project android by JetBrains.
the class ApkDiffPanel method createUIComponents.
private void createUIComponents() {
myTreeModel = new DefaultTreeModel(new LoadingNode());
myTree = new Tree(myTreeModel);
myTree.setShowsRootHandles(true);
// show root node only when showing LoadingNode
myTree.setRootVisible(true);
myTree.setPaintBusy(true);
Convertor<TreePath, String> convertor = new Convertor<TreePath, String>() {
@Override
public String convert(TreePath path) {
ApkEntry e = ApkEntry.fromNode(path.getLastPathComponent());
if (e == null) {
return null;
}
return e.getPath();
}
};
TreeSpeedSearch treeSpeedSearch = new TreeSpeedSearch(myTree, convertor, true);
ColumnTreeBuilder builder = new ColumnTreeBuilder(myTree).addColumn(new ColumnTreeBuilder.ColumnBuilder().setName("File").setPreferredWidth(600).setHeaderAlignment(SwingConstants.LEADING).setRenderer(new NameRenderer(treeSpeedSearch))).addColumn(new ColumnTreeBuilder.ColumnBuilder().setName("Old Size").setPreferredWidth(150).setHeaderAlignment(SwingConstants.TRAILING).setRenderer(new SizeRenderer(ApkDiffEntry::getOldSize))).addColumn(new ColumnTreeBuilder.ColumnBuilder().setName("New Size").setPreferredWidth(150).setHeaderAlignment(SwingConstants.TRAILING).setRenderer(new SizeRenderer(ApkDiffEntry::getNewSize))).addColumn(new ColumnTreeBuilder.ColumnBuilder().setName("Diff Size").setPreferredWidth(150).setHeaderAlignment(SwingConstants.TRAILING).setRenderer(new SizeRenderer(ApkEntry::getSize)));
myColumnTreePane = (JScrollPane) builder.build();
}
Aggregations