Action perform on specific file type
已回答
I created an action on CutCopyPasteGroup but I want to perform that action only on json files. Is it possible?
请先登录再写评论。
Yes:
I can detect file's type in action, i want to create an action that only triggered on right clicks on json files. User will not able to see the plugin if performs right click on the e.g. a java file.
something like this:
The question you are really asking, then is "How can I include/hide an action on the context menu depending upon the editor's file type?" Not whether you can only perform the action on a particular file type.
So, this should work:
Actually i'm asking a real filtering. Your last code worked fine in UI but when right clicking on file, action triggered and then hiding. I'm asking is it possible to never trigger action when clicked different file types.
Btw your code fine for me, i implemented it. My real question about performance.
Thank you so much!
Please see the docs http://www.jetbrains.org/intellij/sdk/docs/tutorials/action_system/working_with_custom_actions.html?#setting-up-an-actions-visibility-and-availability