mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
merge: abort patch applying in read-only documents
This commit is contained in:
committed by
Aleksey Pivovarov
parent
f277f6aafd
commit
6adf8509af
@@ -35,7 +35,6 @@ public class SimpleDiffPanel extends DiffPanelBase {
|
||||
JPanel centerPanel = JBUI.Panels.simplePanel(editorPanel).addToTop(myNotificationsPanel);
|
||||
|
||||
myContentPanel.add(centerPanel, GOOD_CONTENT);
|
||||
myContentPanel.add(DiffUtil.createMessagePanel("Error"), ERROR_CONTENT);
|
||||
|
||||
setCurrentCard(GOOD_CONTENT, false);
|
||||
}
|
||||
@@ -49,6 +48,11 @@ public class SimpleDiffPanel extends DiffPanelBase {
|
||||
}
|
||||
|
||||
public void setErrorContent() {
|
||||
setErrorContent("Error");
|
||||
}
|
||||
|
||||
public void setErrorContent(@NotNull String message) {
|
||||
myContentPanel.add(DiffUtil.createMessagePanel(message), ERROR_CONTENT);
|
||||
setCurrentCard(ERROR_CONTENT);
|
||||
}
|
||||
|
||||
|
||||
+6
-1
@@ -49,6 +49,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.BooleanGetter;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vcs.changes.patch.AppliedTextPatch;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import gnu.trove.TIntArrayList;
|
||||
@@ -285,10 +286,14 @@ class ApplyPatchViewer implements DataProvider, Disposable {
|
||||
|
||||
protected void initPatchViewer() {
|
||||
final Document outputDocument = myResultEditor.getDocument();
|
||||
DiffUtil.executeWriteCommand(outputDocument, myProject, "Init merge content", () -> {
|
||||
boolean success = DiffUtil.executeWriteCommand(outputDocument, myProject, "Init merge content", () -> {
|
||||
outputDocument.setText(myPatchRequest.getLocalContent());
|
||||
if (!isReadOnly()) DiffUtil.putNonundoableOperation(myProject, outputDocument);
|
||||
});
|
||||
if (!success && !StringUtil.equals(outputDocument.getText(), myPatchRequest.getLocalContent())) {
|
||||
myPanel.setErrorContent("Failed to display patch applier - local content was modified");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
PatchChangeBuilder builder = new PatchChangeBuilder();
|
||||
|
||||
Reference in New Issue
Block a user