33 */
44package org .intellij .grammar .psi .impl ;
55
6+ import consulo .annotation .access .RequiredReadAction ;
7+ import consulo .annotation .access .RequiredWriteAction ;
68import consulo .content .scope .SearchScope ;
79import consulo .language .ast .ASTNode ;
810import consulo .language .psi .PsiElement ;
911import consulo .language .psi .scope .LocalSearchScope ;
1012import consulo .language .util .IncorrectOperationException ;
13+ import jakarta .annotation .Nonnull ;
1114import org .intellij .grammar .psi .BnfModifier ;
1215import org .intellij .grammar .psi .BnfNamedElement ;
1316import org .intellij .grammar .psi .BnfRule ;
14- import org .jetbrains .annotations .NonNls ;
15-
16- import jakarta .annotation .Nonnull ;
1717
1818import static org .intellij .grammar .psi .BnfTypes .BNF_ID ;
1919
2020/**
21- * Created by IntelliJ IDEA.
22- * User: gregory
23- * Date: 14.07.11
24- * Time: 20:04
21+ * @author gregory
22+ * @since 2011-07-14
2523 */
2624public abstract class BnfNamedImpl extends BnfCompositeImpl implements BnfNamedElement {
2725 private volatile String myCachedName ;
@@ -46,7 +44,8 @@ public String getName() {
4644 }
4745
4846 @ Override
49- public PsiElement setName (@ NonNls @ Nonnull String s ) throws IncorrectOperationException {
47+ @ RequiredWriteAction
48+ public PsiElement setName (@ Nonnull String s ) throws IncorrectOperationException {
5049 getId ().replace (BnfElementFactory .createLeafFromText (getProject (), s ));
5150 return this ;
5251 }
@@ -65,16 +64,16 @@ public SearchScope getUseScope() {
6564// @Override
6665// public Icon getIcon(int flags)
6766// {
68- // if(this instanceof BnfRule)
67+ // if (this instanceof BnfRule)
6968// {
70- // final Icon base = hasModifier((BnfRule) this, "external") ? BnfIcons.EXTERNAL_RULE : BnfIcons.RULE;
71- // final Icon visibility = hasModifier((BnfRule) this, "private") ? PlatformIcons.PRIVATE_ICON : PlatformIcons.PUBLIC_ICON ;
72- // final RowIcon row = new RowIcon(2);
69+ // Icon base = hasModifier((BnfRule) this, "external") ? BnfIcons.EXTERNAL_RULE : BnfIcons.RULE;
70+ // Icon visibility = hasModifier((BnfRule) this, "private") ? PlatformIconGroup.nodesC_private() : PlatformIconGroup.nodesC_public() ;
71+ // RowIcon row = new RowIcon(2);
7372// row.setIcon(base, 0);
7473// row.setIcon(visibility, 1);
7574// return row;
7675// }
77- // else if(this instanceof BnfAttr)
76+ // else if (this instanceof BnfAttr)
7877// {
7978// return BnfIcons.ATTRIBUTE;
8079// }
@@ -96,6 +95,7 @@ public static boolean hasModifier(BnfRule rule, String modifier) {
9695 }
9796
9897 @ Override
98+ @ RequiredReadAction
9999 public String toString () {
100100 // AE fix in LOG.toString in inconsistent state
101101 PsiElement nullableId = findChildByType (BNF_ID );
0 commit comments