From 7228f397be7bc6d665b89798bcbd124138eded78 Mon Sep 17 00:00:00 2001 From: Alexander Lobas Date: Wed, 18 Feb 2015 15:24:31 +0300 Subject: [PATCH] OC-11478 Navigate to super and overriding methods in Swift (after review) --- .../daemon/MergeableLineMarkerInfo.java | 3 ++- .../src/messages/CodeInsightBundle.properties | 2 ++ .../fixtures/CodeInsightTestFixture.java | 3 +++ .../impl/CodeInsightTestFixtureImpl.java | 23 +++++++++++++++---- .../util/src/com/intellij/util/ui/UIUtil.java | 1 + 5 files changed, 26 insertions(+), 6 deletions(-) diff --git a/platform/lang-api/src/com/intellij/codeInsight/daemon/MergeableLineMarkerInfo.java b/platform/lang-api/src/com/intellij/codeInsight/daemon/MergeableLineMarkerInfo.java index 2450f3fa009d..f484c9fe7bfb 100644 --- a/platform/lang-api/src/com/intellij/codeInsight/daemon/MergeableLineMarkerInfo.java +++ b/platform/lang-api/src/com/intellij/codeInsight/daemon/MergeableLineMarkerInfo.java @@ -27,6 +27,7 @@ import com.intellij.ui.components.JBList; import com.intellij.util.Function; import com.intellij.util.NotNullFunction; import com.intellij.util.SmartList; +import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -120,7 +121,7 @@ public abstract class MergeableLineMarkerInfo extends Line } }); final JBList list = new JBList(infos); - list.setFixedCellHeight(20); + list.setFixedCellHeight(UIUtil.LIST_FIXED_CELL_HEIGHT); PopupChooserBuilder builder = JBPopupFactory.getInstance().createListPopupBuilder(list); if (!markers.get(0).configurePopupAndRenderer(builder, list, infos)) { list.installCellRenderer(new NotNullFunction() { diff --git a/platform/platform-resources-en/src/messages/CodeInsightBundle.properties b/platform/platform-resources-en/src/messages/CodeInsightBundle.properties index c5b0f1659aa1..4bc964e86b0e 100644 --- a/platform/platform-resources-en/src/messages/CodeInsightBundle.properties +++ b/platform/platform-resources-en/src/messages/CodeInsightBundle.properties @@ -279,7 +279,9 @@ goto.test.findUsages.subject.title=Test Subjects for {0} goto.test.notFound=No test subjects found incremental.search.tooltip.prefix=Search for: +goto.super.field.chooser.title=Choose super field goto.super.method.chooser.title=Choose super method +goto.super.method.of.chooser.title=Choose Super Method of {0} goto.super.method.findUsages.title=Super methods of {0} goto.super.class.chooser.title=Choose super class or interface javadoc.action.back=Back diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightTestFixture.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightTestFixture.java index 61efedf49fc2..ddb10ac6bef1 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightTestFixture.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightTestFixture.java @@ -439,6 +439,9 @@ public interface CodeInsightTestFixture extends IdeaProjectTestFixture { @Nullable GutterMark findGutter(@NotNull @TestDataFile @NonNls String filePath); + @NotNull + Collection findCaretGutters(); + @NotNull PsiManager getPsiManager(); diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java index aefc49b6b396..549ece165851 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java @@ -923,14 +923,28 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig @Nullable public GutterMark findGutter(@NotNull final String filePath) { configureByFilesInner(filePath); + CommonProcessors.FindFirstProcessor processor = new CommonProcessors.FindFirstProcessor(); + findGutters(processor); + return processor.getFoundValue(); + } + + @NotNull + @Override + public Collection findCaretGutters() { + CommonProcessors.CollectProcessor processor = new CommonProcessors.CollectProcessor(); + findGutters(processor); + return processor.getResults(); + } + + private void findGutters(Processor processor) { int offset = myEditor.getCaretModel().getOffset(); final Collection infos = doHighlighting(); for (HighlightInfo info : infos) { if (info.endOffset >= offset && info.startOffset <= offset) { final GutterMark renderer = info.getGutterIconRenderer(); - if (renderer != null) { - return renderer; + if (renderer != null && !processor.process(renderer)) { + return; } } } @@ -938,12 +952,11 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig for (RangeHighlighter highlighter : highlighters) { if (highlighter.getEndOffset() >= offset && highlighter.getStartOffset() <= offset) { GutterMark renderer = highlighter.getGutterIconRenderer(); - if (renderer != null) { - return renderer; + if (renderer != null && !processor.process(renderer)) { + return; } } } - return null; } @Override diff --git a/platform/util/src/com/intellij/util/ui/UIUtil.java b/platform/util/src/com/intellij/util/ui/UIUtil.java index 5156c8111d4c..d1bc1bd5a599 100644 --- a/platform/util/src/com/intellij/util/ui/UIUtil.java +++ b/platform/util/src/com/intellij/util/ui/UIUtil.java @@ -2633,6 +2633,7 @@ public class UIUtil { return SystemInfo.isMac && isUnderAquaLookAndFeel() ? 28 : height; } + public static final int LIST_FIXED_CELL_HEIGHT = 20; /** * The main difference from javax.swing.SwingUtilities#isDescendingFrom(Component, Component) is that this method