From 22996452776132ac579e40b9fe42b48119da89fe Mon Sep 17 00:00:00 2001 From: shuzijun Date: Sun, 17 Jul 2022 22:54:08 +0800 Subject: [PATCH] doc --- CHANGELOG.md | 20 ++- build.gradle | 1 + doc/description.html | 128 ++++++++++++++++++ gradle.properties | 1 + .../RegisterPluginInstallerStateListener.java | 36 +++++ .../leetcode/plugin/model/Config.java | 10 ++ .../plugin/window/NavigatorTabsPanel.java | 6 +- src/main/resources/META-INF/plugin.xml | 113 +--------------- 8 files changed, 200 insertions(+), 115 deletions(-) create mode 100644 doc/description.html diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a7719d1..3fd65da9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Leetcode Editor Changelog +[![English Document][badge:en-doc]][gh:en-doc] +[![中文文档][badge:zh-doc]][gh:zh-doc] +[![捐赠][badge:donate]][shuzijun-donate] +[![捐赠][badge:donate-zh]][shuzijun-donate] +[![内推][badge:referrals]][shuzijun-referrals] ## 8.2.0 @@ -34,4 +39,17 @@ ### Deprecated -### Removed \ No newline at end of file +### Removed + +[badge:en-doc]: https://img.shields.io/badge/Docs-English%20Document-blue?logo=docs&style=flat-square +[badge:zh-doc]: https://img.shields.io/badge/Docs-中文文档-blue?logo=docs&style=flat-square +[badge:donate]: https://img.shields.io/badge/Docs-donate-ff69c4?logo=docs&style=flat-square +[badge:donate-zh]: https://img.shields.io/badge/Docs-捐赠-ff69c4?logo=docs&style=flat-square +[badge:referrals]: https://img.shields.io/badge/Docs-内推-ff69c4?logo=docs&style=flat-square + + +[gh:en-doc]: https://github.com/shuzijun/leetcode-editor/blob/master/README.md +[gh:zh-doc]: https://github.com/shuzijun/leetcode-editor/blob/master/README_ZH.md + +[shuzijun-donate]: https://shuzijun.cn/donate.html +[shuzijun-referrals]: https://shuzijun.cn/referrals.html \ No newline at end of file diff --git a/build.gradle b/build.gradle index 80e160d9..f5ee6fd8 100644 --- a/build.gradle +++ b/build.gradle @@ -50,6 +50,7 @@ intellij { patchPluginXml { sinceBuild = project.pluginSinceBuild untilBuild = project.pluginUntilBuild + pluginDescription = new File(project.pluginDescription).getText('UTF-8') changeNotes.set(provider { changelog.get(project.version+".0").toHTML() }) } diff --git a/doc/description.html b/doc/description.html new file mode 100644 index 00000000..42c034db --- /dev/null +++ b/doc/description.html @@ -0,0 +1,128 @@ +
+

Support for leetcode.com and leetcode.cn, can test and submit questions. + More tutorial please visit: here

+
+
+
+

Introduction

+
+ + +
+
+

Getting Started

+

start

+ +

Local debugging

+

loacl

+ +

Configuration (configuration for first installation)

+

config

+ + +

Window

+

window

+ + +

Menu

+

menu

+ + + +


+ +


