use of org.jetbrains.plugins.groovy.lang.psi.impl.GroovyCodeStyleSettingsFacade in project intellij-community by JetBrains.
the class GrReferenceAdjuster method shortenReference.
public static <T extends PsiElement> boolean shortenReference(@NotNull GrQualifiedReference<T> ref) {
GroovyCodeStyleSettingsFacade facade = GroovyCodeStyleSettingsFacade.getInstance(ref.getProject());
boolean result = shortenReferenceInner(ref, true, false, facade.useFqClassNamesInJavadoc(), facade.useFqClassNames());
final TextRange range = ref.getTextRange();
result |= process(ref, range.getStartOffset(), range.getEndOffset(), true, false, facade.useFqClassNamesInJavadoc(), facade.useFqClassNames());
return result;
}
use of org.jetbrains.plugins.groovy.lang.psi.impl.GroovyCodeStyleSettingsFacade in project intellij-community by JetBrains.
the class GrTypeDefinitionImpl method getDefaultAnchor.
@Nullable
private PsiElement getDefaultAnchor(GrTypeDefinitionBody body, PsiMember member) {
GroovyCodeStyleSettingsFacade settings = GroovyCodeStyleSettingsFacade.getInstance(getProject());
int order = getMemberOrderWeight(member, settings);
if (order < 0)
return null;
PsiElement lastMember = null;
for (PsiElement child = body.getFirstChild(); child != null; child = child.getNextSibling()) {
int order1 = getMemberOrderWeight(getAnyMember(child), settings);
if (order1 < 0)
continue;
if (order1 > order) {
final PsiElement lBrace = body.getLBrace();
if (lastMember != null) {
PsiElement nextSibling = lastMember.getNextSibling();
while (nextSibling instanceof LeafPsiElement && (nextSibling.getText().equals(",") || nextSibling.getText().equals(";"))) {
nextSibling = nextSibling.getNextSibling();
}
return nextSibling == null && lBrace != null ? PsiUtil.skipWhitespacesAndComments(lBrace.getNextSibling(), true) : nextSibling;
} else if (lBrace != null) {
return PsiUtil.skipWhitespacesAndComments(lBrace.getNextSibling(), true);
}
}
lastMember = child;
}
return body.getRBrace();
}
use of org.jetbrains.plugins.groovy.lang.psi.impl.GroovyCodeStyleSettingsFacade in project intellij-community by JetBrains.
the class GrReferenceAdjuster method processRange.
@Override
public void processRange(@NotNull ASTNode element, int startOffset, int endOffset, Project project) {
GroovyCodeStyleSettingsFacade facade = GroovyCodeStyleSettingsFacade.getInstance(project);
processRange(element, startOffset, endOffset, facade.useFqClassNamesInJavadoc(), facade.useFqClassNames());
}
Aggregations