Skip to content

Instantly share code, notes, and snippets.

@neubig
Last active August 26, 2019 15:08
Show Gist options
  • Save neubig/45c6c382110714aef0f4b1834991fbf2 to your computer and use it in GitHub Desktop.
Save neubig/45c6c382110714aef0f4b1834991fbf2 to your computer and use it in GitHub Desktop.
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