+ diff --git a/gradle.properties b/gradle.properties index ff86e6f1..b6934d54 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,6 +4,7 @@ pluginVersion = 8.2 pluginSinceBuild = 202.0 pluginUntilBuild = +pluginDescription = doc/description.html platformType = IU platformVersion = 2022.1 diff --git a/src/main/java/com/shuzijun/leetcode/plugin/listener/RegisterPluginInstallerStateListener.java b/src/main/java/com/shuzijun/leetcode/plugin/listener/RegisterPluginInstallerStateListener.java index d401c4dd..2836c4bd 100644 --- a/src/main/java/com/shuzijun/leetcode/plugin/listener/RegisterPluginInstallerStateListener.java +++ b/src/main/java/com/shuzijun/leetcode/plugin/listener/RegisterPluginInstallerStateListener.java @@ -1,15 +1,51 @@ package com.shuzijun.leetcode.plugin.listener; +import com.intellij.ide.plugins.PluginManagerCore; +import com.intellij.ide.util.PropertiesComponent; +import com.intellij.openapi.extensions.PluginId; +import com.intellij.openapi.fileEditor.impl.HTMLEditorProvider; import com.intellij.openapi.project.Project; import com.intellij.openapi.startup.StartupActivity; +import com.shuzijun.leetcode.plugin.model.Config; +import com.shuzijun.leetcode.plugin.model.PluginConstant; +import com.shuzijun.leetcode.plugin.setting.PersistentConfig; import org.jetbrains.annotations.NotNull; /** * @author shuzijun */ public class RegisterPluginInstallerStateListener implements StartupActivity { + + private final static String ShowNewHTMLEditorKey = PluginConstant.PLUGIN_ID + "ShowNewHTMLEditor"; + + private final static String CHANGELOGURL = "https://github.com/shuzijun/leetcode-editor/blob/master/CHANGELOG.md"; + @Override public void runActivity(@NotNull Project project) { + String newVersion = PluginManagerCore.getPlugin(PluginId.getId(PluginConstant.PLUGIN_ID)).getVersion(); + Config config = PersistentConfig.getInstance().getInitConfig(); + String oldVersion; + if (config == null) { + oldVersion = PropertiesComponent.getInstance().getValue(ShowNewHTMLEditorKey); + PropertiesComponent.getInstance().setValue(ShowNewHTMLEditorKey, newVersion); + } else { + oldVersion = config.getPluginVersion(); + config.setPluginVersion(newVersion); + } + + if (!newVersion.equals(oldVersion)) { + HTMLEditorProvider.openEditor(project, + "What's New in " + PluginConstant.PLUGIN_ID, + CHANGELOGURL, + "'
" + + "
Failed to load!
" + + "'
Open in browser
" + + "
" + ); + } + + /* PluginInstaller.addStateListener(new PluginStateListener() { @Override public void install(@NotNull IdeaPluginDescriptor ideaPluginDescriptor) { diff --git a/src/main/java/com/shuzijun/leetcode/plugin/model/Config.java b/src/main/java/com/shuzijun/leetcode/plugin/model/Config.java index 3d182542..3ad044d7 100644 --- a/src/main/java/com/shuzijun/leetcode/plugin/model/Config.java +++ b/src/main/java/com/shuzijun/leetcode/plugin/model/Config.java @@ -17,6 +17,8 @@ public class Config implements Cloneable { private Integer version; + private String pluginVersion; + private String id; /** @@ -419,6 +421,14 @@ public void setShowQuestionEditorSign(boolean showQuestionEditorSign) { this.showQuestionEditorSign = showQuestionEditorSign; } + public String getPluginVersion() { + return pluginVersion; + } + + public void setPluginVersion(String pluginVersion) { + this.pluginVersion = pluginVersion; + } + public boolean isModified(Config config) { if (config == null) { diff --git a/src/main/java/com/shuzijun/leetcode/plugin/window/NavigatorTabsPanel.java b/src/main/java/com/shuzijun/leetcode/plugin/window/NavigatorTabsPanel.java index bf29c680..07d2317b 100644 --- a/src/main/java/com/shuzijun/leetcode/plugin/window/NavigatorTabsPanel.java +++ b/src/main/java/com/shuzijun/leetcode/plugin/window/NavigatorTabsPanel.java @@ -224,17 +224,17 @@ public void dispose() { public static synchronized void loadUser(boolean login) { User user = null; if (login) { - for (int i = 0; i < 10; i++) { + for (int i = 0; i <= 50; i++) { user = QuestionManager.getUser(); if (!user.isSignedIn()) { try { - Thread.sleep(500); + Thread.sleep(500 + (i / 10 * 100)); } catch (InterruptedException ignore) { } } else { break; } - if(i == 9){ + if(i == 50){ LogUtils.LOG.warn("User data is not synchronized"); } } diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 054bc328..118ffd22 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -4,116 +4,7 @@ 8.1 shuzijun - -

Support for leetcode.com and leetcode.cn, can test and submit questions. - More tutorial please visit: here

- -
-

Introduction

-
-
    -
  • Support for leetcode.com and leetcode.cn, can test and submit questions
  • -
  • More tutorial please visit: here
  • -
-
    -
  • 支持leetcode.com和leetcode.cn,可测试与提交问题
  • -
  • 更多的插件使用教程: 插件使用介绍
  • -
-
-
-

How to use

-
-

- demo -

-
-
-
-

Local debugging

-
-

- demo -

-
-
-
-

Configuration (configuration for first installation)

-
-

- settings -

-
-

Configuration path: File -> settings->tools->leetcode plugin

-
-
    -
  • URL options: leetcode.com and leetcode.cn
  • -
  • Code Type: Java, Python, C++, Python3, C, C#, JavaScript, Ruby, Swift, Go, Scala, Kotlin, Rust, PHP
  • -
  • Login Name: Login Username
  • -
  • Password: Login password
  • -
  • Temp File Path: Temporary file storage catalogue
  • -
  • proxy(HTTP Proxy): HTTP Proxy,config path:`File` -> `settings`->`Appearance & Behavior`->`System Settings`->`HTTP Proxy`
  • -
  • Custom code template: Custom code template ([details](https://github.com/shuzijun/leetcode-editor/blob/master/doc/CustomCode.md))([demo](https://github.com/shuzijun/leetcode-question))
  • - -
-
-
-
-
-

Window (Icon in the lower right corner of the main window)

-
-

- window -

-
-

Toolbar:

-
    -
  • Login: The login accounts of the two websites are not interoperable and the corresponding users need to be - configured when switching websites.
  • -
  • Logout: Exit the current account, if you encounter a login error, try to exit first
  • -
  • Refresh: You can also refresh and load questions if you are not logged in, but you cannot submit it.
  • -
  • Find: Input the content and press Enter to search , press again to search for the next one. It can only - search under the question bank node.
  • -
  • Collapse: Collapse all nodes.
  • -
  • Configuration: Quick jump to the configuration page
  • -
  • Clear: Clean up the files in the configured cache directories. The cache directories of the two websites - are different and only the current configured websites are cleaned up. Carefully clean up cases without - submitting.
  • -
-
-

Tree:

-
    -
  • Questions: All questions
  • -
  • Difficulty: Classification of difficulties
  • -
  • Tags: Classification of types
  • -
  • Explore: Explore content, only contains titles of the questions, exclusive content that needs to pay ; some - questions are loaded in order
  • -
  • Color: The color represents the difficulty of the question
  • -
  • Symbol: The symbols of “√” and “?” represent the status of the current questions, and explores with the - beginning of “$” needs to pay or that cannot be viewed due to other causes.
  • -
-
-
-
-
-

Menu:

-
-

- menu -

-
-

Menu (right-click on the questions)

-
    -
  • Open question: Open the question or double click on the question
  • -
  • Submit: Submit the question
  • -
  • Submissions: View the submission record, select the record details in the pop-up window (Show detail)
  • -
  • Run Code: Run the code, the test case for the question is used by default
  • -
  • Test case: Customize test cases
  • -
  • favorite:Add or remove favorite
  • -
  • Clear cache: Clean up the current questionL
  • -
-
- ]]>
+ @@ -131,7 +22,7 @@ - +