Example usage for com.intellij.openapi.ui.popup PopupChooserBuilder setResizable

List of usage examples for com.intellij.openapi.ui.popup PopupChooserBuilder setResizable

Introduction

In this page you can find the example usage for com.intellij.openapi.ui.popup PopupChooserBuilder setResizable.

Prototype

@Override
    public PopupChooserBuilder<T> setResizable(final boolean forceResizable) 

Source Link

Usage

From source file:org.jboss.forge.plugin.idea.ui.CommandListPopupBuilder.java

License:Open Source License

private JBPopup buildPopup(final JBList list, final Map<Object, String> filterIndex) {
    final PopupChooserBuilder listPopupBuilder = JBPopupFactory.getInstance().createListPopupBuilder(list);
    listPopupBuilder.setTitle("Run a Forge command");
    listPopupBuilder.setResizable(true);
    listPopupBuilder.addListener(new JBPopupAdapter() {
        @Override//w  w  w  . ja v  a 2 s  . co  m
        public void onClosed(LightweightWindowEvent event) {
            CommandListPopupBuilder.this.active = false;
        }
    });
    listPopupBuilder.setItemChoosenCallback(new Runnable() {
        @Override
        public void run() {
            Object selectedObject = list.getSelectedValue();
            if (selectedObject instanceof UICommand) {
                UICommand selectedCommand = (UICommand) selectedObject;

                // Make sure that this cached command is still enabled
                if (selectedCommand.isEnabled(uiContext)) {
                    openWizard(selectedCommand);
                }
            }
        }
    });
    listPopupBuilder.setFilteringEnabled(new Function<Object, String>() {
        @Override
        public String fun(Object object) {
            return filterIndex.get(object);
        }
    });

    return listPopupBuilder.createPopup();
}