mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-21 14:37:45 +07:00
diff: getEditors() - accept nullable values
This commit is contained in:
@@ -78,12 +78,12 @@ public abstract class TextDiffViewerBase extends ListenerDiffViewerBase {
|
||||
List<? extends EditorEx> editors = getEditors();
|
||||
|
||||
for (EditorEx editor : editors) {
|
||||
editor.addEditorMouseListener(myEditorPopupListener);
|
||||
if (editor != null) editor.addEditorMouseListener(myEditorPopupListener);
|
||||
}
|
||||
|
||||
if (editors.size() > 1) {
|
||||
for (EditorEx editor : editors) {
|
||||
editor.addPropertyChangeListener(myFontSizeListener);
|
||||
if (editor != null) editor.addPropertyChangeListener(myFontSizeListener);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,12 +93,12 @@ public abstract class TextDiffViewerBase extends ListenerDiffViewerBase {
|
||||
List<? extends EditorEx> editors = getEditors();
|
||||
|
||||
for (EditorEx editor : editors) {
|
||||
editor.removeEditorMouseListener(myEditorPopupListener);
|
||||
if (editor != null) editor.removeEditorMouseListener(myEditorPopupListener);
|
||||
}
|
||||
|
||||
if (editors.size() > 1) {
|
||||
for (EditorEx editor : editors) {
|
||||
editor.removePropertyChangeListener(myFontSizeListener);
|
||||
if (editor != null) editor.removePropertyChangeListener(myFontSizeListener);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -183,7 +183,7 @@ public abstract class TextDiffViewerBase extends ListenerDiffViewerBase {
|
||||
int fontSize = ((Integer)evt.getNewValue()).intValue();
|
||||
|
||||
for (EditorEx editor : getEditors()) {
|
||||
if (evt.getSource() != editor) updateEditor(editor, fontSize);
|
||||
if (editor != null && evt.getSource() != editor) updateEditor(editor, fontSize);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,7 +449,7 @@ public abstract class TextDiffViewerBase extends ListenerDiffViewerBase {
|
||||
return ContainerUtil.filter(editors, new Condition<EditorEx>() {
|
||||
@Override
|
||||
public boolean value(EditorEx editor) {
|
||||
return !editor.isViewer();
|
||||
return editor != null && !editor.isViewer();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+1
-11
@@ -52,7 +52,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class TwosideTextDiffViewer extends TextDiffViewerBase {
|
||||
@@ -218,16 +217,7 @@ public abstract class TwosideTextDiffViewer extends TextDiffViewerBase {
|
||||
@NotNull
|
||||
@Override
|
||||
protected List<? extends EditorEx> getEditors() {
|
||||
if (getEditor1() != null && getEditor2() != null) {
|
||||
return ContainerUtil.list(getEditor1(), getEditor2());
|
||||
}
|
||||
if (getEditor1() != null) {
|
||||
return Collections.singletonList(getEditor1());
|
||||
}
|
||||
if (getEditor2() != null) {
|
||||
return Collections.singletonList(getEditor2());
|
||||
}
|
||||
return Collections.emptyList();
|
||||
return ContainerUtil.list(getEditor1(), getEditor2());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+1
@@ -72,6 +72,7 @@ public class SvnPropertiesDiffViewer extends TwosideTextDiffViewer {
|
||||
assert getEditor1() != null && getEditor2() != null;
|
||||
|
||||
for (EditorEx editor : getEditors()) {
|
||||
if (editor == null) continue;
|
||||
EditorSettings settings = editor.getSettings();
|
||||
|
||||
settings.setAdditionalLinesCount(0);
|
||||
|
||||
Reference in New Issue
Block a user