Intention API
Hi All,
starting from build 816, we have opened API for pluggable intention actions
(on the same terms as PSI).
See info, JavaDoc and sample plugin here:
http://www.intellij.org/twiki/bin/view/Main/IntentionPlugins
You are welcome to ask questions :)
Cheers,
Dmitry
--
Dmitry Lomov
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"
请先登录再写评论。
Oh, awesome, I've been waiting a while for this. That just leaves pluggable live template commands in my triad of desires (this and PSI itself being the other two). Any idea when we'll get that?
Dmitry Lomov wrote:
It looks good, very simple. Simple is good 8)
Suggestion: The invoke method on IntentionAction should provide an
offset parameter like the isAvailable method does. Why should the
implementation of invoke assume the caret offset is to be used when the
isAvailable given the offset? Consistency is what I'm after here.
Ciao,
Gordon
--
Gordon Tyler (Software Developer)
Quest Software <http://java.quest.com/>
260 King Street East, Toronto, Ontario M5A 4L5, Canada
Voice: 416-643-4846 | Fax: 416-594-1919
You are right. We changed that so since #817 it is isAvailable(Project
project, Editor editor, PsiFile file).
--
Valentin Kipiatkov
JetBrains, Inc
http://www.intellij.com
"Develop with pleasure!"
"Gordon Tyler" <gordon.tyler@quest.com> wrote in message
news:battoc$hhv$1@is.intellij.net...
actions
>
>
>
>
>
Valentin Kipiatkov wrote:
But my point is that it makes more sense for both methods to have an
offset parameter. Would an IntentionAction ever want to operate on an
offset that is not the caret position? I can't think of one.
If an IntentionAction always operates on the caret position, the same
code to get the caret position is going to be needlessly repeated in
every IntentionAction implementation, whereas it could be written once
in the IDEA code that calls the IntentionActions and passed as an offset
parameter to both methods on IntentionAction.
Ciao,
Gordon
--
Gordon Tyler (Software Developer)
Quest Software <http://java.quest.com/>
260 King Street East, Toronto, Ontario M5A 4L5, Canada
Voice: 416-643-4846 | Fax: 416-594-1919
Gordon,
IMHO, intention action operating on selection is a neat idea, isn't it?
Extra credit: give 3 different examples :)
Cheers,
Dmitry
Gordon Tyler wrote:
>> You are right. We changed that so since #817 it is isAvailable(Project
>> project, Editor editor, PsiFile file).
--
Dmitry Lomov
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"
Dmitry Lomov wrote:
Hmmm... That's a good point.
Gyah. Off the top of my head I can't think of any but I'm sure some of
the inventive minds on this forum will come up with some very quickly ;)
Actually, the only thing I can think of is to apply one of the existing
intentions to multiple points, e.g. "Split into declaration and
assignment" on a group of variables with assignments.
What were your 3 different examples?
Ciao,
Gordon
--
Gordon Tyler (Software Developer)
Quest Software <http://java.quest.com/>
260 King Street East, Toronto, Ontario M5A 4L5, Canada
Voice: 416-643-4846 | Fax: 416-594-1919
First of, YES, I am aware it's old ;)
I'd think of writing a "reverse assignment" plugins, which would transform, whenever possible, "a = b.getC();" into "b.setC(a);".
And I would love to have it applicable to a selection, so it would search for all assignments in the selected range...
But ok, otherwise, I'll probably implement it as
a) an intention
b) an action