...
Code Block |
---|
def ctx = context(ctype: "java.lang.Integer", scope: scriptScope(name: "DayCounter.groovy")) contributor([ctx]) { property name: "daysFromNow", type: "Calendar" } |
...
Code Block |
---|
def ctx2 = context(ctype: "Position") contributor ([ctx2]) { // Add generic methods classType?.fields?.each { method name: "findAll${it.name}Positions", type: 'java.util.Collection' } } |
...
Code Block |
---|
def ctx = context(scope: closureScope()) contributor([ctx], { def call = enclosingCall("run") if (call) { def method = call.bind() def clazz = method?.containingClass if ("Runner".equals(clazz?.qualName)) { delegatesTo(call.arguments[0]) } } }) |
...
Code Block |
---|
def gdslScriptContext = context(scope: scriptScope(), filetypes: ["gdsl"]) contributor([gdslScriptContext]) { method name: "context", params: [args: [:]], type: "java.lang.Object" method name: "contributor", params: [contexts: "java.util.List", body: {}], type: void // scopes property name: "closureScope", type: {} property name: "scriptScope", type: {} } def contributorBody = context(scope: closureScope(isArg: true)) contributor([contributorBody]) { if (enclosingCall("contributor")) { method name: "method", type: "void", params: [args: [:]] method name: "property", type: "void", params: [args: [:]] method name: "add", type: "void", params: [member: "com.intellij.psi.PsiMember"] method name: "findClass", type: "com.intellij.psi.PsiClass", params: [name: "java.lang.String"] method name: "delegatesTo", type: "void", params: [clazz: "com.intellij.psi.PsiClass"] method name: "delegatesTo", type: "void", params: [expr: "org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression"] method name: "enclosingCall", type: "com.intellij.psi.PsiElement", params: [methodName: "java.lang.String"] property name: "place", type: "com.intellij.psi.PsiElement" // Reference to the place in the focus of a context property name: "classType", type: "com.intellij.psi.PsiClass" // Class type to be augmented } } def psiClassContext = context(scope: closureScope(isArg: true), ctype: "com.intellij.psi.PsiClass") contributor([psiClassContext]) { method name: "getMethods", type: "java.util.Collection" method name: "getQualName", type: "java.lang.String" method name: "hasAnnotation", type: "boolean" method name: "getAnnotation", type: "com.intellij.psi.PsiAnnotation" } def psiElementContext = context(scope: closureScope(isArg: true), ctype: "com.intellij.psi.PsiElement") contributor([psiElementContext]) { method name: "bind", type: "com.intellij.psi.PsiElement" } def expressionContext = context(scope: closureScope(isArg: true), ctype: "org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression") contributor([expressionContext]) { method name: "getArguments", type: "java.util.Collection" method name: "getClassType", type: "com.intellij.psi.PsiClass" } |