Skip to content

Commit cc764c7

Browse files
#125: Fix icons in "Go To Symbol" dialog
1 parent b4fa0e9 commit cc764c7

File tree

6 files changed

+51
-0
lines changed

6 files changed

+51
-0
lines changed

src/main/java/io/protostuff/jetbrains/plugin/psi/EnumConstantNode.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
import com.intellij.navigation.ItemPresentationProviders;
1111
import com.intellij.psi.PsiElement;
1212
import com.intellij.psi.PsiNamedElement;
13+
import io.protostuff.jetbrains.plugin.Icons;
14+
import javax.swing.Icon;
1315
import org.antlr.jetbrains.adapter.psi.ScopeNode;
1416
import org.jetbrains.annotations.NotNull;
1517
import org.jetbrains.annotations.Nullable;
@@ -59,6 +61,12 @@ public ASTNode getConstantValueNode() {
5961
return node.findChildByType(rule(RULE_enumFieldValue));
6062
}
6163

64+
@Nullable
65+
@Override
66+
public Icon getIcon(int flags) {
67+
return Icons.CONSTANT;
68+
}
69+
6270
@Override
6371
public ItemPresentation getPresentation() {
6472
return ItemPresentationProviders.getItemPresentation(this);

src/main/java/io/protostuff/jetbrains/plugin/psi/EnumNode.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@
77
import com.intellij.psi.stubs.IStubElementType;
88
import com.intellij.psi.tree.IElementType;
99
import com.intellij.util.IncorrectOperationException;
10+
import io.protostuff.jetbrains.plugin.Icons;
1011
import io.protostuff.jetbrains.plugin.psi.stubs.EnumStub;
1112
import io.protostuff.jetbrains.plugin.psi.stubs.MessageStub;
1213
import java.util.Arrays;
1314
import java.util.List;
15+
import javax.swing.Icon;
1416
import org.jetbrains.annotations.NotNull;
17+
import org.jetbrains.annotations.Nullable;
1518

1619
/**
1720
* Enum node.
@@ -40,6 +43,12 @@ public PsiElement setName(@NotNull String name) throws IncorrectOperationExcepti
4043
return GenericNameNode.setName(this, name);
4144
}
4245

46+
@Nullable
47+
@Override
48+
public Icon getIcon(int flags) {
49+
return Icons.ENUM;
50+
}
51+
4352
@Override
4453
public ItemPresentation getPresentation() {
4554
return ItemPresentationProviders.getItemPresentation(this);

src/main/java/io/protostuff/jetbrains/plugin/psi/FieldNode.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@
1010
import com.intellij.navigation.ItemPresentationProviders;
1111
import com.intellij.openapi.diagnostic.Logger;
1212
import com.intellij.psi.PsiElement;
13+
import io.protostuff.jetbrains.plugin.Icons;
1314
import java.util.Collection;
1415
import java.util.Collections;
1516
import java.util.Optional;
17+
import javax.swing.Icon;
1618
import org.jetbrains.annotations.NotNull;
19+
import org.jetbrains.annotations.Nullable;
1720

1821
/**
1922
* Field node.
@@ -85,6 +88,12 @@ public ASTNode getFieldLabelNode() {
8588
return node.findChildByType(R_FIELD_MODIFIER);
8689
}
8790

91+
@Nullable
92+
@Override
93+
public Icon getIcon(int flags) {
94+
return Icons.FIELD;
95+
}
96+
8897
@Override
8998
public ItemPresentation getPresentation() {
9099
return ItemPresentationProviders.getItemPresentation(this);

src/main/java/io/protostuff/jetbrains/plugin/psi/MessageNode.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
import com.intellij.psi.stubs.IStubElementType;
88
import com.intellij.psi.tree.IElementType;
99
import com.intellij.util.IncorrectOperationException;
10+
import io.protostuff.jetbrains.plugin.Icons;
1011
import io.protostuff.jetbrains.plugin.psi.stubs.DataTypeStub;
1112
import java.util.ArrayList;
1213
import java.util.Arrays;
1314
import java.util.Collection;
1415
import java.util.Collections;
1516
import java.util.List;
17+
import javax.swing.Icon;
1618
import org.jetbrains.annotations.NotNull;
1719
import org.jetbrains.annotations.Nullable;
1820

@@ -89,6 +91,12 @@ public Collection<MessageField> getFields() {
8991
return result;
9092
}
9193

94+
@Nullable
95+
@Override
96+
public Icon getIcon(int flags) {
97+
return Icons.MESSAGE;
98+
}
99+
92100
@Override
93101
public ItemPresentation getPresentation() {
94102
return ItemPresentationProviders.getItemPresentation(this);

src/main/java/io/protostuff/jetbrains/plugin/psi/RpcMethodNode.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import static io.protostuff.jetbrains.plugin.ProtoParserDefinition.rule;
55

66
import com.intellij.lang.ASTNode;
7+
import io.protostuff.jetbrains.plugin.Icons;
8+
import javax.swing.Icon;
79
import org.jetbrains.annotations.NotNull;
810
import org.jetbrains.annotations.Nullable;
911

@@ -35,4 +37,11 @@ public ASTNode getMethodNameNode() {
3537
ASTNode node = getNode();
3638
return node.findChildByType(rule(RULE_rpcName));
3739
}
40+
41+
@Nullable
42+
@Override
43+
public Icon getIcon(int flags) {
44+
return Icons.ENUM;
45+
}
46+
3847
}

src/main/java/io/protostuff/jetbrains/plugin/psi/ServiceNode.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
import com.intellij.navigation.ItemPresentationProviders;
77
import com.intellij.psi.PsiElement;
88
import com.intellij.psi.PsiNamedElement;
9+
import io.protostuff.jetbrains.plugin.Icons;
910
import java.util.Arrays;
1011
import java.util.List;
12+
import javax.swing.Icon;
1113
import org.antlr.jetbrains.adapter.psi.ScopeNode;
1214
import org.jetbrains.annotations.NotNull;
1315
import org.jetbrains.annotations.Nullable;
@@ -36,6 +38,12 @@ public List<RpcMethodNode> getRpcMethods() {
3638
return Arrays.asList(nodes);
3739
}
3840

41+
@Nullable
42+
@Override
43+
public Icon getIcon(int flags) {
44+
return Icons.SERVICE;
45+
}
46+
3947
@Override
4048
public ItemPresentation getPresentation() {
4149
return ItemPresentationProviders.getItemPresentation(this);

0 commit comments

Comments
 (0)