Commit a50feb84 authored by Daniil Ovchinnikov's avatar Daniil Ovchinnikov
Browse files

delegate getData() to appropriate GutterIconRenderer

parent d3e719b8
Branches unavailable Tags unavailable
No related merge requests found
Showing with 21 additions and 9 deletions
+21 -9
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 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.
......@@ -128,6 +128,11 @@ public abstract class GutterIconRenderer implements GutterMark, PossiblyDumbAwar
return null;
}
@Nullable
public Object getData(@NotNull String dataId) {
return null;
}
public enum Alignment {
LEFT(1),
RIGHT(3),
......
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 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.
......@@ -17,6 +17,7 @@
package com.intellij.codeInsight.daemon;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.editor.markup.GutterIconRenderer;
import com.intellij.openapi.editor.markup.RangeHighlighter;
import com.intellij.openapi.editor.markup.SeparatorPlacement;
......@@ -169,6 +170,15 @@ public class LineMarkerInfo<T extends PsiElement> {
return myInfo.myIconAlignment;
}
@Nullable
@Override
public Object getData(@NotNull String dataId) {
if (CommonDataKeys.PSI_ELEMENT.is(dataId)) {
return getLineMarkerInfo().getElement();
}
return super.getData(dataId);
}
protected boolean looksTheSameAs(@NotNull LineMarkerGutterIconRenderer renderer) {
return
myInfo.getElement() != null &&
......
......@@ -25,7 +25,6 @@
package com.intellij.openapi.editor.impl;
import com.intellij.codeInsight.daemon.GutterMark;
import com.intellij.codeInsight.daemon.LineMarkerInfo;
import com.intellij.codeInsight.hint.TooltipController;
import com.intellij.codeInsight.hint.TooltipGroup;
import com.intellij.ide.IdeEventQueue;
......@@ -591,12 +590,10 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse
else if (CommonDataKeys.EDITOR.is(dataId)) {
return myEditor;
}
else if (CommonDataKeys.PSI_ELEMENT.is(dataId)) {
if (point != null) {
GutterMark renderer = getGutterRenderer(point);
if (renderer instanceof LineMarkerInfo.LineMarkerGutterIconRenderer) {
return ((LineMarkerInfo.LineMarkerGutterIconRenderer)renderer).getLineMarkerInfo().getElement();
}
else if (point != null) {
GutterMark renderer = getGutterRenderer(point);
if (renderer instanceof GutterIconRenderer) {
return ((GutterIconRenderer)renderer).getData(dataId);
}
}
return null;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment