commit 231a337373a55d462a1d39a05306e1ececde7bc4
Author: cirry <812852553@qq.com>
Date: Fri Dec 29 00:20:04 2023 +0800
first commit
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e2e5d94
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+.gradle
+.idea
+.qodana
+build
diff --git a/.run/Run IDE for UI Tests.run.xml b/.run/Run IDE for UI Tests.run.xml
new file mode 100644
index 0000000..ee99b7e
--- /dev/null
+++ b/.run/Run IDE for UI Tests.run.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ true
+ false
+ false
+
+
+
\ No newline at end of file
diff --git a/.run/Run Plugin.run.xml b/.run/Run Plugin.run.xml
new file mode 100644
index 0000000..d15ff68
--- /dev/null
+++ b/.run/Run Plugin.run.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ true
+ false
+
+
+
\ No newline at end of file
diff --git a/.run/Run Qodana.run.xml b/.run/Run Qodana.run.xml
new file mode 100644
index 0000000..c92f33c
--- /dev/null
+++ b/.run/Run Qodana.run.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ true
+ false
+ false
+
+
+
\ No newline at end of file
diff --git a/.run/Run Tests.run.xml b/.run/Run Tests.run.xml
new file mode 100644
index 0000000..132d9ad
--- /dev/null
+++ b/.run/Run Tests.run.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ true
+ false
+
+
+
diff --git a/.run/Run Verifications.run.xml b/.run/Run Verifications.run.xml
new file mode 100644
index 0000000..3a8d688
--- /dev/null
+++ b/.run/Run Verifications.run.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ true
+ false
+
+
+
+
+
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..51bd531
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,7 @@
+
+
+# wxreader-Jetbrains-Plugin Changelog
+
+## [Unreleased]
+### Added
+- Initial scaffold created from [IntelliJ Platform Plugin Template](https://github.com/JetBrains/intellij-platform-plugin-template)
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..e4bdd75
--- /dev/null
+++ b/README.md
@@ -0,0 +1,42 @@
+# wxreader-Jetbrains-Plugin
+
+![Build](https://github.com/cirry/wxreader-Jetbrains-Plugin/workflows/Build/badge.svg)
+[![Version](https://img.shields.io/jetbrains/plugin/v/PLUGIN_ID.svg)](https://plugins.jetbrains.com/plugin/PLUGIN_ID)
+[![Downloads](https://img.shields.io/jetbrains/plugin/d/PLUGIN_ID.svg)](https://plugins.jetbrains.com/plugin/PLUGIN_ID)
+
+## Template ToDo list
+- [x] Create a new [IntelliJ Platform Plugin Template][template] project.
+- [ ] Get familiar with the [template documentation][template].
+- [ ] Adjust the [pluginGroup](./gradle.properties), [plugin ID](./src/main/resources/META-INF/plugin.xml) and [sources package](./src/main/kotlin).
+- [ ] Adjust the plugin description in `README` (see [Tips][docs:plugin-description])
+- [ ] Review the [Legal Agreements](https://plugins.jetbrains.com/docs/marketplace/legal-agreements.html?from=IJPluginTemplate).
+- [ ] [Publish a plugin manually](https://plugins.jetbrains.com/docs/intellij/publishing-plugin.html?from=IJPluginTemplate) for the first time.
+- [ ] Set the `PLUGIN_ID` in the above README badges.
+- [ ] Set the [Plugin Signing](https://plugins.jetbrains.com/docs/intellij/plugin-signing.html?from=IJPluginTemplate) related [secrets](https://github.com/JetBrains/intellij-platform-plugin-template#environment-variables).
+- [ ] Set the [Deployment Token](https://plugins.jetbrains.com/docs/marketplace/plugin-upload.html?from=IJPluginTemplate).
+- [ ] Click the Watch button on the top of the [IntelliJ Platform Plugin Template][template] to be notified about releases containing new features and fixes.
+
+
+A WeChat Reading plugin supporting IDEA.
+
+Full WeChat Reading functionality is available, allowing navigation using the arrow keys for reading. Please adjust the window to a suitable size before use.
+
+
+## Installation
+
+- Using the IDE built-in plugin system:
+
+ Settings/Preferences > Plugins > Marketplace > Search for "wxreader-Jetbrains-Plugin" >
+ Install
+
+- Manually:
+
+ Download the [latest release](https://github.com/cirry/wxreader-Jetbrains-Plugin/releases/latest) and install it manually using
+ Settings/Preferences > Plugins > ⚙️ > Install plugin from disk...
+
+
+---
+Plugin based on the [IntelliJ Platform Plugin Template][template].
+
+[template]: https://github.com/JetBrains/intellij-platform-plugin-template
+[docs:plugin-description]: https://plugins.jetbrains.com/docs/intellij/plugin-user-experience.html#plugin-description-and-presentation
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000..c0272a9
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,141 @@
+import org.gradle.kotlin.dsl.support.kotlinCompilerOptions
+import org.jetbrains.changelog.Changelog
+import org.jetbrains.changelog.markdownToHTML
+
+fun properties(key: String) = providers.gradleProperty(key)
+fun environment(key: String) = providers.environmentVariable(key)
+
+plugins {
+ id("java") // Java support
+ alias(libs.plugins.kotlin) // Kotlin support
+ alias(libs.plugins.gradleIntelliJPlugin) // Gradle IntelliJ Plugin
+ alias(libs.plugins.changelog) // Gradle Changelog Plugin
+ alias(libs.plugins.qodana) // Gradle Qodana Plugin
+ alias(libs.plugins.kover) // Gradle Kover Plugin
+}
+
+group = properties("pluginGroup").get()
+version = properties("pluginVersion").get()
+
+// Configure project's dependencies
+repositories {
+ mavenCentral()
+}
+
+// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
+dependencies {
+// implementation(libs.annotations)
+}
+
+// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+.
+kotlin {
+ @Suppress("UnstableApiUsage")
+ jvmToolchain {
+ languageVersion = JavaLanguageVersion.of(17)
+ vendor = JvmVendorSpec.JETBRAINS
+ }
+}
+
+// Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
+intellij {
+ pluginName = properties("pluginName")
+ version = properties("platformVersion")
+ type = properties("platformType")
+
+ // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
+ plugins = properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) }
+}
+
+// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
+changelog {
+ groups.empty()
+ repositoryUrl = properties("pluginRepositoryUrl")
+}
+
+// Configure Gradle Qodana Plugin - read more: https://github.com/JetBrains/gradle-qodana-plugin
+qodana {
+ cachePath = provider { file(".qodana").canonicalPath }
+ reportPath = provider { file("build/reports/inspections").canonicalPath }
+ saveReport = true
+ showReport = environment("QODANA_SHOW_REPORT").map { it.toBoolean() }.getOrElse(false)
+}
+
+// Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration
+koverReport {
+ defaults {
+ xml {
+ onCheck = true
+ }
+ }
+}
+
+tasks {
+ wrapper {
+ gradleVersion = properties("gradleVersion").get()
+ }
+
+ withType {
+ options.encoding = "utf-8"
+ }
+
+ withType {
+ systemProperty("file.encoding", "utf-8")
+ }
+
+ patchPluginXml {
+ version = properties("pluginVersion")
+ sinceBuild = properties("pluginSinceBuild")
+ untilBuild = properties("pluginUntilBuild")
+
+ // Extract the section from README.md and provide for the plugin's manifest
+ pluginDescription = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
+ val start = ""
+ val end = ""
+
+ with(it.lines()) {
+ if (!containsAll(listOf(start, end))) {
+ throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
+ }
+ subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
+ }
+ }
+
+ val changelog = project.changelog // local variable for configuration cache compatibility
+ // Get the latest available change notes from the changelog file
+ changeNotes = properties("pluginVersion").map { pluginVersion ->
+ with(changelog) {
+ renderItem(
+ (getOrNull(pluginVersion) ?: getUnreleased())
+ .withHeader(false)
+ .withEmptySections(false),
+ Changelog.OutputType.HTML,
+ )
+ }
+ }
+ }
+
+ // Configure UI tests plugin
+ // Read more: https://github.com/JetBrains/intellij-ui-test-robot
+ runIdeForUiTests {
+ systemProperty("robot-server.port", "8082")
+ systemProperty("ide.mac.message.dialogs.as.sheets", "false")
+ systemProperty("jb.privacy.policy.text", "")
+ systemProperty("jb.consents.confirmation.enabled", "false")
+ }
+
+ signPlugin {
+ certificateChain = environment("CERTIFICATE_CHAIN")
+ privateKey = environment("PRIVATE_KEY")
+ password = environment("PRIVATE_KEY_PASSWORD")
+ }
+
+ publishPlugin {
+ dependsOn("patchChangelog")
+ token = environment("PUBLISH_TOKEN")
+ // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
+ // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
+ // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
+ channels =
+ properties("pluginVersion").map { listOf(it.split('-').getOrElse(1) { "default" }.split('.').first()) }
+ }
+}
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..9d3d358
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,35 @@
+# IntelliJ Platform Artifacts Repositories -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html
+kotlin.options.encoding=UTF-8
+
+pluginGroup = com.github.cirry.wxreaderjetbrainsplugin
+pluginName = Weread
+pluginRepositoryUrl = https://github.com/cirry/wxreader-Jetbrains-Plugin
+# SemVer format -> https://semver.org
+pluginVersion = 0.0.2
+
+# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
+pluginSinceBuild = 223
+pluginUntilBuild = 233.*
+
+# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
+platformType = IU
+platformVersion = 2023.3.2
+
+# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
+# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
+platformPlugins = JavaScript
+
+# Gradle Releases -> https://github.com/gradle/gradle/releases
+gradleVersion = 8.5
+
+# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib
+kotlin.stdlib.default.dependency = false
+
+# Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html
+org.gradle.configuration-cache = true
+
+# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html
+org.gradle.caching = true
+
+# Enable Gradle Kotlin DSL Lazy Property Assignment -> https://docs.gradle.org/current/userguide/kotlin_dsl.html#kotdsl:assignment
+systemProp.org.gradle.unsafe.kotlin.assignment = true
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
new file mode 100644
index 0000000..febb8cd
--- /dev/null
+++ b/gradle/libs.versions.toml
@@ -0,0 +1,20 @@
+[versions]
+# libraries
+annotations = "24.1.0"
+
+# plugins
+kotlin = "1.9.21"
+changelog = "2.2.0"
+gradleIntelliJPlugin = "1.16.1"
+qodana = "0.1.13"
+kover = "0.7.5"
+
+[libraries]
+annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" }
+
+[plugins]
+changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
+gradleIntelliJPlugin = { id = "org.jetbrains.intellij", version.ref = "gradleIntelliJPlugin" }
+kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
+kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
+qodana = { id = "org.jetbrains.qodana", version.ref = "qodana" }
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..d64cd49
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..1af9e09
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,7 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
+networkTimeout=10000
+validateDistributionUrl=true
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
new file mode 100644
index 0000000..1aa94a4
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,249 @@
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
+
+# This is normally unused
+# shellcheck disable=SC2034
+APP_BASE_NAME=${0##*/}
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+ echo "$*"
+} >&2
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+} >&2
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD=$JAVA_HOME/jre/sh/java
+ else
+ JAVACMD=$JAVA_HOME/bin/java
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD=java
+ if ! command -v java >/dev/null 2>&1
+ then
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
+fi
+
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ org.gradle.wrapper.GradleWrapperMain \
+ "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+ die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..93e3f59
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,92 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%"=="" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if %ERRORLEVEL% equ 0 goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if %ERRORLEVEL% equ 0 goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+set EXIT_CODE=%ERRORLEVEL%
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
+exit /b %EXIT_CODE%
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/qodana.yml b/qodana.yml
new file mode 100644
index 0000000..cbf640f
--- /dev/null
+++ b/qodana.yml
@@ -0,0 +1,12 @@
+# Qodana configuration:
+# https://www.jetbrains.com/help/qodana/qodana-yaml.html
+
+version: 1.0
+linter: jetbrains/qodana-jvm-community:latest
+projectJDK: "17"
+profile:
+ name: qodana.recommended
+exclude:
+ - name: All
+ paths:
+ - .qodana
diff --git a/settings.gradle.kts b/settings.gradle.kts
new file mode 100644
index 0000000..ad4afe3
--- /dev/null
+++ b/settings.gradle.kts
@@ -0,0 +1,5 @@
+plugins {
+ id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0"
+}
+
+rootProject.name = "wxreader-Jetbrains-Plugin"
diff --git a/src/main/kotlin/com/github/cirry/wxreaderjetbrainsplugin/HelloAction.kt b/src/main/kotlin/com/github/cirry/wxreaderjetbrainsplugin/HelloAction.kt
new file mode 100644
index 0000000..c737fc2
--- /dev/null
+++ b/src/main/kotlin/com/github/cirry/wxreaderjetbrainsplugin/HelloAction.kt
@@ -0,0 +1,14 @@
+package com.github.cirry.wxreaderjetbrainsplugin
+
+import com.intellij.openapi.actionSystem.AnActionEvent
+import com.intellij.openapi.actionSystem.PlatformDataKeys
+import com.intellij.openapi.project.DumbAwareAction
+import com.intellij.openapi.ui.Messages
+
+class HelloAction : DumbAwareAction() {
+ override fun actionPerformed(event: AnActionEvent) {
+ val project = event.getData(PlatformDataKeys.PROJECT)
+ Messages.showMessageDialog(project, "Hello from Kotlin!", "Greeting", Messages.getInformationIcon())
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/github/cirry/wxreaderjetbrainsplugin/MyBundle.kt b/src/main/kotlin/com/github/cirry/wxreaderjetbrainsplugin/MyBundle.kt
new file mode 100644
index 0000000..fd27e4e
--- /dev/null
+++ b/src/main/kotlin/com/github/cirry/wxreaderjetbrainsplugin/MyBundle.kt
@@ -0,0 +1,20 @@
+package com.github.cirry.wxreaderjetbrainsplugin
+
+import com.intellij.DynamicBundle
+import org.jetbrains.annotations.NonNls
+import org.jetbrains.annotations.PropertyKey
+
+@NonNls
+private const val BUNDLE = "messages.MyBundle"
+
+object MyBundle : DynamicBundle(BUNDLE) {
+
+ @JvmStatic
+ fun message(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any) =
+ getMessage(key, *params)
+
+ @Suppress("unused")
+ @JvmStatic
+ fun messagePointer(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any) =
+ getLazyMessage(key, *params)
+}
diff --git a/src/main/kotlin/com/github/cirry/wxreaderjetbrainsplugin/listeners/MyApplicationActivationListener.kt b/src/main/kotlin/com/github/cirry/wxreaderjetbrainsplugin/listeners/MyApplicationActivationListener.kt
new file mode 100644
index 0000000..4e83c68
--- /dev/null
+++ b/src/main/kotlin/com/github/cirry/wxreaderjetbrainsplugin/listeners/MyApplicationActivationListener.kt
@@ -0,0 +1,12 @@
+package com.github.cirry.wxreaderjetbrainsplugin.listeners
+
+import com.intellij.openapi.application.ApplicationActivationListener
+import com.intellij.openapi.diagnostic.thisLogger
+import com.intellij.openapi.wm.IdeFrame
+
+internal class MyApplicationActivationListener : ApplicationActivationListener {
+
+ override fun applicationActivated(ideFrame: IdeFrame) {
+ thisLogger().warn("Don't forget to remove all non-needed sample code files with their corresponding registration entries in `plugin.xml`.")
+ }
+}
diff --git a/src/main/kotlin/com/github/cirry/wxreaderjetbrainsplugin/services/MyProjectService.kt b/src/main/kotlin/com/github/cirry/wxreaderjetbrainsplugin/services/MyProjectService.kt
new file mode 100644
index 0000000..8d7573a
--- /dev/null
+++ b/src/main/kotlin/com/github/cirry/wxreaderjetbrainsplugin/services/MyProjectService.kt
@@ -0,0 +1,16 @@
+package com.github.cirry.wxreaderjetbrainsplugin.services
+
+import com.intellij.openapi.components.Service
+import com.intellij.openapi.diagnostic.thisLogger
+import com.intellij.openapi.project.Project
+import com.github.cirry.wxreaderjetbrainsplugin.MyBundle
+
+@Service(Service.Level.PROJECT)
+class MyProjectService(project: Project) {
+
+ init {
+ thisLogger().info(MyBundle.message("projectService", project.name))
+ }
+
+ fun getRandomNumber() = (1..100).random()
+}
diff --git a/src/main/kotlin/com/github/cirry/wxreaderjetbrainsplugin/toolWindow/MyToolWindowFactory.kt b/src/main/kotlin/com/github/cirry/wxreaderjetbrainsplugin/toolWindow/MyToolWindowFactory.kt
new file mode 100644
index 0000000..164c02b
--- /dev/null
+++ b/src/main/kotlin/com/github/cirry/wxreaderjetbrainsplugin/toolWindow/MyToolWindowFactory.kt
@@ -0,0 +1,43 @@
+package com.github.cirry.wxreaderjetbrainsplugin.toolWindow
+
+import com.github.cirry.wxreaderjetbrainsplugin.MyBundle
+import com.intellij.openapi.project.Project
+import com.intellij.openapi.wm.ToolWindow
+import com.intellij.openapi.wm.ToolWindowFactory
+import com.intellij.ui.components.JBLabel
+import com.intellij.ui.components.JBPanel
+import com.intellij.ui.content.ContentFactory
+import com.intellij.ui.jcef.JBCefApp
+import com.intellij.ui.jcef.JBCefBrowser
+import java.awt.BorderLayout
+import java.awt.Dimension
+
+
+class MyToolWindowFactory : ToolWindowFactory {
+
+ init {
+
+ }
+
+ override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) {
+ val myToolWindow = MyToolWindow(toolWindow)
+ val content = ContentFactory.getInstance().createContent(myToolWindow.getContent(), "", false)
+ toolWindow.contentManager.addContent(content)
+ }
+
+ override fun shouldBeAvailable(project: Project) = true
+
+ class MyToolWindow(toolWindow: ToolWindow) {
+ fun getContent() = JBPanel>().apply {
+ val noSupportLabel = JBLabel(MyBundle.message("noSupport"))
+ if (JBCefApp.isSupported()) {
+ val jbcef = JBCefBrowser()
+ jbcef.component.preferredSize = Dimension(800,900)
+ add(jbcef.component, BorderLayout.CENTER)
+ jbcef.loadURL("https://weread.qq.com/")
+ } else {
+ add(noSupportLabel)
+ }
+ }
+ }
+}
diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml
new file mode 100644
index 0000000..7631140
--- /dev/null
+++ b/src/main/resources/META-INF/plugin.xml
@@ -0,0 +1,33 @@
+
+
+ com.github.cirry.wxreaderjetbrainsplugin
+ Weread
+ Cirry
+
+ com.intellij.modules.platform
+
+
+ code completion
+ references
+
+For more information visit the
+project site.
+]]>
+
+ messages.MyBundle
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/META-INF/pluginIcon.svg b/src/main/resources/META-INF/pluginIcon.svg
new file mode 100644
index 0000000..bd9409d
--- /dev/null
+++ b/src/main/resources/META-INF/pluginIcon.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/main/resources/icons/toolWindowIcon.svg b/src/main/resources/icons/toolWindowIcon.svg
new file mode 100644
index 0000000..5096bd5
--- /dev/null
+++ b/src/main/resources/icons/toolWindowIcon.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/main/resources/messages/MyBundle.properties b/src/main/resources/messages/MyBundle.properties
new file mode 100644
index 0000000..8f29577
--- /dev/null
+++ b/src/main/resources/messages/MyBundle.properties
@@ -0,0 +1 @@
+noSupport=Your IDEA doesn't support it, please enable JCEF.
diff --git a/src/main/resources/overlayscrollbars/overlayscrollbars.css b/src/main/resources/overlayscrollbars/overlayscrollbars.css
new file mode 100644
index 0000000..0439da0
--- /dev/null
+++ b/src/main/resources/overlayscrollbars/overlayscrollbars.css
@@ -0,0 +1,18 @@
+.os-scrollbar {
+ --os-size: 4px;
+ --os-padding-perpendicular: 2px;
+ --os-handle-border-radius: 0px;
+ --os-track-border-radius: 0; --os-track-bg: rgba(128, 128, 128, 0.000000);
+ --os-track-bg-active: rgba(128, 128, 128, 0.000000);
+ --os-track-bg-hover: rgba(128, 128, 128, 0.000000);
+ --os-handle-bg: rgba(166, 166, 166, 0.278431);
+ --os-handle-bg-active: rgba(166, 166, 166, 0.278431);
+ --os-handle-bg-hover: rgba(166, 166, 166, 0.349020);
+ --os-handle-perpendicular-size: 100%;
+ --os-handle-perpendicular-size-hover: 100%;
+ --os-handle-perpendicular-size-active: 100%;
+}
+.os-scrollbar-handle { outline: 1px solid rgba(56, 56, 56, 0.278431);
+}.os-scrollbar-handle:hover { outline: 1px solid rgba(56, 56, 56, 0.349020);
+}.os-scrollbar-handle:active { outline: 1px solid rgba(56, 56, 56, 0.349020);
+}
\ No newline at end of file
diff --git a/src/test/kotlin/com/github/cirry/wxreaderjetbrainsplugin/MyPluginTest.kt b/src/test/kotlin/com/github/cirry/wxreaderjetbrainsplugin/MyPluginTest.kt
new file mode 100644
index 0000000..e9a5f1e
--- /dev/null
+++ b/src/test/kotlin/com/github/cirry/wxreaderjetbrainsplugin/MyPluginTest.kt
@@ -0,0 +1,39 @@
+package com.github.cirry.wxreaderjetbrainsplugin
+
+import com.intellij.ide.highlighter.XmlFileType
+import com.intellij.openapi.components.service
+import com.intellij.psi.xml.XmlFile
+import com.intellij.testFramework.TestDataPath
+import com.intellij.testFramework.fixtures.BasePlatformTestCase
+import com.intellij.util.PsiErrorElementUtil
+import com.github.cirry.wxreaderjetbrainsplugin.services.MyProjectService
+
+@TestDataPath("\$CONTENT_ROOT/src/test/testData")
+class MyPluginTest : BasePlatformTestCase() {
+
+ fun testXMLFile() {
+ val psiFile = myFixture.configureByText(XmlFileType.INSTANCE, "bar")
+ val xmlFile = assertInstanceOf(psiFile, XmlFile::class.java)
+
+ assertFalse(PsiErrorElementUtil.hasErrors(project, xmlFile.virtualFile))
+
+ assertNotNull(xmlFile.rootTag)
+
+ xmlFile.rootTag?.let {
+ assertEquals("foo", it.name)
+ assertEquals("bar", it.value.text)
+ }
+ }
+
+// fun testRename() {
+// myFixture.testRename("foo.xml", "foo_after.xml", "a2")
+// }
+
+// fun testProjectService() {
+// val projectService = project.service()
+//
+// assertNotSame(projectService.getRandomNumber(), projectService.getRandomNumber())
+// }
+
+ override fun getTestDataPath() = "src/test/testData/rename"
+}
diff --git a/src/test/testData/rename/foo.xml b/src/test/testData/rename/foo.xml
new file mode 100644
index 0000000..b21e9f2
--- /dev/null
+++ b/src/test/testData/rename/foo.xml
@@ -0,0 +1,3 @@
+
+ 1>Foo
+
diff --git a/src/test/testData/rename/foo_after.xml b/src/test/testData/rename/foo_after.xml
new file mode 100644
index 0000000..980ca96
--- /dev/null
+++ b/src/test/testData/rename/foo_after.xml
@@ -0,0 +1,3 @@
+
+ Foo
+