How to fill in ComboBox from API call? Follow
Answered
I need to call an API, get a response, add items to ComboBox and update the view in the plugin.
I need to update the thread Ids as they load from an API. My custom Combobox for this is as shown below. I am not sure how to update the custom component from outside the class. Any help?
public class MyComboBox extends AnAction implements CustomComponentAction {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
}
@Override
public @NotNull JComponent createCustomComponent(@NotNull Presentation presentation, @NotNull String place) {
ComboBox<String> jComboBox = new ComboBox<>();
jComboBox.setMinLength(100);
jComboBox.addItem("Thread Id: " + UUID.randomUUID().toString());
jComboBox.addItem("Thread Id: " + UUID.randomUUID().toString());
jComboBox.setEnabled(true);
return jComboBox;
}
}
Post is closed for comments.
I have declared the combobox in the action group in plugin.xml the following way:
Please don't crosspost or at least link existing questions to avoid duplicate work
https://stackoverflow.com/questions/70728161/how-to-fill-in-combobox-from-an-api-call