mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Revert "More consistent API"
Prevent language API changes
This reverts commit a26fab124c.
This commit is contained in:
+1
-2
@@ -26,7 +26,6 @@ import com.intellij.lang.folding.FoldingBuilderEx;
|
||||
import com.intellij.lang.folding.FoldingDescriptor;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
@@ -60,7 +59,7 @@ public class SuppressWarningsFoldingBuilder extends FoldingBuilderEx {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlaceholderText(@NotNull ASTNode node, TextRange range) {
|
||||
public String getPlaceholderText(@NotNull ASTNode node) {
|
||||
final PsiElement element = node.getPsi();
|
||||
if (element instanceof PsiAnnotation) {
|
||||
return "/" + StringUtil.join(((PsiAnnotation)element).getParameterList().getAttributes(), new Function<PsiNameValuePair, String>() {
|
||||
|
||||
@@ -166,7 +166,7 @@ public class JavaFoldingBuilder extends FoldingBuilderEx implements DumbAware {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getPlaceholderText(@NotNull final ASTNode node, TextRange range) {
|
||||
public String getPlaceholderText(@NotNull final ASTNode node) {
|
||||
return getPlaceholderText(SourceTreeToPsiMap.treeElementToPsi(node));
|
||||
}
|
||||
|
||||
|
||||
@@ -18,9 +18,8 @@ package com.intellij.lang.folding;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -57,9 +56,9 @@ public class CompositeFoldingBuilder extends FoldingBuilderEx implements DumbAwa
|
||||
return descriptors.toArray(new FoldingDescriptor[descriptors.size()]);
|
||||
}
|
||||
|
||||
public String getPlaceholderText(@NotNull ASTNode node, TextRange range) {
|
||||
public String getPlaceholderText(@NotNull ASTNode node) {
|
||||
final FoldingBuilder builder = node.getUserData(FOLDING_BUILDER);
|
||||
return builder == null ? node.getText() : builder.getPlaceholderText(node, range);
|
||||
return builder == null ? node.getText() : builder.getPlaceholderText(node);
|
||||
}
|
||||
|
||||
public boolean isCollapsedByDefault(@NotNull ASTNode node) {
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.intellij.lang.folding;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -46,13 +45,11 @@ public interface FoldingBuilder {
|
||||
* Returns the text which is displayed in the editor for the folding region related to the
|
||||
* specified node when the folding region is collapsed.
|
||||
*
|
||||
*
|
||||
* @param node the node for which the placeholder text is requested.
|
||||
* @param range folded range
|
||||
* @return the placeholder text.
|
||||
*/
|
||||
@Nullable
|
||||
String getPlaceholderText(@NotNull ASTNode node, TextRange range);
|
||||
String getPlaceholderText(@NotNull ASTNode node);
|
||||
|
||||
/**
|
||||
* Returns the default collapsed state for the folding region related to the specified node.
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.intellij.lang.folding;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -55,13 +54,11 @@ public abstract class FoldingBuilderEx implements FoldingBuilder {
|
||||
* Returns the text which is displayed in the editor for the folding region related to the
|
||||
* specified node when the folding region is collapsed.
|
||||
*
|
||||
*
|
||||
* @param node the node for which the placeholder text is requested.
|
||||
* @param range
|
||||
* @return the placeholder text.
|
||||
*/
|
||||
@Nullable
|
||||
public abstract String getPlaceholderText(@NotNull ASTNode node, TextRange range);
|
||||
public abstract String getPlaceholderText(@NotNull ASTNode node);
|
||||
|
||||
/**
|
||||
* Returns the default collapsed state for the folding region related to the specified node.
|
||||
|
||||
@@ -47,7 +47,7 @@ public class FoldingDescriptor {
|
||||
* Creates a folding region related to the specified AST node and covering the specified
|
||||
* text range.
|
||||
* @param node The node to which the folding region is related. The node is then passed to
|
||||
* {@link FoldingBuilder#getPlaceholderText(com.intellij.lang.ASTNode, com.intellij.openapi.util.TextRange)} and
|
||||
* {@link FoldingBuilder#getPlaceholderText(com.intellij.lang.ASTNode)} and
|
||||
* {@link FoldingBuilder#isCollapsedByDefault(com.intellij.lang.ASTNode)}.
|
||||
* @param range The folded text range.
|
||||
*/
|
||||
@@ -67,7 +67,7 @@ public class FoldingDescriptor {
|
||||
* Creates a folding region related to the specified AST node and covering the specified
|
||||
* text range.
|
||||
* @param node The node to which the folding region is related. The node is then passed to
|
||||
* {@link FoldingBuilder#getPlaceholderText(com.intellij.lang.ASTNode, com.intellij.openapi.util.TextRange)} and
|
||||
* {@link com.intellij.lang.folding.FoldingBuilder#getPlaceholderText(com.intellij.lang.ASTNode)} and
|
||||
* {@link com.intellij.lang.folding.FoldingBuilder#isCollapsedByDefault(com.intellij.lang.ASTNode)}.
|
||||
* @param range The folded text range.
|
||||
* @param group Regions with the same group instance expand and collapse together.
|
||||
@@ -82,7 +82,7 @@ public class FoldingDescriptor {
|
||||
* Creates a folding region related to the specified AST node and covering the specified
|
||||
* text range.
|
||||
* @param node The node to which the folding region is related. The node is then passed to
|
||||
* {@link FoldingBuilder#getPlaceholderText(com.intellij.lang.ASTNode, com.intellij.openapi.util.TextRange)} and
|
||||
* {@link com.intellij.lang.folding.FoldingBuilder#getPlaceholderText(com.intellij.lang.ASTNode)} and
|
||||
* {@link com.intellij.lang.folding.FoldingBuilder#isCollapsedByDefault(com.intellij.lang.ASTNode)}.
|
||||
* @param range The folded text range.
|
||||
* @param group Regions with the same group instance expand and collapse together.
|
||||
@@ -134,7 +134,7 @@ public class FoldingDescriptor {
|
||||
final Language lang = psiElement.getLanguage();
|
||||
final FoldingBuilder foldingBuilder = LanguageFolding.INSTANCE.forLanguage(lang);
|
||||
if (foldingBuilder != null) {
|
||||
return foldingBuilder.getPlaceholderText(myElement, myRange);
|
||||
return foldingBuilder.getPlaceholderText(myElement);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import com.intellij.lang.folding.FoldingBuilder;
|
||||
import com.intellij.lang.folding.FoldingDescriptor;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -43,7 +42,7 @@ public abstract class IndentationFoldingBuilder implements FoldingBuilder, DumbA
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getPlaceholderText(@NotNull final ASTNode node, TextRange range) {
|
||||
public String getPlaceholderText(@NotNull final ASTNode node) {
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
ASTNode child = node.getFirstChildNode();
|
||||
String text;
|
||||
|
||||
+1
-1
@@ -223,7 +223,7 @@ public class GroovyFoldingBuilder implements FoldingBuilder, GroovyElementTypes,
|
||||
return text.contains("\n") || text.contains("\r") || text.contains("\r\n");
|
||||
}
|
||||
|
||||
public String getPlaceholderText(@NotNull ASTNode node, TextRange range) {
|
||||
public String getPlaceholderText(@NotNull ASTNode node) {
|
||||
final IElementType elemType = node.getElementType();
|
||||
if (BLOCK_SET.contains(elemType) || elemType == CLOSABLE_BLOCK) {
|
||||
return "{...}";
|
||||
|
||||
+1
-2
@@ -28,7 +28,6 @@ import com.intellij.lang.properties.psi.impl.PropertyImpl;
|
||||
import com.intellij.lang.properties.psi.impl.PropertyStubImpl;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.JavaConstantExpressionEvaluator;
|
||||
@@ -113,7 +112,7 @@ public class PropertyFoldingBuilder extends FoldingBuilderEx {
|
||||
}
|
||||
|
||||
|
||||
public String getPlaceholderText(@NotNull ASTNode node, TextRange range) {
|
||||
public String getPlaceholderText(@NotNull ASTNode node) {
|
||||
final PsiElement element = SourceTreeToPsiMap.treeElementToPsi(node);
|
||||
if (element instanceof PsiLiteralExpression) {
|
||||
return getI18nMessage((PsiLiteralExpression)element);
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ public class RncFoldingBuilder implements FoldingBuilder {
|
||||
: FoldingDescriptor.EMPTY;
|
||||
}
|
||||
|
||||
public String getPlaceholderText(@NotNull ASTNode node, TextRange range) {
|
||||
public String getPlaceholderText(@NotNull ASTNode node) {
|
||||
final IElementType type = node.getElementType();
|
||||
if (type == RncTokenTypes.LBRACE) {
|
||||
return "{ ... }";
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ public class GeneratedCodeFoldingBuilder extends FoldingBuilderEx {
|
||||
return visitor.myFoldingData.toArray(new FoldingDescriptor[visitor.myFoldingData.size()]);
|
||||
}
|
||||
|
||||
public String getPlaceholderText(@NotNull ASTNode node, TextRange range) {
|
||||
public String getPlaceholderText(@NotNull ASTNode node) {
|
||||
return UIDesignerBundle.message("uidesigner.generated.code.folding.placeholder.text");
|
||||
}
|
||||
|
||||
|
||||
@@ -206,7 +206,7 @@ public class XmlFoldingBuilder implements FoldingBuilder, DumbAware {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getPlaceholderText(@NotNull ASTNode node, TextRange range) {
|
||||
public String getPlaceholderText(@NotNull ASTNode node) {
|
||||
final PsiElement psi = node.getPsi();
|
||||
if (psi instanceof XmlTag ||
|
||||
psi instanceof XmlComment ||
|
||||
|
||||
Reference in New Issue
Block a user