mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix NPE if MultipleFileMergeDialog was created without project (as ICS does)
This commit is contained in:
@@ -701,13 +701,18 @@ public class TextMergeTool implements MergeTool {
|
||||
}
|
||||
|
||||
private void registerUndoRedo(final boolean undo) {
|
||||
Project project = getProject();
|
||||
if (project == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<TextMergeChange> affectedChanges = getAffectedChanges();
|
||||
final List<TextMergeChange.State> states = new ArrayList<TextMergeChange.State>(affectedChanges.size());
|
||||
for (TextMergeChange change : affectedChanges) {
|
||||
states.add(change.storeState());
|
||||
}
|
||||
|
||||
UndoManager.getInstance(getProject()).undoableActionPerformed(new BasicUndoableAction(myDocument) {
|
||||
UndoManager.getInstance(project).undoableActionPerformed(new BasicUndoableAction(myDocument) {
|
||||
@Override
|
||||
public void undo() throws UnexpectedUndoException {
|
||||
if (undo) restoreStates(states);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,12 +21,13 @@ import com.intellij.openapi.fileEditor.FileEditor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public abstract class UndoManager {
|
||||
public static final Key<Document> ORIGINAL_DOCUMENT = new Key<Document>("ORIGINAL_DOCUMENT");
|
||||
|
||||
public static UndoManager getInstance(Project project) {
|
||||
public static UndoManager getInstance(@NotNull Project project) {
|
||||
return project.getComponent(UndoManager.class);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user