diff --git a/platform/editor-ui-api/src/com/intellij/openapi/editor/EditorGutter.java b/platform/editor-ui-api/src/com/intellij/openapi/editor/EditorGutter.java index a1befee4b630..b7ce47cc2481 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/editor/EditorGutter.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/editor/EditorGutter.java @@ -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 KEY = DataKey.create("EditorGutter"); + /** * Adds a provider for drawing custom text annotations in the editor gutter. * diff --git a/platform/lang-impl/src/com/intellij/codeInsight/documentation/actions/ShowQuickDocInfoAction.java b/platform/lang-impl/src/com/intellij/codeInsight/documentation/actions/ShowQuickDocInfoAction.java index dfe8f6b213ac..ee8241740329 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/documentation/actions/ShowQuickDocInfoAction.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/documentation/actions/ShowQuickDocInfoAction.java @@ -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); diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java index 790a3ffb2044..eb3099bba755 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java @@ -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); } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/QuickEvaluateAction.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/QuickEvaluateAction.java index be54d591d378..dd62294432b1 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/QuickEvaluateAction.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/QuickEvaluateAction.java @@ -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;