IDEA-123075 "Suspend breakpoint" (Alt+Button1) conflicts with keymap-defined Alt+Button1

This commit is contained in:
Egor.Ushakov
2015-03-04 13:11:52 +03:00
parent e86a844349
commit 27fa7af291
4 changed files with 22 additions and 21 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 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.
@@ -15,6 +15,7 @@
*/
package com.intellij.openapi.editor;
import com.intellij.openapi.actionSystem.DataKey;
import org.jetbrains.annotations.NotNull;
/**
@@ -26,6 +27,8 @@ import org.jetbrains.annotations.NotNull;
* @see Editor#getGutter()
*/
public interface EditorGutter {
DataKey<EditorGutter> KEY = DataKey.create("EditorGutter");
/**
* Adds a provider for drawing custom text annotations in the editor gutter.
*
@@ -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.
@@ -26,6 +26,7 @@ import com.intellij.featureStatistics.FeatureUsageTracker;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.EditorGutter;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.IndexNotReadyException;
import com.intellij.openapi.project.Project;
@@ -92,6 +93,10 @@ public class ShowQuickDocInfoAction extends BaseCodeInsightAction implements Hin
}
else {
if (editor != null) {
if (EditorGutter.KEY.getData(event.getDataContext()) != null) {
presentation.setEnabled(false);
return;
}
PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
if (file == null) {
presentation.setEnabled(false);
@@ -62,6 +62,7 @@ import gnu.trove.TIntArrayList;
import gnu.trove.TIntFunction;
import gnu.trove.TIntObjectHashMap;
import gnu.trove.TObjectProcedure;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -73,7 +74,7 @@ import java.awt.geom.AffineTransform;
import java.util.*;
import java.util.List;
class EditorGutterComponentImpl extends EditorGutterComponentEx implements MouseListener, MouseMotionListener {
class EditorGutterComponentImpl extends EditorGutterComponentEx implements MouseListener, MouseMotionListener, DataProvider {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.editor.impl.EditorGutterComponentImpl");
private static final int START_ICON_AREA_WIDTH = 15;
private static final int FREE_PAINTERS_AREA_WIDTH = 5;
@@ -480,6 +481,12 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse
return Math.max(0, myEditor.getDocument().getLineCount() - 1);
}
@Nullable
@Override
public Object getData(@NonNls String dataId) {
return EditorGutter.KEY.is(dataId) ? this : null;
}
private interface RangeHighlighterProcessor {
void process(@NotNull RangeHighlighter highlighter);
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 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.
@@ -18,8 +18,8 @@ package com.intellij.xdebugger.impl.actions;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.EditorGutter;
import com.intellij.openapi.editor.LogicalPosition;
import com.intellij.openapi.editor.event.EditorMouseEventArea;
import com.intellij.openapi.project.Project;
import com.intellij.xdebugger.impl.DebuggerSupport;
import com.intellij.xdebugger.impl.evaluate.quick.common.QuickEvaluateHandler;
@@ -27,11 +27,6 @@ import com.intellij.xdebugger.impl.evaluate.quick.common.ValueHintType;
import com.intellij.xdebugger.impl.evaluate.quick.common.ValueLookupManager;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.awt.*;
import java.awt.event.InputEvent;
import java.awt.event.MouseEvent;
/**
* @author nik
*/
@@ -74,17 +69,8 @@ public class QuickEvaluateAction extends XDebuggerActionBase {
return false;
}
InputEvent inputEvent = event.getInputEvent();
if (inputEvent instanceof MouseEvent && inputEvent.isAltDown()) {
MouseEvent mouseEvent = (MouseEvent)inputEvent;
Component component = SwingUtilities.getDeepestComponentAt(mouseEvent.getComponent(), mouseEvent.getX(), mouseEvent.getY());
if (SwingUtilities.isDescendingFrom(component, editor.getComponent())) {
MouseEvent convertedEvent = SwingUtilities.convertMouseEvent(mouseEvent.getComponent(), mouseEvent, component);
EditorMouseEventArea area = editor.getMouseEventArea(convertedEvent);
if (area != EditorMouseEventArea.EDITING_AREA) {
return false;
}
}
if (EditorGutter.KEY.getData(event.getDataContext()) != null) {
return false;
}
return true;