Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include Java
- import com.intellij.codeInsight.intention.IntentionAction unless defined? IntentionAction
- import com.intellij.codeInsight.intention.IntentionManager unless defined? IntentionManager
- import org.jetbrains.plugins.ruby.ruby.lang.psi.RubyElementFactory unless defined? RubyElementFactory
- require File.dirname(__FILE__) + '/../util/psi_helper'
- # skip
- class RubyIntentionAction
- include IntentionAction
- def initialize(name, block)
- @name = name
- @block = block
- end
- def getText()
- @name
- end
- def getFamilyName()
- @name
- end
- def isAvailable(project, editor, file)
- context = CheckAvailableContext.new(project, editor, file)
- @block.call context
- context.available
- end
- def invoke(project, editor, file)
- @block.call ExecuteContext.new(project, editor, file)
- end
- def startInWriteAction()
- true
- end
- end
- def register_intention_action(name, options, &block)
- action = RubyIntentionAction.new name, block
- # skip
- end
Add Comment
Please, Sign In to add comment