Search in sources :

Example 1 with ComponentPopupBuilderImpl

use of com.intellij.ui.popup.ComponentPopupBuilderImpl in project intellij-community by JetBrains.

the class CodeInsightTestUtil method gotoImplementation.

@NotNull
@TestOnly
public static GotoTargetHandler.GotoData gotoImplementation(Editor editor, PsiFile file) {
    GotoTargetHandler.GotoData data = new GotoImplementationHandler().getSourceAndTargetElements(editor, file);
    if (data.listUpdaterTask != null) {
        JBList list = new JBList();
        CollectionListModel model = new CollectionListModel(new ArrayList());
        list.setModel(model);
        list.setModel(new NameFilteringListModel(list, Function.ID, Condition.FALSE, String::new));
        JBPopup popup = new ComponentPopupBuilderImpl(list, null).createPopup();
        data.listUpdaterTask.init((AbstractPopup) popup, list, new Ref<>());
        data.listUpdaterTask.queue();
        try {
            while (!data.listUpdaterTask.isFinished()) {
                UIUtil.dispatchAllInvocationEvents();
            }
        } finally {
            Disposer.dispose(popup);
        }
    }
    return data;
}
Also used : NameFilteringListModel(com.intellij.ui.speedSearch.NameFilteringListModel) GotoTargetHandler(com.intellij.codeInsight.navigation.GotoTargetHandler) GotoImplementationHandler(com.intellij.codeInsight.navigation.GotoImplementationHandler) ArrayList(java.util.ArrayList) JBList(com.intellij.ui.components.JBList) CollectionListModel(com.intellij.ui.CollectionListModel) JBPopup(com.intellij.openapi.ui.popup.JBPopup) ComponentPopupBuilderImpl(com.intellij.ui.popup.ComponentPopupBuilderImpl) TestOnly(org.jetbrains.annotations.TestOnly) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

GotoImplementationHandler (com.intellij.codeInsight.navigation.GotoImplementationHandler)1 GotoTargetHandler (com.intellij.codeInsight.navigation.GotoTargetHandler)1 JBPopup (com.intellij.openapi.ui.popup.JBPopup)1 CollectionListModel (com.intellij.ui.CollectionListModel)1 JBList (com.intellij.ui.components.JBList)1 ComponentPopupBuilderImpl (com.intellij.ui.popup.ComponentPopupBuilderImpl)1 NameFilteringListModel (com.intellij.ui.speedSearch.NameFilteringListModel)1 ArrayList (java.util.ArrayList)1 NotNull (org.jetbrains.annotations.NotNull)1 TestOnly (org.jetbrains.annotations.TestOnly)1