pathList = Arrays.asList(path.split("\\."));
38 |
39 | StringBuilder node = new StringBuilder();
40 |
41 | for (String pat : pathList) {
42 | if (res == null) {
43 | return null;
44 | }
45 | if (res instanceof Map) {
46 | res = ((Map) res).get(pat);
47 | }
48 | else if (res instanceof List) {
49 | int ix = Integer.parseInt(pat);
50 | res = ((List) res).get(ix);
51 | }
52 | else {
53 | throw new RuntimeException("Incorrect path: node=" + node.toString() + " is not a Map or List.");
54 | }
55 | node.append(".").append(pat);
56 | }
57 |
58 | return res;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/main/java/thirdparty/a2u/tn/utils/json/ParseException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Original code modified from tnjson (Unlicense License).
3 | * Source: https://github.com/anymaker/tnjson
4 | * Original package: a2u.tn.utils.json
5 | */
6 | package thirdparty.a2u.tn.utils.json;
7 |
8 | /**
9 | * Exception on parse error
10 | */
11 | public class ParseException extends RuntimeException {
12 |
13 | private int position;
14 | private String path;
15 |
16 | public ParseException(String s, int position, String path) {
17 | super(s);
18 | this.position = position;
19 | this.path = path;
20 | }
21 |
22 | /**
23 | * Position in json where occur error.
24 | * @return position of invalid symbol
25 | */
26 | public int getPosition() {
27 | return position;
28 | }
29 | /**
30 | * Path in json where occur error.
31 | * @return path where occur error
32 | */
33 | public String getPath() {
34 | return path;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/thirdparty/a2u/tn/utils/json/SerializeException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Original code modified from tnjson (Unlicense License).
3 | * Source: https://github.com/anymaker/tnjson
4 | * Original package: a2u.tn.utils.json
5 | */
6 | package thirdparty.a2u.tn.utils.json;
7 |
8 | /**
9 | * Exception on serialization error
10 | */
11 | public class SerializeException extends RuntimeException {
12 |
13 | public SerializeException(String s) {
14 | super(s);
15 | }
16 |
17 | public SerializeException(String s, Throwable cause) {
18 | super(s, cause);
19 | }
20 |
21 | }
--------------------------------------------------------------------------------
/src/main/resources/JsonAssistantIconMappings.json:
--------------------------------------------------------------------------------
1 | {
2 | "icons": {
3 | "expui": {
4 | "groupByClass.svg": "icons/groupByClass.svg",
5 | "json.svg": "icons/json.svg",
6 | "extract.svg": "icons/extract.svg",
7 | "donate.svg": "icons/donate.svg",
8 | "esc.svg": "icons/esc.svg",
9 | "book_page.svg": "icons/book_page.svg",
10 | "book_reader.svg": "icons/book_reader.svg",
11 | "group.svg": "icons/group.svg",
12 | "fileTypes": {
13 | "toml.svg": "icons/fileTypes/toml-file.svg",
14 | "url.svg": "icons/fileTypes/url.svg",
15 | "kv.svg": "icons/fileTypes/kv.svg"
16 | },
17 | "toolwindow": {
18 | "logo.svg": "icons/toolwindow/logo.svg",
19 | "structure_logo.svg": "icons/toolwindow/structure_logo.svg",
20 | "minify.svg": "icons/toolwindow/minify.svg",
21 | "save.svg": "icons/toolwindow/save.svg",
22 | "search.svg": "icons/toolwindow/search.svg",
23 | "structure.svg": "icons/toolwindow/structure.svg",
24 | "delete.svg": "icons/toolwindow/delete.svg",
25 | "magic.svg": "icons/toolwindow/magic.svg",
26 | "scrollDown.svg": "icons/toolwindow/scrollDown.svg",
27 | "softWrap.svg": "icons/toolwindow/softWrap.svg",
28 | "switch.svg": "icons/toolwindow/switch.svg",
29 | "text.svg": "icons/toolwindow/text.svg"
30 | },
31 | "structure": {
32 | "compare_structure.svg": "icons/structure/compare_structure.svg"
33 | }
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/src/main/resources/META-INF/optional/plugin-java.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/optional/plugin-json.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/optional/plugin-kotlin.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/optional/plugin-properties.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/optional/plugin-toml.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/optional/plugin-xdebugger.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/optional/plugin-xml.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/optional/plugin-yaml.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/pluginIcon.svg:
--------------------------------------------------------------------------------
1 |
19 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/pluginIcon_dark.svg:
--------------------------------------------------------------------------------
1 |
19 |
--------------------------------------------------------------------------------
/src/main/resources/fileTemplates/j2ee/New Class.java.ft:
--------------------------------------------------------------------------------
1 | #if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
2 |
3 | #foreach($IMPORT in $IMPORTS)
4 | import ${IMPORT};
5 | #end
6 | #if(${IS_STATIC} == false)
7 | #parse("File Header.java")
8 | #end
9 | #foreach($ANNO in $CLASS_ANNOTATIONS)
10 | ${ANNO.ANNOTATION_STRING}
11 | #end
12 | public ${CLASS_MODIFIER}class ${NAME} {
13 |
14 | #foreach($FIELD in $FIELDS)
15 | #if($!{FIELD.COMMENT} && "$!FIELD.COMMENT" != "")
16 | /**
17 | * ${FIELD.COMMENT}
18 | */
19 | #end
20 | #foreach($ANNO in ${FIELD.ANNOTATIONS})
21 | ${ANNO.ANNOTATION_STRING}
22 | #end
23 | private ${FIELD.TYPE} ${FIELD.NAME};
24 |
25 | #end
26 | #foreach($snippet in $INNER_SNIPPETS)
27 | $snippet
28 | #end
29 | }
--------------------------------------------------------------------------------
/src/main/resources/fileTemplates/j2ee/New Class.java.html:
--------------------------------------------------------------------------------
1 | This is a built-in file template for creating Java files with annotations and comments.
2 |
3 | 这是一个内置的文件模板,用于创建带有注解及注释的 Java 文件。
--------------------------------------------------------------------------------
/src/main/resources/fileTemplates/j2ee/New Kotlin Class.kt.ft:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MemoryZy/Json-Assistant/fa572bd5748c9d91f426af7924ffac32dee47210/src/main/resources/fileTemplates/j2ee/New Kotlin Class.kt.ft
--------------------------------------------------------------------------------
/src/main/resources/fileTemplates/j2ee/New Kotlin Class.kt.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MemoryZy/Json-Assistant/fa572bd5748c9d91f426af7924ffac32dee47210/src/main/resources/fileTemplates/j2ee/New Kotlin Class.kt.html
--------------------------------------------------------------------------------
/src/main/resources/icons/book_reader.svg:
--------------------------------------------------------------------------------
1 |
15 |
--------------------------------------------------------------------------------
/src/main/resources/icons/book_reader_dark.svg:
--------------------------------------------------------------------------------
1 |
15 |
--------------------------------------------------------------------------------
/src/main/resources/icons/box.svg:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/src/main/resources/icons/checkmark.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/src/main/resources/icons/checkmark_dark.svg:
--------------------------------------------------------------------------------
1 |
2 |
5 |
--------------------------------------------------------------------------------
/src/main/resources/icons/conversion.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/main/resources/icons/diff.svg:
--------------------------------------------------------------------------------
1 |
2 |
8 |
--------------------------------------------------------------------------------
/src/main/resources/icons/dizzy_star.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/main/resources/icons/donate.svg:
--------------------------------------------------------------------------------
1 |
15 |
--------------------------------------------------------------------------------
/src/main/resources/icons/escape.svg:
--------------------------------------------------------------------------------
1 |
14 |
--------------------------------------------------------------------------------
/src/main/resources/icons/expui/book_reader.svg:
--------------------------------------------------------------------------------
1 |
15 |
--------------------------------------------------------------------------------
/src/main/resources/icons/expui/book_reader_dark.svg:
--------------------------------------------------------------------------------
1 |
15 |
--------------------------------------------------------------------------------
/src/main/resources/icons/expui/fileTypes/toml.svg:
--------------------------------------------------------------------------------
1 |
2 |
6 |
--------------------------------------------------------------------------------
/src/main/resources/icons/expui/fileTypes/toml_dark.svg:
--------------------------------------------------------------------------------
1 |
2 |
6 |
--------------------------------------------------------------------------------
/src/main/resources/icons/expui/fileTypes/url.svg:
--------------------------------------------------------------------------------
1 |
15 |
--------------------------------------------------------------------------------
/src/main/resources/icons/expui/fileTypes/url_dark.svg:
--------------------------------------------------------------------------------
1 |
15 |
--------------------------------------------------------------------------------
/src/main/resources/icons/expui/toolwindow/minify.svg:
--------------------------------------------------------------------------------
1 |
14 |
--------------------------------------------------------------------------------
/src/main/resources/icons/expui/toolwindow/minify_dark.svg:
--------------------------------------------------------------------------------
1 |
14 |
--------------------------------------------------------------------------------
/src/main/resources/icons/expui/toolwindow/save.svg:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/src/main/resources/icons/expui/toolwindow/save_dark.svg:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/src/main/resources/icons/expui/toolwindow/text.svg:
--------------------------------------------------------------------------------
1 |
15 |
--------------------------------------------------------------------------------
/src/main/resources/icons/expui/toolwindow/text_dark.svg:
--------------------------------------------------------------------------------
1 |
15 |
--------------------------------------------------------------------------------
/src/main/resources/icons/fileTypes/toml-file.svg:
--------------------------------------------------------------------------------
1 |
12 |
--------------------------------------------------------------------------------
/src/main/resources/icons/fileTypes/toml-file_dark.svg:
--------------------------------------------------------------------------------
1 |
12 |
--------------------------------------------------------------------------------
/src/main/resources/icons/function.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/main/resources/icons/groupByClass.svg:
--------------------------------------------------------------------------------
1 |
2 |
16 |
--------------------------------------------------------------------------------
/src/main/resources/icons/groupByClass_dark.svg:
--------------------------------------------------------------------------------
1 |
2 |
14 |
--------------------------------------------------------------------------------
/src/main/resources/icons/heart.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/main/resources/icons/shortcuts.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/main/resources/icons/star_fall_mini.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/main/resources/icons/star_fall_mini_dark.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/main/resources/icons/structure/intellij_collapseAll.svg:
--------------------------------------------------------------------------------
1 |
2 |
6 |
--------------------------------------------------------------------------------
/src/main/resources/icons/structure/intellij_collapseAll_dark.svg:
--------------------------------------------------------------------------------
1 |
2 |
6 |
--------------------------------------------------------------------------------
/src/main/resources/icons/structure/intellij_expandAll.svg:
--------------------------------------------------------------------------------
1 |
2 |
6 |
--------------------------------------------------------------------------------
/src/main/resources/icons/structure/intellij_expandAll_dark.svg:
--------------------------------------------------------------------------------
1 |
2 |
6 |
--------------------------------------------------------------------------------
/src/main/resources/icons/structure/json_item.svg:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/src/main/resources/icons/structure/json_item_dark.svg:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/src/main/resources/icons/structure/json_key.svg:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/src/main/resources/icons/structure/json_key_dark.svg:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/src/main/resources/icons/structure/json_object.svg:
--------------------------------------------------------------------------------
1 |
17 |
--------------------------------------------------------------------------------
/src/main/resources/icons/structure/json_object_dark.svg:
--------------------------------------------------------------------------------
1 |
17 |
--------------------------------------------------------------------------------
/src/main/resources/icons/structure/json_object_item.svg:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/src/main/resources/icons/structure/json_object_item_dark.svg:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/src/main/resources/icons/sun.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/main/resources/icons/toolwindow/eye_off.svg:
--------------------------------------------------------------------------------
1 |
14 |
--------------------------------------------------------------------------------
/src/main/resources/icons/toolwindow/eye_off_dark.svg:
--------------------------------------------------------------------------------
1 |
14 |
--------------------------------------------------------------------------------
/src/main/resources/icons/toolwindow/history.svg:
--------------------------------------------------------------------------------
1 |
17 |
--------------------------------------------------------------------------------
/src/main/resources/icons/toolwindow/history_dark.svg:
--------------------------------------------------------------------------------
1 |
17 |
--------------------------------------------------------------------------------
/src/main/resources/icons/toolwindow/minify.svg:
--------------------------------------------------------------------------------
1 |
14 |
--------------------------------------------------------------------------------
/src/main/resources/icons/toolwindow/minify_dark.svg:
--------------------------------------------------------------------------------
1 |
14 |
--------------------------------------------------------------------------------
/src/main/resources/icons/toolwindow/pencil.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/main/resources/icons/toolwindow/pencil_dark.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/main/resources/icons/toolwindow/save.svg:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/src/main/resources/icons/toolwindow/save_dark.svg:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/src/main/resources/icons/toolwindow/text.svg:
--------------------------------------------------------------------------------
1 |
15 |
--------------------------------------------------------------------------------
/src/main/resources/icons/toolwindow/text_dark.svg:
--------------------------------------------------------------------------------
1 |
15 |
--------------------------------------------------------------------------------
/src/main/resources/images/alipay.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MemoryZy/Json-Assistant/fa572bd5748c9d91f426af7924ffac32dee47210/src/main/resources/images/alipay.png
--------------------------------------------------------------------------------
/src/main/resources/images/wechat_pay.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MemoryZy/Json-Assistant/fa572bd5748c9d91f426af7924ffac32dee47210/src/main/resources/images/wechat_pay.png
--------------------------------------------------------------------------------
/src/main/resources/inspectionDescriptions/ConvertTimestamp.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | This operation checks if the current value itself is a valid timestamp, and if so, converts the timestamp into a time format.
此操作会检测到当前值本身是有效时间戳的情况,并将该时间戳转换为时间格式。
4 |
5 | Example:
6 |
7 | {
8 | "confirmTime": 1739842291000
9 | }
10 |
11 | After the quick-fix is applied:
12 |
13 |
14 | {
15 | "confirmTime": "2025-02-18 09:31:31"
16 | }
17 |
18 |
19 |
20 | Powered by: Json Assistant plugin
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/main/resources/inspectionDescriptions/ExpandNestedJson.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | This operation detects that the string values themselves are valid JSON and expands those string values into JSON objects/arrays.
此操作会检测到字符串值本身是有效 JSON 的情况,并将这些字符串值展开为 JSON 对象/数组。
4 |
5 | Example:
6 |
7 | {
8 | "content": "{\"hobbies\":[\"reading\"]}"
9 | }
10 |
11 | After the quick-fix is applied:
12 |
13 |
14 | {
15 | "content": {
16 | "hobbies": [
17 | "reading"
18 | ]
19 | }
20 | }
21 |
22 |
23 |
24 | Powered by: Json Assistant plugin
25 |
26 |
27 |
--------------------------------------------------------------------------------
/src/main/resources/intentionDescriptions/ConvertReadableTimeIntention/after.json.template:
--------------------------------------------------------------------------------
1 | {
2 | "confirmTime": 1743393600000
3 | }
--------------------------------------------------------------------------------
/src/main/resources/intentionDescriptions/ConvertReadableTimeIntention/before.json.template:
--------------------------------------------------------------------------------
1 | {
2 | "confirmTime": "2025-03-31 12:00:00"
3 | }
--------------------------------------------------------------------------------
/src/main/resources/intentionDescriptions/ConvertReadableTimeIntention/description.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | This action detects that the current value is itself in a valid time format and converts that time to a timestamp.
此操作会检测到当前值本身是有效时间格式的情况,并将该时间转换为时间戳。
4 |
5 | Powered by: Json Assistant plugin
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/test/kotlin/org/jetbrains/plugins/template/MyPluginTest.kt:
--------------------------------------------------------------------------------
1 | //package org.jetbrains.plugins.template
2 | //
3 | //import com.intellij.ide.highlighter.XmlFileType
4 | //import com.intellij.openapi.components.service
5 | //import com.intellij.psi.xml.XmlFile
6 | //import com.intellij.testFramework.TestDataPath
7 | //import com.intellij.testFramework.fixtures.BasePlatformTestCase
8 | //import com.intellij.util.PsiErrorElementUtil
9 | //import org.jetbrains.plugins.template.services.MyProjectService
10 | //
11 | //@TestDataPath("\$CONTENT_ROOT/src/test/testData")
12 | //class MyPluginTest : BasePlatformTestCase() {
13 | //
14 | // fun testXMLFile() {
15 | // val psiFile = myFixture.configureByText(XmlFileType.INSTANCE, "bar")
16 | // val xmlFile = assertInstanceOf(psiFile, XmlFile::class.java)
17 | //
18 | // assertFalse(PsiErrorElementUtil.hasErrors(project, xmlFile.virtualFile))
19 | //
20 | // assertNotNull(xmlFile.rootTag)
21 | //
22 | // xmlFile.rootTag?.let {
23 | // assertEquals("foo", it.name)
24 | // assertEquals("bar", it.value.text)
25 | // }
26 | // }
27 | //
28 | // fun testRename() {
29 | // myFixture.testRename("foo.xml", "foo_after.xml", "a2")
30 | // }
31 | //
32 | // fun testProjectService() {
33 | // val projectService = project.service()
34 | //
35 | // assertNotSame(projectService.getRandomNumber(), projectService.getRandomNumber())
36 | // }
37 | //
38 | // override fun getTestDataPath() = "src/test/testData/rename"
39 | //}
40 |
--------------------------------------------------------------------------------
/src/test/testData/rename/foo.xml:
--------------------------------------------------------------------------------
1 |
2 | 1>Foo
3 |
4 |
--------------------------------------------------------------------------------
/src/test/testData/rename/foo_after.xml:
--------------------------------------------------------------------------------
1 |
2 | Foo
3 |
4 |
--------------------------------------------------------------------------------