Skip to content

Commit

Permalink
Merge pull request #24 from unv-unv/unv/code-reformat-1
Browse files Browse the repository at this point in the history
Code reformat using IJ4 code style (part 1).
  • Loading branch information
VISTALL authored Jul 24, 2024
2 parents ec6dc4a + 82e929b commit 1011acc
Show file tree
Hide file tree
Showing 25 changed files with 1,705 additions and 1,596 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,30 @@
*/
@ExtensionImpl
public class BnfIconDescriptorUpdater implements IconDescriptorUpdater {
@RequiredReadAction
@Override
public void updateIcon(@Nonnull IconDescriptor iconDescriptor, @Nonnull PsiElement element, int flags) {
if (element instanceof BnfRule rule) {
final Image base = hasModifier(rule, "external") ? BnfIcons.EXTERNAL_RULE : BnfIcons.RULE;
final Image visibility = hasModifier(rule, "private") ? AllIcons.Nodes.C_private : AllIcons.Nodes.C_public;
@RequiredReadAction
@Override
public void updateIcon(@Nonnull IconDescriptor iconDescriptor, @Nonnull PsiElement element, int flags) {
if (element instanceof BnfRule rule) {
final Image base = hasModifier(rule, "external") ? BnfIcons.EXTERNAL_RULE : BnfIcons.RULE;
final Image visibility = hasModifier(rule, "private") ? AllIcons.Nodes.C_private : AllIcons.Nodes.C_public;

iconDescriptor.setMainIcon(base);
iconDescriptor.setRightIcon(visibility);
iconDescriptor.setMainIcon(base);
iconDescriptor.setRightIcon(visibility);
}
else if (element instanceof BnfAttr) {
iconDescriptor.setMainIcon(BnfIcons.ATTRIBUTE);
}
else if (element instanceof BnfAttrs) {
iconDescriptor.setMainIcon(AllIcons.Nodes.Package);
}
}
else if (element instanceof BnfAttr) {
iconDescriptor.setMainIcon(BnfIcons.ATTRIBUTE);
}
else if (element instanceof BnfAttrs) {
iconDescriptor.setMainIcon(AllIcons.Nodes.Package);
}
}

private static boolean hasModifier(BnfRule bnfRule, String modifier) {
for (BnfModifier bnfModifier : bnfRule.getModifierList()) {
if (Comparing.equal(bnfModifier.getText(), modifier)) {
return true;
}
private static boolean hasModifier(BnfRule bnfRule, String modifier) {
for (BnfModifier bnfModifier : bnfRule.getModifierList()) {
if (Comparing.equal(bnfModifier.getText(), modifier)) {
return true;
}
}
return false;
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
*/
@ExtensionImpl
public class BnfNotificationGroup implements NotificationGroupContributor {
public static final NotificationGroup GRAMMAR_KIT =
NotificationGroup.balloonGroup("BnfGrammarKit", LocalizeValue.localizeTODO("Grammar Kit"));
public static final NotificationGroup GRAMMAR_KIT =
NotificationGroup.balloonGroup("BnfGrammarKit", LocalizeValue.localizeTODO("Grammar Kit"));

@Override
public void contribute(@Nonnull Consumer<NotificationGroup> consumer) {
consumer.accept(GRAMMAR_KIT);
consumer.accept(GenerateAction.LOG_GROUP);
}
@Override
public void contribute(@Nonnull Consumer<NotificationGroup> consumer) {
consumer.accept(GRAMMAR_KIT);
consumer.accept(GenerateAction.LOG_GROUP);
}
}
Loading

0 comments on commit 1011acc

Please sign in to comment.