mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[diff] Simplify, fix warnings, fix code style.
This commit is contained in:
@@ -160,12 +160,13 @@ public class DiffSideView {
|
||||
|
||||
private final EditorMouseAdapter myMouseListener = new EditorMouseAdapter() {
|
||||
public void mouseReleased(EditorMouseEvent e) {
|
||||
if (!isEventHandled(e.getMouseEvent())) {
|
||||
if (!isEventHandled(e.getMouseEvent()) || !isInMyArea(e)) {
|
||||
return;
|
||||
}
|
||||
if (!isInMyArea(e)) return;
|
||||
OpenFileDescriptor descriptor = getOpenFileDescriptor(e);
|
||||
if (descriptor == null) return;
|
||||
if (descriptor == null) {
|
||||
return;
|
||||
}
|
||||
myContainer.showSource(descriptor);
|
||||
}
|
||||
};
|
||||
@@ -180,7 +181,7 @@ public class DiffSideView {
|
||||
return myContent.getOpenFileDescriptor(offset);
|
||||
}
|
||||
|
||||
private boolean isInMyArea(EditorMouseEvent e) {
|
||||
private static boolean isInMyArea(EditorMouseEvent e) {
|
||||
return e.getArea() == EditorMouseEventArea.LINE_NUMBERS_AREA;
|
||||
}
|
||||
|
||||
@@ -205,7 +206,9 @@ public class DiffSideView {
|
||||
public static void install(DiffContent content, EditorSource source, DiffSidesContainer container) {
|
||||
final Editor editor = source.getEditor();
|
||||
Project project = container.getProject();
|
||||
if (project == null) return;
|
||||
if (project == null || editor == null) {
|
||||
return;
|
||||
}
|
||||
final MouseLineNumberListener listener = new MouseLineNumberListener(content, editor, container, project);
|
||||
editor.addEditorMouseListener(listener.myMouseListener);
|
||||
editor.addEditorMouseMotionListener(listener.myMouseMotionListener);
|
||||
|
||||
Reference in New Issue
Block a user