Search code examples
javaintellij-ideapluginsintellij-plugin

How to show ColorPicker from my action in IntelliJ IDEA plugin DevKit?


How to show ColorPicker from my action in IntelliJ IDEA plugin DevKit? For example I have an action:

public class TextBoxes extends AnAction {
    public void actionPerformed(AnActionEvent event) {
        // Some code
    }
}

In which I want to display ColorPicker widget:

ColorPicker colorPicker = new ColorPicker(args); // Like that
ColorPicker.showDialog(args); // Or like that

In new ColorPicker(args) format there is a Disposable parent object required. Where should I get this one? In ColorPicker.showDialog(args); there is also a Component parent object required. And again I can't understand where should I get this object? And which one is the right way to display ColorPicker from com.intellij.ui.ColorPicker package?


Solution

  • Please do it like this:

    public class TextBoxes extends AnAction {
      @Override
      public void actionPerformed(AnActionEvent event) {
        Color color = ColorPicker.showDialog(...)
      }
    }