mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[diff] Go to source on Ctrl/Cmd+Click on line number of local version
Go to source was previously executed on plain click, but it provided a lot of confusion and was removed: IDEA-100782. But some users miss this feature: IDEA-101289. For them use Ctrl/Cmd+Click (as in Go to declaration in the editor).
This commit is contained in:
@@ -34,6 +34,7 @@ import com.intellij.openapi.editor.highlighter.EditorHighlighter;
|
||||
import com.intellij.openapi.fileEditor.FileEditor;
|
||||
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.util.IJSwingUtilities;
|
||||
import com.intellij.util.ui.ScrollUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -45,6 +46,7 @@ import javax.swing.border.Border;
|
||||
import java.awt.*;
|
||||
import java.awt.event.FocusAdapter;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
public class DiffSideView {
|
||||
@@ -158,7 +160,7 @@ public class DiffSideView {
|
||||
|
||||
private final EditorMouseAdapter myMouseListener = new EditorMouseAdapter() {
|
||||
public void mouseReleased(EditorMouseEvent e) {
|
||||
if (e.getMouseEvent().getButton() != MouseEvent.BUTTON1) {
|
||||
if (!isEventHandled(e.getMouseEvent())) {
|
||||
return;
|
||||
}
|
||||
if (!isInMyArea(e)) return;
|
||||
@@ -168,6 +170,11 @@ public class DiffSideView {
|
||||
}
|
||||
};
|
||||
|
||||
private static boolean isEventHandled(MouseEvent e) {
|
||||
int mask = SystemInfo.isMac ? InputEvent.META_MASK : InputEvent.CTRL_MASK;
|
||||
return e.getButton() == MouseEvent.BUTTON1 && (e.getModifiers() & mask) != 0;
|
||||
}
|
||||
|
||||
private OpenFileDescriptor getOpenFileDescriptor(EditorMouseEvent e) {
|
||||
int offset = myEditor.logicalPositionToOffset(myEditor.xyToLogicalPosition(e.getMouseEvent().getPoint()));
|
||||
return myContent.getOpenFileDescriptor(offset);
|
||||
|
||||
Reference in New Issue
Block a user