How to popup like java file "navigate > test"

when i'm in java file, when i click 'navigate > test', it will popup a dialog, I hope implement it in ruby file, how to do it?

7 comments
Comment actions Permalink

Is there any solution?

0
Comment actions Permalink

I'm not sure what solution you need. The Ruby plugin supports this functionality out of the box.

0
Comment actions Permalink

When I'm in java file, When i click "navigate > test", it will popup a diaglog with "create new test", I hope in ruby file idea do same thing, how should i do?

0
Comment actions Permalink

What i hope is to learn how to build idea ui with openapi. so I hope build a popup dialog with idea theme

0
Comment actions Permalink

com.intellij.testIntegration.GotoTestOrCodeHandler

0
Comment actions Permalink

With your suggestion, I use following code inspire from "/home/roroco/Downloads/clion-1.2/lib/clion.jar!/com/intellij/testIntegration/GotoTestOrCodeAction.class"

 
void actionPerformed(AnActionEvent e) {
    super.actionPerformed(e)
    Presentation p = e.getPresentation();
    p.setEnabled(true);
    p.setText(ActionsBundle.message("action.GotoTestSubject.text"));
    p.setDescription(ActionsBundle.message("action.GotoTestSubject.description"));
}


But it's not popup ui, I hope a simple code to build popup dialog, the gototest code that I can implement it in other way

0
Comment actions Permalink

I find the solution, here is my code:

 
package ro.idea.c

import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.ui.popup.*
import com.intellij.ui.popup.PopupFactoryImpl

import javax.swing.*

/**
* Created by roroco on 10/28/15.
*/
class
ShowPopup extends Act {
    @Override
    void
actionPerformed(AnActionEvent e) {
        super.actionPerformed(e)
        PopupFactoryImpl f = PopupFactoryImpl.newInstance()

        ListPopup p = f.createListPopup(listPopupStep)
        p.showInFocusCenter()
    }

    ListPopupStep getListPopupStep() {
        new ListPopupStep() {

            @Override
            
List getValues() {
                ["a", "b"]
            }

            @Override
            boolean
isSelectable(Object o) {
                return false
            
}

            @Override
            
Icon getIconFor(Object o) {
                return null
            
}

            @Override
            
String getTextFor(Object o) {
                return o
            }

            @Override
            
ListSeparator getSeparatorAbove(Object o) {
                return null
            
}

            @Override
            int getDefaultOptionIndex
() {
                return 0
            
}

            @Override
            
String getTitle() {
                return "title"
            
}

            @Override
            
PopupStep onChosen(Object o, boolean b) {
                return null
            
}

            @Override
            boolean
hasSubstep(Object o) {
                return false
            
}

            @Override
            void
canceled() {

            }

            @Override
            boolean isMnemonicsNavigationEnabled
() {
                return false
            
}

            @Override
            
MnemonicNavigationFilter getMnemonicNavigationFilter() {
                return null
            
}

            @Override
            boolean isSpeedSearchEnabled
() {
                return false
            
}

            @Override
            
SpeedSearchFilter getSpeedSearchFilter() {
                return null
            
}

            @Override
            boolean isAutoSelectionEnabled
() {
                return false
            
}

            @Override
            
Runnable getFinalRunnable() {
                return null
            
}
        }
    }
}
0

Please sign in to leave a comment.