Skip to content

Commit 6fd7e40

Browse files
committed
Update icon
1 parent b7ecd0e commit 6fd7e40

File tree

6 files changed

+26
-18
lines changed

6 files changed

+26
-18
lines changed
File renamed without changes.

res/icon/json@2x_dark.png

336 Bytes
Loading

res/icon/json_dark.png

221 Bytes
Loading

src/com/intellij/devkt/json/Json.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,21 @@
99
import org.jetbrains.kotlin.com.intellij.psi.PsiErrorElement;
1010
import org.jetbrains.kotlin.com.intellij.psi.tree.IElementType;
1111

12+
import javax.swing.*;
13+
1214
public class Json<T> extends ExtendedDevKtLanguage<T> {
1315
@NotNull
1416
@Override
1517
public String getLineCommentStart() {
1618
return "//";
1719
}
1820

21+
@Override
22+
public @NotNull
23+
Icon getIcon() {
24+
return JsonFileType.INSTANCE.getIcon();
25+
}
26+
1927
public Json() {
2028
super(JsonLanguage.INSTANCE, new JsonParserDefinition());
2129
}
@@ -30,9 +38,9 @@ public void annotate(PsiElement psiElement, AnnotationHolder<? super T> annotati
3038
if (psiElement instanceof PsiErrorElement) annotationHolder.highlight(psiElement, colorScheme.getUnknown());
3139
}
3240

33-
@Nullable
3441
@Override
35-
public T attributesOf(IElementType iElementType, ColorScheme<? extends T> colorScheme) {
42+
public @Nullable
43+
T attributesOf(IElementType iElementType, ColorScheme<? extends T> colorScheme) {
3644
if (iElementType == JsonElementTypes.LINE_COMMENT) return colorScheme.getLineComments();
3745
else if (iElementType == JsonElementTypes.BLOCK_COMMENT) return colorScheme.getBlockComments();
3846
else if (iElementType == JsonElementTypes.NUMBER) return colorScheme.getNumbers();
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package com.intellij.devkt.json;
22

3+
import org.ice1000.devkt.openapi.ui.IconLoader;
34
import org.jetbrains.annotations.NotNull;
4-
import org.jetbrains.annotations.Nullable;
5-
import org.jetbrains.kotlin.com.intellij.icons.AllIcons;
65
import org.jetbrains.kotlin.com.intellij.openapi.fileTypes.LanguageFileType;
76

87
import javax.swing.*;
@@ -11,35 +10,36 @@
1110
* @author Mikhail Golubev
1211
*/
1312
public class JsonFileType extends LanguageFileType {
14-
public static final JsonFileType INSTANCE = new JsonFileType();
13+
public static final @NotNull
14+
JsonFileType INSTANCE = new JsonFileType();
1515
public static final String DEFAULT_EXTENSION = "json";
16+
private Icon icon = IconLoader.getIcon("/icon/json_dark.png");
1617

1718
public JsonFileType() {
1819
super(JsonLanguage.INSTANCE);
1920
}
2021

21-
@NotNull
2222
@Override
23-
public String getName() {
23+
public @NotNull
24+
String getName() {
2425
return "JSON";
2526
}
2627

27-
@NotNull
2828
@Override
29-
public String getDescription() {
29+
public @NotNull
30+
String getDescription() {
3031
return "JSON files";
3132
}
3233

33-
@NotNull
3434
@Override
35-
public String getDefaultExtension() {
35+
public @NotNull
36+
String getDefaultExtension() {
3637
return DEFAULT_EXTENSION;
3738
}
3839

39-
@Nullable
4040
@Override
41-
public Icon getIcon() {
42-
// TODO: add JSON icon instead
43-
return AllIcons.FileTypes.Json;
41+
public @NotNull
42+
Icon getIcon() {
43+
return icon;
4444
}
4545
}

src/com/intellij/devkt/json/JsonLanguage.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.intellij.devkt.json;
22

3-
import org.jetbrains.annotations.Nullable;
3+
import org.jetbrains.annotations.NotNull;
44
import org.jetbrains.kotlin.com.intellij.lang.Language;
55
import org.jetbrains.kotlin.com.intellij.openapi.fileTypes.LanguageFileType;
66

@@ -11,9 +11,9 @@ private JsonLanguage() {
1111
super("JSON", "application/json", "application/vnd.api+json", "application/hal+json");
1212
}
1313

14-
@Nullable
1514
@Override
16-
public LanguageFileType getAssociatedFileType() {
15+
public @NotNull
16+
LanguageFileType getAssociatedFileType() {
1717
return JsonFileType.INSTANCE;
1818
}
1919

0 commit comments

Comments
 (0)