Guest User

Untitled

a guest
Feb 21st, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. include Java
  2.  
  3. import com.intellij.codeInsight.intention.IntentionAction unless defined? IntentionAction
  4. import com.intellij.codeInsight.intention.IntentionManager unless defined? IntentionManager
  5. import org.jetbrains.plugins.ruby.ruby.lang.psi.RubyElementFactory unless defined? RubyElementFactory
  6.  
  7. require File.dirname(__FILE__) + '/../util/psi_helper'
  8.  
  9. # skip
  10.  
  11. class RubyIntentionAction
  12. include IntentionAction
  13.  
  14. def initialize(name, block)
  15. @name = name
  16. @block = block
  17. end
  18.  
  19. def getText()
  20. @name
  21. end
  22.  
  23. def getFamilyName()
  24. @name
  25. end
  26.  
  27. def isAvailable(project, editor, file)
  28. context = CheckAvailableContext.new(project, editor, file)
  29. @block.call context
  30. context.available
  31. end
  32.  
  33. def invoke(project, editor, file)
  34. @block.call ExecuteContext.new(project, editor, file)
  35. end
  36.  
  37. def startInWriteAction()
  38. true
  39. end
  40. end
  41.  
  42. def register_intention_action(name, options, &block)
  43. action = RubyIntentionAction.new name, block
  44. # skip
  45. end
Add Comment
Please, Sign In to add comment