Actions and Dialogs

hi
i have an action which needs some options , so i wanna invoke a dialog when the action get selected,what is the recommended way
1-use and invoke a swing JDialog (is this prohibited or not recommended?)
2- use the openapi DialogBuilder and DialogWrapper(which one to use,what is the difference between them ,and when should i use either of them?)
--are they provide ok,cancel button by default, how my action implemented,an an AnAction subclass or runnable and passed to setXXXOperation
--actually a small example will be appreciated
--
3-is there an AnAction subclass suitable or specific for my need(invoke a dialog)
joe

2 comments
Comment actions Permalink

Hello joe,

j> i have an action which needs some options , so i wanna invoke a
j> dialog when the action get selected,what is the recommended way
j>
j> 1-use and invoke a swing JDialog (is this prohibited or not
j> recommended?)

You can use JDialog if you'd like to, but there is a lot of nice stuff (like
position remembering) that DialogWrapper gives you nearly for free, so it's
better to use DialogWrapper.

j> 2- use the openapi DialogBuilder and DialogWrapper(which one to
j> use,what is the difference between them ,and when should i use either
j> of them?)

In fact DialogBuilder is a helper class that allows you to construct a DialogWrapper
instance without inheriting a class from DialogWrapper. The difference is
in the API, not in functionality, so you can use whatever is most convenient
for you.

j> --are they provide ok,cancel button by default, how my action
j> implemented,an an AnAction subclass or runnable and passed to
j> setXXXOperation

Yes, OK and Cancel buttons are provided by default. If your workflow is "show
a dialog, then do something if the user pressed OK", you can put your OK
handling code in the same place where you invoke the dialog. Alternatively,
you can override DialogWrapper.doOKAction() or use some of the other available
APIs. Again, there is no difference in functionality, and you can use whatever
is convenient.

j> --actually a small example will be appreciated

There are lots of dialogs derived from DialogWrapper in the OpenAPI sources
and in the plugins included in the development package.

j> 3-is there an AnAction subclass suitable or specific for my
j> need(invoke a dialog)

No.

--
Dmitry Jemerov
Software Developer
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

for now this seam sufficient

0

Please sign in to leave a comment.