use of com.intellij.openapi.diff.impl.mergeTool.MergeRequestImpl 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.openapi.diff.impl.mergeTool.MergeRequestImpl in project intellij-community by JetBrains.
the class ExtMergeFiles method show.
@Override
public void show(@NotNull final DiffRequest request) {
saveContents(request);
int result = DialogWrapper.CANCEL_EXIT_CODE;
GeneralCommandLine commandLine = new GeneralCommandLine();
commandLine.setExePath(getToolPath());
try {
commandLine.addParameters(getParameters(request));
commandLine.createProcess();
ProgressManager.getInstance().run(new Task.Modal(request.getProject(), "Launching external tool", false) {
@Override
public void run(@NotNull ProgressIndicator indicator) {
indicator.setIndeterminate(true);
TimeoutUtil.sleep(1000);
}
});
if (Messages.YES == Messages.showYesNoDialog(request.getProject(), "Press \"Mark as Resolved\" when you finish resolving conflicts in the external tool", "Merge In External Tool", "Mark as Resolved", "Revert", null)) {
result = DialogWrapper.OK_EXIT_CODE;
}
((MergeRequestImpl) request).getResultContent().getFile().refresh(false, false);
// We can actually check exit code of external tool, but some of them could work with tabs -> do not close at all
} catch (Exception e) {
ExecutionErrorDialog.show(new ExecutionException(e.getMessage()), DiffBundle.message("cant.launch.diff.tool.error.message"), request.getProject());
} finally {
((MergeRequestImpl) request).setResult(result);
}
}
Aggregations