mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
+11
-11
@@ -19,17 +19,17 @@ import com.intellij.codeInsight.folding.CodeFoldingSettings;
|
||||
import com.intellij.codeInsight.folding.JavaCodeFoldingSettings;
|
||||
|
||||
public class JavaCodeFoldingSettingsBase extends JavaCodeFoldingSettings {
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean COLLAPSE_ACCESSORS;
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean COLLAPSE_ONE_LINE_METHODS = true;
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean COLLAPSE_INNER_CLASSES;
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean COLLAPSE_ANONYMOUS_CLASSES;
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean COLLAPSE_ANNOTATIONS;
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean COLLAPSE_CLOSURES = true;
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean COLLAPSE_CONSTRUCTOR_GENERIC_PARAMETERS = true;
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean COLLAPSE_I18N_MESSAGES = true;
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean COLLAPSE_SUPPRESS_WARNINGS = true;
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean COLLAPSE_END_OF_LINE_COMMENTS;
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean INLINE_PARAMETER_NAMES_FOR_LITERAL_CALL_ARGUMENTS;
|
||||
@SuppressWarnings("WeakerAccess") public boolean COLLAPSE_ACCESSORS;
|
||||
@SuppressWarnings("WeakerAccess") public boolean COLLAPSE_ONE_LINE_METHODS = true;
|
||||
@SuppressWarnings("WeakerAccess") public boolean COLLAPSE_INNER_CLASSES;
|
||||
@SuppressWarnings("WeakerAccess") public boolean COLLAPSE_ANONYMOUS_CLASSES;
|
||||
@SuppressWarnings("WeakerAccess") public boolean COLLAPSE_ANNOTATIONS;
|
||||
@SuppressWarnings("WeakerAccess") public boolean COLLAPSE_CLOSURES = true;
|
||||
@SuppressWarnings("WeakerAccess") public boolean COLLAPSE_CONSTRUCTOR_GENERIC_PARAMETERS = true;
|
||||
@SuppressWarnings("WeakerAccess") public boolean COLLAPSE_I18N_MESSAGES = true;
|
||||
@SuppressWarnings("WeakerAccess") public boolean COLLAPSE_SUPPRESS_WARNINGS = true;
|
||||
@SuppressWarnings("WeakerAccess") public boolean COLLAPSE_END_OF_LINE_COMMENTS;
|
||||
@SuppressWarnings("WeakerAccess") public boolean INLINE_PARAMETER_NAMES_FOR_LITERAL_CALL_ARGUMENTS;
|
||||
|
||||
@Override
|
||||
public boolean isCollapseImports() {
|
||||
|
||||
+15
-12
@@ -65,22 +65,22 @@ public abstract class JavaFoldingBuilderBase extends CustomFoldingBuilder implem
|
||||
if (element instanceof PsiImportList) {
|
||||
return "...";
|
||||
}
|
||||
else if (element instanceof PsiMethod || element instanceof PsiClassInitializer || element instanceof PsiClass) {
|
||||
if (element instanceof PsiMethod || element instanceof PsiClassInitializer || element instanceof PsiClass) {
|
||||
return "{...}";
|
||||
}
|
||||
else if (element instanceof PsiDocComment) {
|
||||
if (element instanceof PsiDocComment) {
|
||||
return "/**...*/";
|
||||
}
|
||||
else if (element instanceof PsiFile) {
|
||||
if (element instanceof PsiFile) {
|
||||
return "/.../";
|
||||
}
|
||||
else if (element instanceof PsiAnnotation) {
|
||||
if (element instanceof PsiAnnotation) {
|
||||
return "@{...}";
|
||||
}
|
||||
else if (element instanceof PsiReferenceParameterList) {
|
||||
if (element instanceof PsiReferenceParameterList) {
|
||||
return SMILEY;
|
||||
}
|
||||
else if (element instanceof PsiComment) {
|
||||
if (element instanceof PsiComment) {
|
||||
return "//...";
|
||||
}
|
||||
return "...";
|
||||
@@ -201,8 +201,9 @@ public abstract class JavaFoldingBuilderBase extends CustomFoldingBuilder implem
|
||||
}
|
||||
}
|
||||
if (element == null) return null;
|
||||
if (element.getPrevSibling() instanceof PsiWhiteSpace) element = element.getPrevSibling();
|
||||
if (element == null || element.equals(first)) return null;
|
||||
PsiElement prevSibling = element.getPrevSibling();
|
||||
if (prevSibling instanceof PsiWhiteSpace) element = prevSibling;
|
||||
if (element.equals(first)) return null;
|
||||
return new UnfairTextRange(first.getTextOffset(), element.getTextOffset());
|
||||
}
|
||||
|
||||
@@ -447,8 +448,7 @@ public abstract class JavaFoldingBuilderBase extends CustomFoldingBuilder implem
|
||||
private boolean addToFold(List<FoldingDescriptor> list, PsiElement elementToFold, Document document, boolean allowOneLiners) {
|
||||
PsiUtilCore.ensureValid(elementToFold);
|
||||
TextRange range = getRangeToFold(elementToFold);
|
||||
if (range == null) return false;
|
||||
return addFoldRegion(list, elementToFold, document, allowOneLiners, range);
|
||||
return range != null && addFoldRegion(list, elementToFold, document, allowOneLiners, range);
|
||||
}
|
||||
|
||||
private static boolean addFoldRegion(final List<FoldingDescriptor> list, final PsiElement elementToFold, final Document document,
|
||||
@@ -740,8 +740,11 @@ public abstract class JavaFoldingBuilderBase extends CustomFoldingBuilder implem
|
||||
}
|
||||
}
|
||||
|
||||
private void addCodeBlockFolds(PsiElement scope, final List<FoldingDescriptor> foldElements,
|
||||
final @NotNull Set<PsiElement> processedComments, final Document document, final boolean quick) {
|
||||
private void addCodeBlockFolds(@NotNull PsiElement scope,
|
||||
@NotNull final List<FoldingDescriptor> foldElements,
|
||||
@NotNull final Set<PsiElement> processedComments,
|
||||
@NotNull final Document document,
|
||||
final boolean quick) {
|
||||
final boolean dumb = DumbService.isDumb(scope.getProject());
|
||||
scope.accept(new JavaRecursiveElementWalkingVisitor() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user