Search in sources :

Example 1 with GroovyCodeFragment

use of org.jetbrains.plugins.groovy.debugger.fragments.GroovyCodeFragment in project intellij-community by JetBrains.

the class DynamicDialog method createDocument.

@Nullable
private Document createDocument(final String text) {
    GroovyCodeFragment fragment = new GroovyCodeFragment(myProject, text);
    fragment.setContext(myContext);
    return PsiDocumentManager.getInstance(myProject).getDocument(fragment);
}
Also used : GroovyCodeFragment(org.jetbrains.plugins.groovy.debugger.fragments.GroovyCodeFragment) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with GroovyCodeFragment

use of org.jetbrains.plugins.groovy.debugger.fragments.GroovyCodeFragment in project intellij-community by JetBrains.

the class GrParameterTableModelItem method create.

public static GrParameterTableModelItem create(@Nullable GrParameterInfo parameterInfo, @NotNull final Project project, @Nullable final PsiElement context) {
    if (parameterInfo == null) {
        parameterInfo = new GrParameterInfo("", "", "", null, -1, false);
    }
    PsiTypeCodeFragment typeCodeFragment = JavaCodeFragmentFactory.getInstance(project).createTypeCodeFragment(parameterInfo.getTypeText(), context, true, JavaCodeFragmentFactory.ALLOW_ELLIPSIS);
    String initializer = parameterInfo.getDefaultInitializer();
    GroovyCodeFragment initializerCodeFragment = new GroovyCodeFragment(project, initializer != null ? initializer : "");
    GroovyCodeFragment defaultValueCodeFragment = new GroovyCodeFragment(project, parameterInfo.getDefaultValue());
    return new GrParameterTableModelItem(parameterInfo, typeCodeFragment, initializerCodeFragment, defaultValueCodeFragment);
}
Also used : GroovyCodeFragment(org.jetbrains.plugins.groovy.debugger.fragments.GroovyCodeFragment)

Example 3 with GroovyCodeFragment

use of org.jetbrains.plugins.groovy.debugger.fragments.GroovyCodeFragment in project intellij-community by JetBrains.

the class GroovyCodeFragmentFactory method createPresentationCodeFragment.

@Override
public JavaCodeFragment createPresentationCodeFragment(TextWithImports item, PsiElement context, Project project) {
    GroovyCodeFragment result = new GroovyCodeFragment(project, item.getText());
    result.setContext(context);
    return result;
}
Also used : GroovyCodeFragment(org.jetbrains.plugins.groovy.debugger.fragments.GroovyCodeFragment)

Example 4 with GroovyCodeFragment

use of org.jetbrains.plugins.groovy.debugger.fragments.GroovyCodeFragment in project intellij-community by JetBrains.

the class GroovyStructuralSearchProfile method createCodeFragment.

@Override
public PsiCodeFragment createCodeFragment(Project project, String text, @Nullable PsiElement context) {
    GroovyCodeFragment result = new GroovyCodeFragment(project, text);
    result.setContext(context);
    return result;
}
Also used : GroovyCodeFragment(org.jetbrains.plugins.groovy.debugger.fragments.GroovyCodeFragment)

Aggregations

GroovyCodeFragment (org.jetbrains.plugins.groovy.debugger.fragments.GroovyCodeFragment)4 Nullable (org.jetbrains.annotations.Nullable)1