Skip to content

Instantly share code, notes, and snippets.

@neubig
Last active Aug 26, 2019
Embed
What would you like to do?
package edu.cmu.empty;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.ui.popup.ListPopup;
import com.intellij.openapi.ui.popup.PopupStep;
import com.intellij.openapi.ui.popup.util.BaseListPopupStep;
public class HelloAction extends AnAction {
public HelloAction() {
super("Hello");
}
public void actionPerformed(AnActionEvent event) {
Project project = event.getProject();
final String query = Messages.showInputDialog(project,"Enter your query:","Query",
Messages.getQuestionIcon());
ListPopup lp = JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep<String>("Your query is " + query,
"Choice1", "Choice2") {
@Override
public PopupStep onChosen(String selectedValue, boolean finalChoice) {
System.err.println(selectedValue);
return super.onChosen(selectedValue, finalChoice);
}
});
lp.showInFocusCenter();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment