├── .gitignore ├── LICENSE ├── README.md ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src ├── main ├── java │ └── info │ │ └── dong4j │ │ └── idea │ │ └── plugin │ │ ├── MikBundle.java │ │ ├── action │ │ ├── MikGroupAction.java │ │ ├── image │ │ │ ├── ImageActionBase.java │ │ │ ├── ImageCompressAction.java │ │ │ └── ImageUploadAction.java │ │ ├── intention │ │ │ ├── ImageLabelChangeIntetionAction.java │ │ │ ├── ImageMoveIntentionAction.java │ │ │ ├── ImageUploadIntentionAction.java │ │ │ └── IntentionActionBase.java │ │ ├── markdown │ │ │ ├── ChangeLabelAction.java │ │ │ ├── MoveToOtherStorageAction.java │ │ │ ├── UploadActionBase.java │ │ │ ├── UploadAliyunCloudAction.java │ │ │ ├── UploadBaiduCloudAction.java │ │ │ ├── UploadGithubCloudAction.java │ │ │ ├── UploadQiniuCloudAction.java │ │ │ ├── UploadSmmsCloudAction.java │ │ │ ├── UploadTencentCloudAction.java │ │ │ └── UploadWeiboCloudAction.java │ │ └── paste │ │ │ └── PasteImageAction.java │ │ ├── chain │ │ ├── ActionHandlerAdapter.java │ │ ├── ActionManager.java │ │ ├── BaseActionHandler.java │ │ ├── FinalChainHandler.java │ │ ├── IActionHandler.java │ │ ├── ImageCompressionHandler.java │ │ ├── ImageLabelChangeHandler.java │ │ ├── ImageRenameHandler.java │ │ ├── ImageStorageHandler.java │ │ ├── ImageUploadHandler.java │ │ ├── InsertToClipboardHandler.java │ │ ├── InsertToDocumentHandler.java │ │ ├── MarkdownFileFilter.java │ │ ├── OptionClientHandler.java │ │ ├── ReplaceToDocument.java │ │ └── ResolveMarkdownFileHandler.java │ │ ├── client │ │ ├── AbstractOssClient.java │ │ ├── AliyunOssClient.java │ │ ├── BaiduBosClient.java │ │ ├── Client.java │ │ ├── GithubClient.java │ │ ├── OssClient.java │ │ ├── QiniuOssClient.java │ │ ├── SmmsClient.java │ │ ├── TencentOssClient.java │ │ └── WeiboOssClient.java │ │ ├── content │ │ ├── ImageContents.java │ │ ├── MarkdownContents.java │ │ └── MikContents.java │ │ ├── entity │ │ ├── EventData.java │ │ ├── HelpResult.java │ │ ├── MarkdownImage.java │ │ └── SmmsResult.java │ │ ├── enums │ │ ├── CloudEnum.java │ │ ├── FileType.java │ │ ├── HelpType.java │ │ ├── ImageLocationEnum.java │ │ ├── ImageMarkEnum.java │ │ ├── ImageMediaType.java │ │ ├── InsertEnum.java │ │ ├── RegionEnum.java │ │ ├── SuffixEnum.java │ │ ├── UploadWayEnum.java │ │ └── ZoneEnum.java │ │ ├── exception │ │ └── UploadException.java │ │ ├── icon │ │ └── MikIcons.java │ │ ├── notify │ │ ├── MikNotification.java │ │ └── UploadNotification.java │ │ ├── settings │ │ ├── AbstractExtendOssState.java │ │ ├── AbstractOssSetting.java │ │ ├── AliyunOssSetting.java │ │ ├── AliyunOssState.java │ │ ├── BaiduBosSetting.java │ │ ├── BaiduBosState.java │ │ ├── GithubOssState.java │ │ ├── GithubSetting.java │ │ ├── MikPersistenComponent.java │ │ ├── MikState.java │ │ ├── MoveToOtherOssSettingsDialog.form │ │ ├── MoveToOtherOssSettingsDialog.java │ │ ├── NumberValidator.java │ │ ├── OssState.java │ │ ├── ProjectSettingsPage.form │ │ ├── ProjectSettingsPage.java │ │ ├── QiniuOssState.java │ │ ├── TencentOssState.java │ │ └── WeiboOssState.java │ │ ├── swing │ │ └── JTextFieldHintListener.java │ │ ├── task │ │ ├── ActionTask.java │ │ └── MikTaskBase.java │ │ ├── util │ │ ├── ActionUtils.java │ │ ├── AliyunOssUtils.java │ │ ├── BaiduBosUtils.java │ │ ├── Base64Utils.java │ │ ├── CharacterUtils.java │ │ ├── Charsets.java │ │ ├── ClassUtils.java │ │ ├── ClientUtils.java │ │ ├── DES.java │ │ ├── EnumsUtils.java │ │ ├── GithubUtils.java │ │ ├── IOUtils.java │ │ ├── ImageUtils.java │ │ ├── MarkdownUtils.java │ │ ├── ParserUtils.java │ │ ├── PsiDocumentUtils.java │ │ ├── QcloudCosUtils.java │ │ ├── RSAEncodeUtils.java │ │ ├── StringUtils.java │ │ ├── UploadUtils.java │ │ ├── date │ │ │ ├── DateFormatUtils.java │ │ │ ├── DatePrinter.java │ │ │ ├── FastDateFormat.java │ │ │ ├── FastDatePrinter.java │ │ │ └── FormatCache.java │ │ └── digest │ │ │ ├── DigestUtils.java │ │ │ ├── Hex.java │ │ │ ├── HmacAlgorithms.java │ │ │ └── HmacUtils.java │ │ └── weibo │ │ ├── CookieContext.java │ │ ├── ImageInfoBuilder.java │ │ ├── UploadRequest.java │ │ ├── UploadRequestBuilder.java │ │ ├── UploadResponse.java │ │ ├── WbpUploadRequest.java │ │ ├── WbpUploadResponse.java │ │ ├── entity │ │ ├── ImageInfo.java │ │ ├── PreLogin.java │ │ ├── UploadResp.java │ │ └── upload │ │ │ ├── Data.java │ │ │ ├── Pic_1.java │ │ │ └── Pics.java │ │ ├── exception │ │ ├── LoginFailedException.java │ │ └── Wbp4jException.java │ │ ├── http │ │ ├── DefaultWbpHttpRequest.java │ │ ├── DefaultWbpHttpResponse.java │ │ ├── WbpHttpRequest.java │ │ └── WbpHttpResponse.java │ │ └── io │ │ ├── ClassLoaderWrapper.java │ │ ├── CookieCacheable.java │ │ └── Resources.java └── resources │ ├── META-INF │ ├── plugin.xml │ ├── pluginIcon.svg │ └── pluginIcon_dark.svg │ ├── icons │ ├── aliyun.png │ ├── aliyun@2x.png │ ├── baidu.png │ ├── baidu@2x.png │ ├── compress.png │ ├── compress@2x.png │ ├── github.png │ ├── github@2x.png │ ├── imgur.png │ ├── imgur@2x.png │ ├── jingdong.png │ ├── jingdong@2x.png │ ├── move.png │ ├── move@2x.png │ ├── qiniu.png │ ├── qiniu@2x.png │ ├── sm_ms.png │ ├── sm_ms@2x.png │ ├── wangyi.png │ ├── wangyi@2x.png │ ├── weibo.png │ ├── weibo@2x.png │ ├── youpai.png │ └── youpai@2x.png │ ├── intentionDescriptions │ ├── ImageLabelChangeIntetionAction │ │ └── description.html │ ├── ImageMoveIntentionAction │ │ └── description.html │ └── ImageUploadIntentionAction │ │ └── description.html │ ├── messages │ └── MikBundle.properties │ ├── mik.png │ ├── setting.properties │ ├── setting_en_US.properties │ └── setting_zh_CN.properties └── test ├── java └── info │ └── dong4j │ └── idea │ └── plugin │ ├── action │ └── AbstractUploadCloudActionTest.java │ ├── chain │ └── IActionHandlerTest.java │ ├── client │ ├── AbstractOssClientTest.java │ ├── AliyunOssClientTest.java │ ├── HelpTest.java │ ├── HttpUploadFile.java │ ├── QiniuOssClientTest.java │ ├── SmmsClientTest.java │ ├── TencentOssClient.java │ ├── TencentOssClientTest.java │ └── WeiboOssClientTest.java │ ├── handler │ └── PasteImageActionTest.java │ ├── settings │ └── MoveToOtherOssSettingsDialogTest.java │ ├── util │ ├── AliyunOssUtilsTest.java │ ├── BaiduBosUtilsTest.java │ ├── DESTest.java │ ├── EnumsUtilsTest.java │ ├── GithubUtilsTest.java │ ├── ImageUtilsTest.java │ └── ParserUtilsTest.java │ └── weibo │ └── WbpUploadRequestTest.java └── resources ├── META-INF └── services │ └── info.dong4j.idea.plugin.client.OssClient └── log4j.properties /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | ### Gradle template 3 | .gradle 4 | /build/ 5 | /out/ 6 | .sandbox 7 | 8 | # idea 9 | *.iml 10 | *.ipr 11 | *.iws 12 | .idea 13 | 14 | # Ignore Gradle GUI config 15 | gradle-app.setting 16 | 17 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 18 | !gradle-wrapper.jar 19 | 20 | # Cache of project 21 | .gradletasknamecache 22 | 23 | # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 24 | # gradle/wrapper/gradle-wrapper.properties 25 | 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 dong4j 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | plugins { 26 | // 1. 编译, 测试插件 (Java, Groovy,Scala, War 等) 27 | id 'java' 28 | // Java 是Gradle的核心插件, 是内置的, 内置插件不需要配置依赖路径 29 | id 'org.jetbrains.intellij' version '0.4.18' 30 | } 31 | 32 | group group 33 | version version 34 | 35 | sourceCompatibility = javaVersion 36 | targetCompatibility = javaVersion 37 | 38 | repositories { 39 | mavenCentral() 40 | maven { url "http://maven.aliyun.com/nexus/content/groups/public/" } 41 | maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } 42 | maven { url 'http://dl.bintray.com/jetbrains/intellij-plugin-service' } 43 | } 44 | 45 | intellij { 46 | // 在 2019.2 以上版本添加生效 47 | // plugins 'java' 48 | pluginName name 49 | version ideaVersion 50 | // 插件生成的临时文件的地址,可以省略 51 | sandboxDirectory = project.rootDir.canonicalPath + "/.sandbox" 52 | updateSinceUntilBuild false 53 | sameSinceUntilBuild false 54 | } 55 | 56 | publishPlugin { 57 | username System.getenv('username') 58 | password System.getenv('password') 59 | channels publishChannels 60 | } 61 | 62 | // 声明依赖使用下面的闭包 63 | dependencies { 64 | compile('com.qiniu:qiniu-java-sdk:7.2.28') { 65 | exclude group: 'com.google.code.gson', module: 'gson' 66 | } 67 | annotationProcessor 'org.projectlombok:lombok:1.18.18' 68 | compileOnly 'org.projectlombok:lombok:1.18.18' 69 | testAnnotationProcessor 'org.projectlombok:lombok:1.18.18' 70 | testCompileOnly 'org.projectlombok:lombok:1.18.18' 71 | testCompile 'junit:junit:4.13.1' 72 | compile 'net.coobird:thumbnailator:0.4.13' 73 | testCompile group: 'com.aliyun.oss', name: 'aliyun-sdk-oss', version: '3.8.1' 74 | testCompile group: 'com.baidubce', name: 'bce-java-sdk', version: '0.10.153' 75 | } 76 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2021 dong4j 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | 25 | intellijPublishUsername= 26 | intellijPublishPassword= 27 | 28 | group="info.dong4j" 29 | name="Markdown Image Kit" 30 | version=1.3.0 31 | ideaVersion=2019.1 32 | javaVersion=1.8 33 | publishChannels=Stable 34 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dong4j/markdown-image-kit/ead7344e4d5efbe19a17ee8fc1051e78802e84b8/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2021 dong4j 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | 25 | #Tue Apr 21 10:40:00 CST 2020 26 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 27 | distributionBase=GRADLE_USER_HOME 28 | distributionPath=wrapper/dists 29 | zipStorePath=wrapper/dists 30 | zipStoreBase=GRADLE_USER_HOME 31 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS="-Xmx64m" 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | rootProject.name = 'markdown-image-kit' 26 | 27 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/action/MikGroupAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.action; 26 | 27 | import com.intellij.icons.AllIcons; 28 | import com.intellij.openapi.actionSystem.AnActionEvent; 29 | import com.intellij.openapi.actionSystem.DefaultActionGroup; 30 | 31 | import org.jetbrains.annotations.NotNull; 32 | 33 | /** 34 | *

Company: no company

35 | *

Description: 通过代码的方式添加 Group

36 | * http://www.jetbrains.org/intellij/sdk/docs/tutorials/action_system/grouping_action.html 37 | * Providing specific behaviour for the group 38 | * Registering a variable action group 39 | * 40 | * @author dong4j 41 | * @version 0.0.1 42 | * @email "mailto:dong4j@gmail.com" 43 | * @date 2021.02.14 18:40 44 | * @since 0.0.1 45 | */ 46 | public final class MikGroupAction extends DefaultActionGroup { 47 | /** 48 | * Update 49 | * 50 | * @param event event 51 | * @since 0.0.1 52 | */ 53 | @Override 54 | public void update(@NotNull AnActionEvent event) { 55 | event.getPresentation().setIcon(AllIcons.Gutter.Colors); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/action/markdown/UploadAliyunCloudAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.action.markdown; 26 | 27 | import info.dong4j.idea.plugin.client.AliyunOssClient; 28 | import info.dong4j.idea.plugin.client.OssClient; 29 | import info.dong4j.idea.plugin.enums.CloudEnum; 30 | import info.dong4j.idea.plugin.icon.MikIcons; 31 | import info.dong4j.idea.plugin.settings.MikPersistenComponent; 32 | import info.dong4j.idea.plugin.settings.OssState; 33 | 34 | import org.jetbrains.annotations.Contract; 35 | import org.jetbrains.annotations.NotNull; 36 | import org.jetbrains.annotations.Nullable; 37 | 38 | import javax.swing.Icon; 39 | 40 | import lombok.extern.slf4j.Slf4j; 41 | 42 | /** 43 | *

Company: no company

44 | *

Description: 上传到阿里 OSS 事件

45 | * 46 | * @author dong4j 47 | * @version 0.0.1 48 | * @email "mailto:dong4j@gmail.com" 49 | * @date 2021.02.14 18:40 50 | * @since 0.0.1 51 | */ 52 | @Slf4j 53 | public final class UploadAliyunCloudAction extends UploadActionBase { 54 | 55 | /** 56 | * Gets icon * 57 | * 58 | * @return the icon 59 | * @since 0.0.1 60 | */ 61 | @NotNull 62 | @Contract(pure = true) 63 | @Override 64 | protected Icon getIcon() { 65 | return MikIcons.ALIYUN_OSS; 66 | } 67 | 68 | /** 69 | * Is available 70 | * 71 | * @return the boolean 72 | * @since 0.0.1 73 | */ 74 | @Contract(pure = true) 75 | @Override 76 | boolean isAvailable() { 77 | return OssState.getStatus(MikPersistenComponent.getInstance().getState().getAliyunOssState()); 78 | } 79 | 80 | /** 81 | * Gets name * 82 | * 83 | * @return the name 84 | * @since 0.0.1 85 | */ 86 | @Nullable 87 | @Contract(pure = true) 88 | @Override 89 | String getName() { 90 | return CloudEnum.ALIYUN_CLOUD.title; 91 | } 92 | 93 | /** 94 | * Gets client * 95 | * 96 | * @return the client 97 | * @since 0.0.1 98 | */ 99 | @Contract(pure = true) 100 | @Override 101 | OssClient getClient() { 102 | return AliyunOssClient.getInstance(); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/action/markdown/UploadBaiduCloudAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.action.markdown; 26 | 27 | import info.dong4j.idea.plugin.client.BaiduBosClient; 28 | import info.dong4j.idea.plugin.client.OssClient; 29 | import info.dong4j.idea.plugin.enums.CloudEnum; 30 | import info.dong4j.idea.plugin.icon.MikIcons; 31 | import info.dong4j.idea.plugin.settings.MikPersistenComponent; 32 | import info.dong4j.idea.plugin.settings.OssState; 33 | 34 | import org.jetbrains.annotations.Contract; 35 | import org.jetbrains.annotations.NotNull; 36 | import org.jetbrains.annotations.Nullable; 37 | 38 | import javax.swing.Icon; 39 | 40 | import lombok.extern.slf4j.Slf4j; 41 | 42 | /** 43 | *

Company: no company

44 | *

Description: 上传到阿里 OSS 事件

45 | * 46 | * @author dong4j 47 | * @version 0.0.1 48 | * @email "mailto:dong4j@gmail.com" 49 | * @date 2021.02.14 18:40 50 | * @since 0.0.1 51 | */ 52 | @Slf4j 53 | public final class UploadBaiduCloudAction extends UploadActionBase { 54 | 55 | /** 56 | * Gets icon * 57 | * 58 | * @return the icon 59 | * @since 0.0.1 60 | */ 61 | @NotNull 62 | @Contract(pure = true) 63 | @Override 64 | protected Icon getIcon() { 65 | return MikIcons.BAIDU; 66 | } 67 | 68 | /** 69 | * Is available 70 | * 71 | * @return the boolean 72 | * @since 0.0.1 73 | */ 74 | @Contract(pure = true) 75 | @Override 76 | boolean isAvailable() { 77 | return OssState.getStatus(MikPersistenComponent.getInstance().getState().getBaiduBosState()); 78 | } 79 | 80 | /** 81 | * Gets name * 82 | * 83 | * @return the name 84 | * @since 0.0.1 85 | */ 86 | @Nullable 87 | @Contract(pure = true) 88 | @Override 89 | String getName() { 90 | return CloudEnum.BAIDU_CLOUD.title; 91 | } 92 | 93 | /** 94 | * Gets client * 95 | * 96 | * @return the client 97 | * @since 0.0.1 98 | */ 99 | @Contract(pure = true) 100 | @Override 101 | OssClient getClient() { 102 | return BaiduBosClient.getInstance(); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/action/markdown/UploadGithubCloudAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.action.markdown; 26 | 27 | import info.dong4j.idea.plugin.client.GithubClient; 28 | import info.dong4j.idea.plugin.client.OssClient; 29 | import info.dong4j.idea.plugin.enums.CloudEnum; 30 | import info.dong4j.idea.plugin.icon.MikIcons; 31 | import info.dong4j.idea.plugin.settings.MikPersistenComponent; 32 | import info.dong4j.idea.plugin.settings.OssState; 33 | 34 | import org.jetbrains.annotations.Contract; 35 | import org.jetbrains.annotations.NotNull; 36 | import org.jetbrains.annotations.Nullable; 37 | 38 | import javax.swing.Icon; 39 | 40 | import lombok.extern.slf4j.Slf4j; 41 | 42 | /** 43 | *

Company: no company

44 | *

Description: 上传到阿里 OSS 事件

45 | * 46 | * @author dong4j 47 | * @version 1.0.0 48 | * @email "mailto:dong4j@gmail.com" 49 | * @date 2021.02.14 18:40 50 | * @since 1.3.0 51 | */ 52 | @Slf4j 53 | public final class UploadGithubCloudAction extends UploadActionBase { 54 | 55 | /** 56 | * Gets icon * 57 | * 58 | * @return the icon 59 | * @since 1.3.0 60 | */ 61 | @NotNull 62 | @Contract(pure = true) 63 | @Override 64 | protected Icon getIcon() { 65 | return MikIcons.GITHUB; 66 | } 67 | 68 | /** 69 | * Is available 70 | * 71 | * @return the boolean 72 | * @since 1.3.0 73 | */ 74 | @Contract(pure = true) 75 | @Override 76 | boolean isAvailable() { 77 | return OssState.getStatus(MikPersistenComponent.getInstance().getState().getGithubOssState()); 78 | } 79 | 80 | /** 81 | * Gets name * 82 | * 83 | * @return the name 84 | * @since 1.3.0 85 | */ 86 | @Nullable 87 | @Contract(pure = true) 88 | @Override 89 | String getName() { 90 | return CloudEnum.GITHUB.title; 91 | } 92 | 93 | /** 94 | * Gets client * 95 | * 96 | * @return the client 97 | * @since 1.3.0 98 | */ 99 | @Contract(pure = true) 100 | @Override 101 | OssClient getClient() { 102 | return GithubClient.getInstance(); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/action/markdown/UploadQiniuCloudAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.action.markdown; 26 | 27 | import info.dong4j.idea.plugin.client.OssClient; 28 | import info.dong4j.idea.plugin.client.QiniuOssClient; 29 | import info.dong4j.idea.plugin.enums.CloudEnum; 30 | import info.dong4j.idea.plugin.icon.MikIcons; 31 | import info.dong4j.idea.plugin.settings.MikPersistenComponent; 32 | import info.dong4j.idea.plugin.settings.OssState; 33 | 34 | import org.jetbrains.annotations.Contract; 35 | import org.jetbrains.annotations.Nullable; 36 | 37 | import javax.swing.Icon; 38 | 39 | /** 40 | *

Company: no company

41 | *

Description: 上传到七牛云 OSS 事件

42 | * 43 | * @author dong4j 44 | * @version 0.0.1 45 | * @email "mailto:dong4j@gmail.com" 46 | * @date 2021.02.14 18:40 47 | * @since 0.0.1 48 | */ 49 | public final class UploadQiniuCloudAction extends UploadActionBase { 50 | 51 | /** 52 | * Gets icon * 53 | * 54 | * @return the icon 55 | * @since 0.0.1 56 | */ 57 | @Contract(pure = true) 58 | @Override 59 | protected Icon getIcon() { 60 | return MikIcons.QINIU_OSS; 61 | } 62 | 63 | /** 64 | * Is available 65 | * 66 | * @return the boolean 67 | * @since 0.0.1 68 | */ 69 | @Contract(pure = true) 70 | @Override 71 | boolean isAvailable() { 72 | return OssState.getStatus(MikPersistenComponent.getInstance().getState().getQiniuOssState()); 73 | } 74 | 75 | /** 76 | * Gets name * 77 | * 78 | * @return the name 79 | * @since 0.0.1 80 | */ 81 | @Nullable 82 | @Contract(pure = true) 83 | @Override 84 | String getName() { 85 | return CloudEnum.QINIU_CLOUD.title; 86 | } 87 | 88 | /** 89 | * Gets client * 90 | * 91 | * @return the client 92 | * @since 0.0.1 93 | */ 94 | @Contract(pure = true) 95 | @Override 96 | OssClient getClient() { 97 | return QiniuOssClient.getInstance(); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/action/markdown/UploadSmmsCloudAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.action.markdown; 26 | 27 | import info.dong4j.idea.plugin.client.OssClient; 28 | import info.dong4j.idea.plugin.client.SmmsClient; 29 | import info.dong4j.idea.plugin.enums.CloudEnum; 30 | import info.dong4j.idea.plugin.icon.MikIcons; 31 | 32 | import org.jetbrains.annotations.Contract; 33 | import org.jetbrains.annotations.Nullable; 34 | 35 | import javax.swing.Icon; 36 | 37 | /** 38 | *

Company: no company

39 | *

Description:

40 | * 41 | * @author dong4j 42 | * @version 0.0.1 43 | * @email "mailto:dong4j@gmail.com" 44 | * @date 2021.02.14 18:40 45 | * @since 0.0.1 46 | */ 47 | public final class UploadSmmsCloudAction extends UploadActionBase { 48 | 49 | /** 50 | * Gets icon * 51 | * 52 | * @return the icon 53 | * @since 0.0.1 54 | */ 55 | @Contract(pure = true) 56 | @Override 57 | protected Icon getIcon() { 58 | return MikIcons.SM_MS; 59 | } 60 | 61 | /** 62 | * Is available 63 | * 64 | * @return the boolean 65 | * @since 0.0.1 66 | */ 67 | @Contract(pure = true) 68 | @Override 69 | boolean isAvailable() { 70 | return true; 71 | } 72 | 73 | /** 74 | * Gets name * 75 | * 76 | * @return the name 77 | * @since 0.0.1 78 | */ 79 | @Nullable 80 | @Contract(pure = true) 81 | @Override 82 | String getName() { 83 | return CloudEnum.SM_MS_CLOUD.title; 84 | } 85 | 86 | /** 87 | * Gets client * 88 | * 89 | * @return the client 90 | * @since 0.0.1 91 | */ 92 | @Contract(pure = true) 93 | @Override 94 | OssClient getClient() { 95 | return SmmsClient.getInstance(); 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/action/markdown/UploadTencentCloudAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.action.markdown; 26 | 27 | import info.dong4j.idea.plugin.client.OssClient; 28 | import info.dong4j.idea.plugin.client.TencentOssClient; 29 | import info.dong4j.idea.plugin.enums.CloudEnum; 30 | import info.dong4j.idea.plugin.icon.MikIcons; 31 | import info.dong4j.idea.plugin.settings.MikPersistenComponent; 32 | import info.dong4j.idea.plugin.settings.OssState; 33 | 34 | import org.jetbrains.annotations.Contract; 35 | import org.jetbrains.annotations.NotNull; 36 | import org.jetbrains.annotations.Nullable; 37 | 38 | import javax.swing.Icon; 39 | 40 | import lombok.extern.slf4j.Slf4j; 41 | 42 | /** 43 | *

Company: no company

44 | *

Description: 上传到阿里 OSS 事件

45 | * 46 | * @author dong4j 47 | * @version 0.0.1 48 | * @email "mailto:dong4j@gmail.com" 49 | * @date 2021.02.14 18:40 50 | * @since 0.0.1 51 | */ 52 | @Slf4j 53 | public final class UploadTencentCloudAction extends UploadActionBase { 54 | 55 | /** 56 | * Gets icon * 57 | * 58 | * @return the icon 59 | * @since 0.0.1 60 | */ 61 | @NotNull 62 | @Contract(pure = true) 63 | @Override 64 | protected Icon getIcon() { 65 | return MikIcons.ALIYUN_OSS; 66 | } 67 | 68 | /** 69 | * Is available 70 | * 71 | * @return the boolean 72 | * @since 0.0.1 73 | */ 74 | @Contract(pure = true) 75 | @Override 76 | boolean isAvailable() { 77 | return OssState.getStatus(MikPersistenComponent.getInstance().getState().getTencentOssState()); 78 | } 79 | 80 | /** 81 | * Gets name * 82 | * 83 | * @return the name 84 | * @since 0.0.1 85 | */ 86 | @Nullable 87 | @Contract(pure = true) 88 | @Override 89 | String getName() { 90 | return CloudEnum.TENCENT_CLOUD.title; 91 | } 92 | 93 | /** 94 | * Gets client * 95 | * 96 | * @return the client 97 | * @since 0.0.1 98 | */ 99 | @Contract(pure = true) 100 | @Override 101 | OssClient getClient() { 102 | return TencentOssClient.getInstance(); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/action/markdown/UploadWeiboCloudAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.action.markdown; 26 | 27 | import info.dong4j.idea.plugin.client.OssClient; 28 | import info.dong4j.idea.plugin.client.WeiboOssClient; 29 | import info.dong4j.idea.plugin.enums.CloudEnum; 30 | import info.dong4j.idea.plugin.icon.MikIcons; 31 | import info.dong4j.idea.plugin.settings.MikPersistenComponent; 32 | import info.dong4j.idea.plugin.settings.OssState; 33 | 34 | import org.jetbrains.annotations.Contract; 35 | import org.jetbrains.annotations.Nullable; 36 | 37 | import javax.swing.Icon; 38 | 39 | import lombok.extern.slf4j.Slf4j; 40 | 41 | /** 42 | *

Company: no company

43 | *

Description: 上传到微博 OSS 事件

44 | * 45 | * @author dong4j 46 | * @version 0.0.1 47 | * @email "mailto:dong4j@gmail.com" 48 | * @date 2021.02.14 18:40 49 | * @since 0.0.1 50 | */ 51 | @Slf4j 52 | public final class UploadWeiboCloudAction extends UploadActionBase { 53 | /** 54 | * Gets icon * 55 | * 56 | * @return the icon 57 | * @since 0.0.1 58 | */ 59 | @Contract(pure = true) 60 | @Override 61 | protected Icon getIcon() { 62 | return MikIcons.WEIBO_OSS; 63 | } 64 | 65 | /** 66 | * Is available 67 | * 68 | * @return the boolean 69 | * @since 0.0.1 70 | */ 71 | @Contract(pure = true) 72 | @Override 73 | boolean isAvailable() { 74 | return OssState.getStatus(MikPersistenComponent.getInstance().getState().getWeiboOssState()); 75 | } 76 | 77 | /** 78 | * Gets name * 79 | * 80 | * @return the name 81 | * @since 0.0.1 82 | */ 83 | @Nullable 84 | @Contract(pure = true) 85 | @Override 86 | String getName() { 87 | return CloudEnum.WEIBO_CLOUD.title; 88 | } 89 | 90 | /** 91 | * Gets client * 92 | * 93 | * @return the client 94 | * @since 0.0.1 95 | */ 96 | @Contract(pure = true) 97 | @Override 98 | OssClient getClient() { 99 | return WeiboOssClient.getInstance(); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/chain/BaseActionHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.chain; 26 | 27 | import info.dong4j.idea.plugin.entity.EventData; 28 | import info.dong4j.idea.plugin.entity.MarkdownImage; 29 | 30 | import java.util.Iterator; 31 | 32 | /** 33 | *

Company: no company

34 | *

Description:

35 | * 36 | * @author dong4j 37 | * @version 0.0.1 38 | * @email "mailto:dong4j@gmail.com" 39 | * @date 2021.02.14 18:40 40 | * @since 0.0.1 41 | */ 42 | public abstract class BaseActionHandler implements IActionHandler { 43 | /** 44 | * 是否符合该处理类的处理范围 45 | * 46 | * @param data the data 47 | * @return 是否符合 boolean 48 | * @since 0.0.1 49 | */ 50 | @Override 51 | public boolean isEnabled(EventData data){ 52 | return true; 53 | } 54 | 55 | /** 56 | * 执行具体的处理逻辑 57 | * 58 | * @param data the data 59 | * @return 是否阻止系统的事件传递 boolean 60 | * @since 0.0.1 61 | */ 62 | @Override 63 | public boolean execute(EventData data){ 64 | return true; 65 | } 66 | 67 | /** 68 | * 子类实现具体逻辑 69 | * 70 | * @param data the data 71 | * @param imageIterator the image iterator 72 | * @param markdownImage the markdown image 73 | * @since 0.0.1 74 | */ 75 | abstract void invoke(EventData data, Iterator imageIterator, MarkdownImage markdownImage); 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/chain/FinalChainHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.chain; 26 | 27 | import com.intellij.openapi.editor.Document; 28 | 29 | import info.dong4j.idea.plugin.entity.EventData; 30 | import info.dong4j.idea.plugin.entity.MarkdownImage; 31 | 32 | import java.io.IOException; 33 | import java.util.List; 34 | import java.util.Map; 35 | 36 | /** 37 | *

Company: no company

38 | *

Description:

39 | * 40 | * @author dong4j 41 | * @version 0.0.1 42 | * @email "mailto:dong4j@gmail.com" 43 | * @date 2021.02.14 18:40 44 | * @since 0.0.1 45 | */ 46 | public class FinalChainHandler extends ActionHandlerAdapter { 47 | /** 48 | * Gets name * 49 | * 50 | * @return the name 51 | * @since 0.0.1 52 | */ 53 | @Override 54 | public String getName() { 55 | return "扫尾工作"; 56 | } 57 | 58 | /** 59 | * Is enabled 60 | * 61 | * @param data data 62 | * @return the boolean 63 | * @since 0.0.1 64 | */ 65 | @Override 66 | public boolean isEnabled(EventData data) { 67 | return STATE.isRename(); 68 | } 69 | 70 | /** 71 | * 根据配置重新设置 imageName 72 | * 73 | * @param data the data 74 | * @return the boolean 75 | * @since 0.0.1 76 | */ 77 | @Override 78 | public boolean execute(EventData data) { 79 | Map> processededData = data.getWaitingProcessMap(); 80 | for (Map.Entry> imageEntry : processededData.entrySet()) { 81 | List markdownImages = imageEntry.getValue(); 82 | for (MarkdownImage markdownImage : markdownImages) { 83 | 84 | if (markdownImage.getInputStream() != null) { 85 | try { 86 | markdownImage.getInputStream().close(); 87 | } catch (IOException ignored) { 88 | } 89 | } 90 | } 91 | markdownImages.clear(); 92 | } 93 | processededData.clear(); 94 | return true; 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/chain/IActionHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.chain; 26 | 27 | import info.dong4j.idea.plugin.entity.EventData; 28 | import info.dong4j.idea.plugin.settings.MikPersistenComponent; 29 | import info.dong4j.idea.plugin.settings.MikState; 30 | 31 | /** 32 | *

Company: no company

33 | *

Description:

34 | * 35 | * @author dong4j 36 | * @version 0.0.1 37 | * @email "mailto:dong4j@gmail.com" 38 | * @date 2021.02.14 18:40 39 | * @since 0.0.1 40 | */ 41 | public interface IActionHandler { 42 | /** 43 | * The constant STATE. 44 | */ 45 | MikState STATE = MikPersistenComponent.getInstance().getState(); 46 | 47 | /** 48 | * Gets name. 49 | * 50 | * @return the name 51 | * @since 0.0.1 52 | */ 53 | String getName(); 54 | 55 | /** 56 | * 是否符合该处理类的处理范围 57 | * 58 | * @param data the data 59 | * @return 是否符合 boolean false 则当前 handler 不执行 60 | * @since 0.0.1 61 | */ 62 | boolean isEnabled(EventData data); 63 | 64 | /** 65 | * 执行具体的处理逻辑 66 | * 67 | * @param data the data 68 | * @return 是否阻止系统的事件传递 boolean 为 false 时后一个 handler 不自信, 整个 chain 中断 69 | * @since 0.0.1 70 | */ 71 | boolean execute(EventData data); 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/chain/InsertToClipboardHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.chain; 26 | 27 | import com.intellij.openapi.editor.Document; 28 | import com.intellij.openapi.progress.ProgressIndicator; 29 | 30 | import info.dong4j.idea.plugin.content.ImageContents; 31 | import info.dong4j.idea.plugin.entity.EventData; 32 | import info.dong4j.idea.plugin.entity.MarkdownImage; 33 | import info.dong4j.idea.plugin.util.ImageUtils; 34 | 35 | import java.util.List; 36 | import java.util.Map; 37 | 38 | /** 39 | *

Company: no company

40 | *

Description: 将直接上传 image 后的 url 写入到 clipboard

41 | * 42 | * @author dong4j 43 | * @version 0.0.1 44 | * @email "mailto:dong4j@gmail.com" 45 | * @date 2021.02.14 18:40 46 | * @since 0.0.1 47 | */ 48 | public class InsertToClipboardHandler extends ActionHandlerAdapter { 49 | 50 | /** 51 | * Gets name * 52 | * 53 | * @return the name 54 | * @since 0.0.1 55 | */ 56 | @Override 57 | public String getName() { 58 | return "写入到 clipboard"; 59 | } 60 | 61 | /** 62 | * Execute 63 | * 64 | * @param data data 65 | * @return the boolean 66 | * @since 0.0.1 67 | */ 68 | @Override 69 | public boolean execute(EventData data) { 70 | ProgressIndicator indicator = data.getIndicator(); 71 | int size = data.getSize(); 72 | int totalProcessed = 0; 73 | StringBuilder marks = new StringBuilder(); 74 | for (Map.Entry> imageEntry : data.getWaitingProcessMap().entrySet()) { 75 | int totalCount = imageEntry.getValue().size(); 76 | for (MarkdownImage markdownImage : imageEntry.getValue()) { 77 | String imageName = markdownImage.getImageName(); 78 | indicator.setText2("Processing " + imageName); 79 | 80 | marks.append(markdownImage.getFinalMark()).append(ImageContents.LINE_BREAK); 81 | 82 | indicator.setFraction(((++totalProcessed * 1.0) + data.getIndex() * size) / totalCount * size); 83 | } 84 | } 85 | ImageUtils.setStringToClipboard(marks.toString()); 86 | return true; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/chain/InsertToDocumentHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.chain; 26 | 27 | import com.intellij.openapi.command.WriteCommandAction; 28 | import com.intellij.openapi.editor.EditorModificationUtil; 29 | 30 | import info.dong4j.idea.plugin.content.ImageContents; 31 | import info.dong4j.idea.plugin.entity.EventData; 32 | import info.dong4j.idea.plugin.entity.MarkdownImage; 33 | 34 | import java.util.Iterator; 35 | 36 | /** 37 | *

Company: no company

38 | *

Description: 插入新的文本行

39 | * 40 | * @author dong4j 41 | * @version 0.0.1 42 | * @email "mailto:dong4j@gmail.com" 43 | * @date 2021.02.14 18:40 44 | * @since 0.0.1 45 | */ 46 | public class InsertToDocumentHandler extends ActionHandlerAdapter { 47 | 48 | /** 49 | * Gets name * 50 | * 51 | * @return the name 52 | * @since 0.0.1 53 | */ 54 | @Override 55 | public String getName() { 56 | return "写入到 document"; 57 | } 58 | 59 | /** 60 | * Invoke 61 | * 62 | * @param data data 63 | * @param imageIterator image iterator 64 | * @param markdownImage markdown image 65 | * @since 0.0.1 66 | */ 67 | @Override 68 | public void invoke(EventData data, Iterator imageIterator, MarkdownImage markdownImage) { 69 | WriteCommandAction.runWriteCommandAction(data.getProject(), 70 | () -> EditorModificationUtil 71 | .insertStringAtCaret( 72 | data.getEditor(), 73 | markdownImage.getFinalMark() + ImageContents.LINE_BREAK)); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/chain/MarkdownFileFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.chain; 26 | 27 | import com.intellij.openapi.editor.Document; 28 | 29 | import info.dong4j.idea.plugin.entity.MarkdownImage; 30 | 31 | import java.util.List; 32 | import java.util.Map; 33 | 34 | /** 35 | *

Company: no company

36 | *

Description:

37 | * 38 | * @author dong4j 39 | * @version 0.0.1 40 | * @email "mailto:dong4j@gmail.com" 41 | * @date 2021.02.14 18:40 42 | * @since 0.0.1 43 | */ 44 | public interface MarkdownFileFilter { 45 | /** FILTER_KEY */ 46 | String FILTER_KEY = "filter_key"; 47 | 48 | /** 49 | * 按要求排除不需要的 MarkdownImage 50 | * 51 | * @param waitingProcessMap the waiting process map 52 | * @param filterString the filter string 53 | * @since 0.0.1 54 | */ 55 | void filter(Map> waitingProcessMap, String filterString); 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/chain/OptionClientHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.chain; 26 | 27 | import info.dong4j.idea.plugin.client.OssClient; 28 | import info.dong4j.idea.plugin.entity.EventData; 29 | import info.dong4j.idea.plugin.notify.UploadNotification; 30 | import info.dong4j.idea.plugin.util.ClientUtils; 31 | 32 | import lombok.extern.slf4j.Slf4j; 33 | 34 | /** 35 | *

Company: no company

36 | *

Description: 上传客户端处理

37 | * 需要 OssClient 38 | * 39 | * @author dong4j 40 | * @version 0.0.1 41 | * @email "mailto:dong4j@gmail.com" 42 | * @date 2021.02.14 18:40 43 | * @since 0.0.1 44 | */ 45 | @Slf4j 46 | public class OptionClientHandler extends ActionHandlerAdapter { 47 | 48 | /** 49 | * Gets name * 50 | * 51 | * @return the name 52 | * @since 0.0.1 53 | */ 54 | @Override 55 | public String getName() { 56 | return "验证 client"; 57 | } 58 | 59 | /** 60 | * 执行具体的处理逻辑 61 | * 62 | * @param data the data 63 | * @return 是否阻止系统的事件传递 boolean 64 | * @since 0.0.1 65 | */ 66 | @Override 67 | public boolean execute(EventData data){ 68 | OssClient ossClient = data.getClient(); 69 | if (ClientUtils.isNotEnable(ossClient)) { 70 | UploadNotification.notifyConfigurableError(data.getProject(), data.getClientName()); 71 | return false; 72 | } 73 | return true; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/chain/ResolveMarkdownFileHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.chain; 26 | 27 | import com.intellij.ide.util.PropertiesComponent; 28 | import com.intellij.openapi.editor.Document; 29 | 30 | import info.dong4j.idea.plugin.entity.EventData; 31 | import info.dong4j.idea.plugin.entity.MarkdownImage; 32 | import info.dong4j.idea.plugin.util.MarkdownUtils; 33 | 34 | import java.util.List; 35 | import java.util.Map; 36 | 37 | import lombok.Setter; 38 | 39 | /** 40 | *

Company: no company

41 | *

Description: 解析 markdown 文件

42 | * 需要 AnActionEvent(不是必须的) 和 Project 43 | * 44 | * @author dong4j 45 | * @version 0.0.1 46 | * @email "mailto:dong4j@gmail.com" 47 | * @date 2021.02.14 18:40 48 | * @since 0.0.1 49 | */ 50 | @Setter 51 | public class ResolveMarkdownFileHandler extends ActionHandlerAdapter { 52 | /** File filter */ 53 | private MarkdownFileFilter fileFilter; 54 | 55 | /** 56 | * Gets name * 57 | * 58 | * @return the name 59 | * @since 0.0.1 60 | */ 61 | @Override 62 | public String getName() { 63 | return "解析 Markdown 文件"; 64 | } 65 | 66 | /** 67 | * 优先使用 EventData 中的数据, 如果没有再解析 68 | * 69 | * @param data the data 70 | * @return the boolean 71 | * @since 0.0.1 72 | */ 73 | @Override 74 | public boolean execute(EventData data) { 75 | // 优先处理设置的数据, 用于 ImageMoveIntentionAction 和 ImageUploadIntentionAction 76 | Map> waitingProcessMap = data.getWaitingProcessMap(); 77 | if (waitingProcessMap == null || waitingProcessMap.size() == 0) { 78 | // 解析当前文档或者选择的文件树中的所有 markdown 文件. 79 | waitingProcessMap = MarkdownUtils.getProcessMarkdownInfo(data.getActionEvent(), data.getProject()); 80 | data.setWaitingProcessMap(waitingProcessMap); 81 | } 82 | 83 | if (this.fileFilter != null) { 84 | PropertiesComponent propComp = PropertiesComponent.getInstance(); 85 | this.fileFilter.filter(waitingProcessMap, propComp.getValue(MarkdownFileFilter.FILTER_KEY)); 86 | } 87 | 88 | // 有数据才执行后面的 handler 89 | return waitingProcessMap.size() > 0; 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/client/Client.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.client; 26 | 27 | import info.dong4j.idea.plugin.enums.CloudEnum; 28 | 29 | import java.lang.annotation.Documented; 30 | import java.lang.annotation.ElementType; 31 | import java.lang.annotation.Retention; 32 | import java.lang.annotation.RetentionPolicy; 33 | import java.lang.annotation.Target; 34 | 35 | /** 36 | *

Company: no company

37 | *

Description: 通过此注解标识不同的 oss 客户端

38 | * {@link info.dong4j.idea.plugin.util.ClientUtils} 39 | * 40 | * @author dong4j 41 | * @version 0.0.1 42 | * @email "mailto:dong4j@gmail.com" 43 | * @date 2019.03.22 17:17 44 | * @since 0.0.1 45 | */ 46 | @Target( {ElementType.TYPE}) 47 | @Retention(RetentionPolicy.RUNTIME) 48 | @Documented 49 | public @interface Client { 50 | /** 51 | * Value 52 | * 53 | * @return the cloud enum 54 | * @since 0.0.1 55 | */ 56 | CloudEnum value(); 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/content/ImageContents.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.content; 26 | 27 | /** 28 | *

Company: no company

29 | *

Description:

30 | * 31 | * @author dong4j 32 | * @version 0.0.1 33 | * @email "mailto:dong4j@gmail.com" 34 | * @date 2021.02.14 18:40 35 | * @since 0.0.1 36 | */ 37 | public interface ImageContents { 38 | /** IMAGE_TYPE_NAME */ 39 | String IMAGE_TYPE_NAME = "Image"; 40 | /** HTML_TAG_A_START */ 41 | String HTML_TAG_A_START = ""; 59 | /** LARG_IMAGE_MARK_ID */ 60 | String LARG_IMAGE_MARK_ID = LARG_IMAGE_MARK.substring(1, 23); 61 | /** 就一个 a 标签, 点击能在新页面查看图片 */ 62 | String COMMON_IMAGE_MARK = "" + DEFAULT_IMAGE_MARK + ""; 63 | /** COMMON_IMAGE_MARK_ID */ 64 | String COMMON_IMAGE_MARK_ID = COMMON_IMAGE_MARK.substring(1, 9); 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/content/MarkdownContents.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.content; 26 | 27 | /** 28 | *

Company: no company

29 | *

Description:

30 | * 31 | * @author dong4j 32 | * @version 0.0.1 33 | * @email "mailto:dong4j@gmail.com" 34 | * @date 2021.02.14 18:40 35 | * @since 0.0.1 36 | */ 37 | public interface MarkdownContents { 38 | /** markdown 文件后缀 */ 39 | String MARKDOWN_FILE_SUFIX = ".md"; 40 | /** markdown file type, 必须安装了 markdown 插件才能识别为此类型 */ 41 | String MARKDOWN_TYPE_NAME = "Markdown"; 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/content/MikContents.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.content; 26 | 27 | /** 28 | *

Company: no company

29 | *

Description: ${description}

30 | * 31 | * @author dong4j 32 | * @version 0.0.1 33 | * @email "mailto:dong4j@gmail.com" 34 | * @date 2019.03.27 12:26 35 | * @since 0.0.1 36 | */ 37 | public interface MikContents { 38 | /** nodejs 库 */ 39 | String NODE_MODULES_FILE = "node_modules"; 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/entity/EventData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.entity; 26 | 27 | import com.intellij.openapi.actionSystem.AnActionEvent; 28 | import com.intellij.openapi.editor.Document; 29 | import com.intellij.openapi.editor.Editor; 30 | import com.intellij.openapi.progress.ProgressIndicator; 31 | import com.intellij.openapi.project.Project; 32 | 33 | import info.dong4j.idea.plugin.client.OssClient; 34 | 35 | import java.util.List; 36 | import java.util.Map; 37 | 38 | import lombok.Data; 39 | import lombok.experimental.Accessors; 40 | 41 | /** 42 | *

Company: no company

43 | *

Description:

44 | * 45 | * @author dong4j 46 | * @version 0.0.1 47 | * @email "mailto:dong4j@gmail.com" 48 | * @date 2021.02.14 18:40 49 | * @since 0.0.1 50 | */ 51 | @Data 52 | @Accessors(chain = true) 53 | public class EventData { 54 | /** Action event */ 55 | private AnActionEvent actionEvent; 56 | /** 显示当前处理进度 */ 57 | private ProgressIndicator indicator; 58 | /** Project */ 59 | private Project project; 60 | /** Editor */ 61 | private Editor editor; 62 | /** Document */ 63 | private Document document; 64 | /** 待处理的数据 */ 65 | private Map> waitingProcessMap; 66 | /** 文件上传客户端 */ 67 | private OssClient client; 68 | /** client name */ 69 | private String clientName; 70 | /** chain size */ 71 | private int size; 72 | /** 当前执行的节点 */ 73 | private int index; 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/entity/HelpResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.entity; 26 | 27 | import java.io.Serializable; 28 | 29 | import lombok.Data; 30 | 31 | /** 32 | *

Company: no company

33 | *

Description:

34 | * 35 | * @author dong4j 36 | * @version 0.0.1 37 | * @email "mailto:dong4j@gmail.com" 38 | * @date 2021.02.14 18:40 39 | * @since 0.0.1 40 | */ 41 | @Data 42 | public class HelpResult implements Serializable { 43 | /** serialVersionUID */ 44 | private static final long serialVersionUID = 2341371341825471102L; 45 | /** Code */ 46 | private String code; 47 | /** Url */ 48 | private String url; 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/entity/MarkdownImage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.entity; 26 | 27 | import com.intellij.openapi.vfs.VirtualFile; 28 | 29 | import info.dong4j.idea.plugin.enums.ImageLocationEnum; 30 | import info.dong4j.idea.plugin.enums.ImageMarkEnum; 31 | 32 | import java.io.InputStream; 33 | import java.io.Serializable; 34 | 35 | import lombok.Data; 36 | 37 | /** 38 | *

Company: no company

39 | *

Description:

40 | * 41 | * @author dong4j 42 | * @version 0.0.1 43 | * @email "mailto:dong4j@gmail.com" 44 | * @date 2021.02.14 18:40 45 | * @since 0.0.1 46 | */ 47 | @Data 48 | public class MarkdownImage implements Serializable { 49 | /** serialVersionUID */ 50 | private static final long serialVersionUID = -533088989259774894L; 51 | 52 | /** 对应的 document name */ 53 | private String fileName; 54 | /** 图片名 */ 55 | private String imageName; 56 | /** 图片类型 */ 57 | private String extension; 58 | /** 原始行文本 */ 59 | private String originalLineText; 60 | /** markdown image mark */ 61 | private String originalMark; 62 | /** 行数 */ 63 | private int lineNumber; 64 | /** 行第一个字符偏移量 */ 65 | private int lineStartOffset; 66 | /** 行最后一个字符偏移量 */ 67 | private int lineEndOffset; 68 | /** 图片标题 */ 69 | private String title; 70 | /** 图片地址 (本地全路径, 网路 http/https) */ 71 | private String path; 72 | /** 图片位置 */ 73 | private ImageLocationEnum location; 74 | /** 文本标签类型 */ 75 | private ImageMarkEnum imageMarkType; 76 | /** 图片文件流 */ 77 | private InputStream inputStream; 78 | /** 最终需要插入到文本的标签 */ 79 | private String finalMark; 80 | /** 保存当前标签对应的 image file */ 81 | private VirtualFile virtualFile; 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/entity/SmmsResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.entity; 26 | 27 | import lombok.Data; 28 | 29 | /** 30 | *

Company: no company

31 | *

Description:

32 | * 33 | * @author dong4j 34 | * @version 0.0.1 35 | * @email "mailto:dong4j@gmail.com" 36 | * @date 2021.02.14 18:40 37 | * @since 0.0.1 38 | */ 39 | @Data 40 | public class SmmsResult { 41 | 42 | /** Code */ 43 | private String code; 44 | /** Data */ 45 | private DataBean data; 46 | /** Message */ 47 | private String message; 48 | 49 | /** 50 | *

Company: 成都返空汇网络技术有限公司

51 | *

Description:

52 | * 53 | * @author dong4j 54 | * @version 0.0.1 55 | * @email "mailto:dong4j@gmail.com" 56 | * @date 2021.02.14 18:40 57 | * @since 0.0.1 58 | */ 59 | @Data 60 | public static class DataBean { 61 | /** Width */ 62 | private int width; 63 | /** Height */ 64 | private int height; 65 | /** Filename */ 66 | private String filename; 67 | /** Storename */ 68 | private String storename; 69 | /** Size */ 70 | private int size; 71 | /** Path */ 72 | private String path; 73 | /** Hash */ 74 | private String hash; 75 | /** Timestamp */ 76 | private int timestamp; 77 | /** Url */ 78 | private String url; 79 | /** Delete */ 80 | private String delete; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/enums/HelpType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.enums; 26 | 27 | /** 28 | *

Company: no company

29 | *

Description: ${description}

30 | * 31 | * @author dong4j 32 | * @version 0.0.1 33 | * @email "mailto:dong4j@gmail.com" 34 | * @date 2019.03.25 14:15 35 | * @since 0.0.1 36 | */ 37 | public enum HelpType { 38 | /** Setting help type */ 39 | SETTING("setting"), 40 | /** Nottify help type */ 41 | NOTTIFY("notify"); 42 | 43 | /** Where */ 44 | public String where; 45 | 46 | /** 47 | * Help type 48 | * 49 | * @param where where 50 | * @since 0.0.1 51 | */ 52 | HelpType(String where) { 53 | this.where = where; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/enums/ImageLocationEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.enums; 26 | 27 | /** 28 | *

Company: no company

29 | *

Description: ${description}

30 | * 31 | * @author dong4j 32 | * @version 0.0.1 33 | * @email "mailto:dong4j@gmail.com" 34 | * @date 2019.03.15 18:07 35 | * @since 0.0.1 36 | */ 37 | public enum ImageLocationEnum { 38 | /** Local image location enum */ 39 | LOCAL, 40 | /** Network image location enum */ 41 | NETWORK 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/enums/ImageMarkEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.enums; 26 | 27 | import info.dong4j.idea.plugin.content.ImageContents; 28 | 29 | import org.jetbrains.annotations.Contract; 30 | 31 | /** 32 | *

Company: no company

33 | *

Description: ${description}

34 | * 35 | * @author dong4j 36 | * @version 0.0.1 37 | * @email "mailto:dong4j@gmail.com" 38 | * @date 2019.03.14 10:23 39 | * @since 0.0.1 40 | */ 41 | public enum ImageMarkEnum { 42 | /** Large picture image mark enum */ 43 | LARGE_PICTURE(1, "点击看大图", ImageContents.LARG_IMAGE_MARK), 44 | /** Common picture image mark enum */ 45 | COMMON_PICTURE(2, "正常的", ImageContents.COMMON_IMAGE_MARK), 46 | /** Custom image mark enum */ 47 | CUSTOM(3, "自定义", ""), 48 | /** Original image mark enum */ 49 | ORIGINAL(4, "原始", ImageContents.DEFAULT_IMAGE_MARK); 50 | 51 | /** Index */ 52 | public int index; 53 | /** Text */ 54 | public String text; 55 | /** Code */ 56 | public String code; 57 | 58 | /** 59 | * Image mark enum 60 | * 61 | * @param index index 62 | * @param text text 63 | * @param code code 64 | * @since 0.0.1 65 | */ 66 | ImageMarkEnum(int index, String text, String code) { 67 | this.index = index; 68 | this.text = text; 69 | this.code = code; 70 | } 71 | 72 | /** 73 | * Gets index * 74 | * 75 | * @return the index 76 | * @since 0.0.1 77 | */ 78 | @Contract(pure = true) 79 | public int getIndex() { 80 | return this.index; 81 | } 82 | 83 | /** 84 | * Gets text * 85 | * 86 | * @return the text 87 | * @since 0.0.1 88 | */ 89 | @Contract(pure = true) 90 | public String getText() { 91 | return this.text; 92 | } 93 | 94 | /** 95 | * Gets code * 96 | * 97 | * @return the code 98 | * @since 0.0.1 99 | */ 100 | @Contract(pure = true) 101 | public String getCode() { 102 | return this.code; 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/enums/InsertEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.enums; 26 | 27 | /** 28 | *

Company: no company

29 | *

Description: 标签插入的位置

30 | * 31 | * @author dong4j 32 | * @version 0.0.1 33 | * @email "mailto:dong4j@gmail.com" 34 | * @date 2019.03.26 16:10 35 | * @since 0.0.1 36 | */ 37 | public enum InsertEnum { 38 | /** 右键图片直接上传后插入到 clipboard */ 39 | CLIPBOADR, 40 | /** paste 操作时 */ 41 | DOCUMENT, 42 | /** quickfix alt + enter */ 43 | INTENTION 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/enums/RegionEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.enums; 26 | 27 | import com.qiniu.common.Zone; 28 | 29 | import org.jetbrains.annotations.Contract; 30 | 31 | /** 32 | *

Company: no company

33 | *

Description: 腾讯云存储位置

34 | * 35 | * @author dong4j 36 | * @version 0.0.1 37 | * @email "mailto:dong4j@gmail.com" 38 | * @date 2021.02.14 18:40 39 | * @since 0.0.1 40 | */ 41 | public enum RegionEnum { 42 | /** East china region enum */ 43 | // 区域名称:z0 华东 z1 华北 z2 华南 na0 北美 as0 东南亚 44 | EAST_CHINA(0, "华东", Zone.zone0()), 45 | /** Nort china region enum */ 46 | NORT_CHINA(1, "华北", Zone.zone1()), 47 | /** South china region enum */ 48 | SOUTH_CHINA(2, "华南", Zone.zone2()), 49 | /** North ameria region enum */ 50 | NORTH_AMERIA(3, "北美", Zone.zoneNa0()), 51 | /** Southeast asia region enum */ 52 | SOUTHEAST_ASIA(4, "东南亚", Zone.zoneAs0()); 53 | 54 | /** Index */ 55 | public int index; 56 | /** Name */ 57 | public String name; 58 | /** Zone */ 59 | public Zone zone; 60 | 61 | /** 62 | * Region enum 63 | * 64 | * @param index index 65 | * @param name name 66 | * @param zone zone 67 | * @since 0.0.1 68 | */ 69 | RegionEnum(int index, String name, Zone zone) { 70 | this.index = index; 71 | this.name = name; 72 | this.zone = zone; 73 | } 74 | 75 | /** 76 | * Gets index * 77 | * 78 | * @return the index 79 | * @since 0.0.1 80 | */ 81 | @Contract(pure = true) 82 | public int getIndex() { 83 | return this.index; 84 | } 85 | 86 | /** 87 | * Gets name * 88 | * 89 | * @return the name 90 | * @since 0.0.1 91 | */ 92 | @Contract(pure = true) 93 | public String getName() { 94 | return this.name; 95 | } 96 | 97 | /** 98 | * Gets zone * 99 | * 100 | * @return the zone 101 | * @since 0.0.1 102 | */ 103 | @Contract(pure = true) 104 | public Zone getZone() { 105 | return this.zone; 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/enums/SuffixEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.enums; 26 | 27 | import org.jetbrains.annotations.Contract; 28 | 29 | /** 30 | *

Company: no company

31 | *

Description:

32 | * 33 | * @author dong4j 34 | * @version 0.0.1 35 | * @email "mailto:dong4j@gmail.com" 36 | * @date 2019.03.17 01:21 37 | * @since 0.0.1 38 | */ 39 | public enum SuffixEnum { 40 | /** File name suffix enum */ 41 | FILE_NAME(0, "文件名"), 42 | /** Date file name suffix enum */ 43 | DATE_FILE_NAME(1, "日期-文件名"), 44 | /** Random suffix enum */ 45 | RANDOM(2, "随机"); 46 | 47 | /** Index */ 48 | public int index; 49 | /** Name */ 50 | public String name; 51 | 52 | /** 53 | * Suffix enum 54 | * 55 | * @param index index 56 | * @param name name 57 | * @since 0.0.1 58 | */ 59 | SuffixEnum(int index, String name) { 60 | this.index = index; 61 | this.name = name; 62 | } 63 | 64 | /** 65 | * Gets index * 66 | * 67 | * @return the index 68 | * @since 0.0.1 69 | */ 70 | @Contract(pure = true) 71 | public int getIndex() { 72 | return this.index; 73 | } 74 | 75 | /** 76 | * Gets name * 77 | * 78 | * @return the name 79 | * @since 0.0.1 80 | */ 81 | @Contract(pure = true) 82 | public String getName() { 83 | return this.name; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/enums/UploadWayEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.enums; 26 | 27 | /** 28 | * The enum Upload way enum. 29 | * 30 | * @author dong4j 31 | * @version 0.0.1 32 | * @email "mailto:dong4j@gmail.com" 33 | * @date 2021.02.14 18:40 34 | * @since 0.0.1 35 | */ 36 | enum UploadWayEnum { 37 | /** 测试按钮 */ 38 | FROM_TEST, 39 | /** 右键上传 */ 40 | FROM_ACTION, 41 | /** clipboard 监听 */ 42 | FROM_PASTE 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/enums/ZoneEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.enums; 26 | 27 | import com.qiniu.common.Zone; 28 | 29 | import org.jetbrains.annotations.Contract; 30 | 31 | /** 32 | *

Company: no company

33 | *

Description: 七牛云存储位置

34 | * 35 | * @author dong4j 36 | * @version 0.0.1 37 | * @email "mailto:dong4j@gmail.com" 38 | * @date 2019.03.19 20:26 39 | * @since 0.0.1 40 | */ 41 | public enum ZoneEnum { 42 | /** East china zone enum */ 43 | // 区域名称:z0 华东 z1 华北 z2 华南 na0 北美 as0 东南亚 44 | EAST_CHINA(0, "华东", Zone.zone0()), 45 | /** Nort china zone enum */ 46 | NORT_CHINA(1, "华北", Zone.zone1()), 47 | /** South china zone enum */ 48 | SOUTH_CHINA(2, "华南", Zone.zone2()), 49 | /** North ameria zone enum */ 50 | NORTH_AMERIA(3, "北美", Zone.zoneNa0()), 51 | /** Southeast asia zone enum */ 52 | SOUTHEAST_ASIA(4, "东南亚", Zone.zoneAs0()); 53 | 54 | /** Index */ 55 | public int index; 56 | /** Name */ 57 | public String name; 58 | /** Zone */ 59 | public Zone zone; 60 | 61 | /** 62 | * Zone enum 63 | * 64 | * @param index index 65 | * @param name name 66 | * @param zone zone 67 | * @since 0.0.1 68 | */ 69 | ZoneEnum(int index, String name, Zone zone) { 70 | this.index = index; 71 | this.name = name; 72 | this.zone = zone; 73 | } 74 | 75 | /** 76 | * Gets index * 77 | * 78 | * @return the index 79 | * @since 0.0.1 80 | */ 81 | @Contract(pure = true) 82 | public int getIndex() { 83 | return this.index; 84 | } 85 | 86 | /** 87 | * Gets name * 88 | * 89 | * @return the name 90 | * @since 0.0.1 91 | */ 92 | @Contract(pure = true) 93 | public String getName() { 94 | return this.name; 95 | } 96 | 97 | /** 98 | * Gets zone * 99 | * 100 | * @return the zone 101 | * @since 0.0.1 102 | */ 103 | @Contract(pure = true) 104 | public Zone getZone() { 105 | return this.zone; 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/icon/MikIcons.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.icon; 26 | 27 | import com.intellij.openapi.util.IconLoader; 28 | 29 | import org.jetbrains.annotations.NotNull; 30 | 31 | import javax.swing.Icon; 32 | 33 | /** 34 | *

Company: no company

35 | *

Description: {@link com.intellij.icons.AllIcons}

36 | * 37 | * @author dong4j 38 | * @version 0.0.1 39 | * @email "mailto:dong4j@gmail.com" 40 | * @date 2019.03.13 21:10 41 | * @since 0.0.1 42 | */ 43 | public class MikIcons { 44 | /** ALIYUN_OSS */ 45 | public static final Icon ALIYUN_OSS = IconLoader.getIcon("/icons/aliyun.png"); 46 | /** QINIU_OSS */ 47 | public static final Icon QINIU_OSS = IconLoader.getIcon("/icons/qiniu.png"); 48 | /** WEIBO_OSS */ 49 | public static final Icon WEIBO_OSS = IconLoader.getIcon("/icons/weibo.png"); 50 | /** COMPRESS */ 51 | public static final Icon COMPRESS = IconLoader.getIcon("/icons/compress.png"); 52 | /** MOVE */ 53 | public static final Icon MOVE = IconLoader.getIcon("/icons/move.png"); 54 | /** WANGYI */ 55 | public static final Icon WANGYI = IconLoader.getIcon("/icons/wangyi.png"); 56 | /** BAIDU */ 57 | public static final Icon BAIDU = IconLoader.getIcon("/icons/baidu.png"); 58 | /** IMGUR */ 59 | public static final Icon IMGUR = IconLoader.getIcon("/icons/imgur.png"); 60 | /** SM_MS */ 61 | public static final Icon SM_MS = IconLoader.getIcon("/icons/sm_ms.png"); 62 | /** YOUPAI */ 63 | public static final Icon YOUPAI = IconLoader.getIcon("/icons/youpai.png"); 64 | /** JINGDONG */ 65 | public static final Icon JINGDONG = IconLoader.getIcon("/icons/jingdong.png"); 66 | /** GITHUB */ 67 | public static final Icon GITHUB = IconLoader.getIcon("/icons/github.png"); 68 | 69 | /** 70 | * Load 71 | * 72 | * @param path path 73 | * @return the icon 74 | * @since 0.0.1 75 | */ 76 | @NotNull 77 | private static Icon load(String path) { 78 | return IconLoader.getIcon(path, MikIcons.class); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/settings/AbstractExtendOssState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.settings; 26 | 27 | import lombok.Data; 28 | import lombok.EqualsAndHashCode; 29 | import lombok.NoArgsConstructor; 30 | 31 | /** 32 | *

Company: 成都返空汇网络技术有限公司

33 | *

Description:

34 | * 35 | * @author dong4j 36 | * @version 1.0.0 37 | * @email "mailto:dong4j@fkhwl.com" 38 | * @date 2021.02.16 13:16 39 | * @since 1.1.0 40 | */ 41 | @Data 42 | @NoArgsConstructor 43 | @EqualsAndHashCode(callSuper = true) 44 | public abstract class AbstractExtendOssState extends OssState { 45 | 46 | /** Endpoint */ 47 | private String endpoint = ""; 48 | /** Access key */ 49 | private String accessKey = ""; 50 | /** Access secret key */ 51 | private String accessSecretKey = ""; 52 | /** Bucket name */ 53 | private String bucketName = ""; 54 | /** Filedir */ 55 | private String filedir = ""; 56 | /** Custom endpoint */ 57 | private String customEndpoint = ""; 58 | /** Is custom endpoint */ 59 | private Boolean isCustomEndpoint = false; 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/settings/AliyunOssState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.settings; 26 | 27 | import lombok.Data; 28 | import lombok.EqualsAndHashCode; 29 | import lombok.NoArgsConstructor; 30 | 31 | /** 32 | *

Company: no company

33 | *

Description:

34 | * 35 | * @author dong4j 36 | * @version 0.0.1 37 | * @email "mailto:dong4j@gmail.com" 38 | * @date 2019.03.19 19:55 39 | * @since 0.0.1 40 | */ 41 | @Data 42 | @NoArgsConstructor 43 | @EqualsAndHashCode(callSuper = true) 44 | public class AliyunOssState extends AbstractExtendOssState { 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/settings/BaiduBosState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.settings; 26 | 27 | import lombok.Data; 28 | import lombok.EqualsAndHashCode; 29 | import lombok.NoArgsConstructor; 30 | 31 | /** 32 | *

Company: no company

33 | *

Description:

34 | * 35 | * @author dong4j 36 | * @version 0.0.1 37 | * @email "mailto:dong4j@gmail.com" 38 | * @date 2019.03.19 19:55 39 | * @since 0.0.1 40 | */ 41 | @Data 42 | @NoArgsConstructor 43 | @EqualsAndHashCode(callSuper = true) 44 | public class BaiduBosState extends AbstractExtendOssState { 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/settings/GithubOssState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.settings; 26 | 27 | import lombok.Data; 28 | import lombok.EqualsAndHashCode; 29 | import lombok.NoArgsConstructor; 30 | 31 | /** 32 | *

Company: 成都返空汇网络技术有限公司

33 | *

Description:

34 | * 35 | * @author dong4j 36 | * @version 1.0.0 37 | * @email "mailto:dong4j@fkhwl.com" 38 | * @date 2021.02.16 20:49 39 | * @since 1.3.0 40 | */ 41 | @Data 42 | @NoArgsConstructor 43 | @EqualsAndHashCode(callSuper = true) 44 | public class GithubOssState extends OssState { 45 | 46 | /** Endpoint */ 47 | private String repos = ""; 48 | /** Access key */ 49 | private String branch = ""; 50 | /** Access secret key */ 51 | private String token = ""; 52 | /** Filedir */ 53 | private String filedir = ""; 54 | /** Custom endpoint */ 55 | private String customEndpoint = ""; 56 | /** Is custom endpoint */ 57 | private Boolean isCustomEndpoint = false; 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/settings/MikPersistenComponent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.settings; 26 | 27 | import com.intellij.openapi.components.PersistentStateComponent; 28 | import com.intellij.openapi.components.ServiceManager; 29 | import com.intellij.openapi.components.State; 30 | import com.intellij.openapi.components.Storage; 31 | 32 | import org.jetbrains.annotations.NotNull; 33 | 34 | import lombok.extern.slf4j.Slf4j; 35 | 36 | /** 37 | *

Company: no company

38 | *

Description: 配置持久化

39 | * 40 | * @author dong4j 41 | * @version 0.0.1 42 | * @email "mailto:dong4j@gmail.com" 43 | * @date 2019.03.13 11:56 44 | * @since 0.0.1 45 | */ 46 | @Slf4j 47 | @State(name = "MikSettings", storages = @Storage("markdown.image.kit.configs.xml")) 48 | public class MikPersistenComponent implements PersistentStateComponent { 49 | 50 | /** My state */ 51 | private MikState myState = new MikState(); 52 | 53 | /** 54 | * Get the instance of this service. 55 | * 56 | * @return the unique {@link MikPersistenComponent} instance. 57 | * @since 0.0.1 58 | */ 59 | public static MikPersistenComponent getInstance() { 60 | return ServiceManager.getService(MikPersistenComponent.class); 61 | } 62 | 63 | /** 64 | * Gets state * 65 | * 66 | * @return the state 67 | * @since 0.0.1 68 | */ 69 | @NotNull 70 | @Override 71 | public MikState getState() { 72 | return this.myState; 73 | } 74 | 75 | /** 76 | * Load state 77 | * 78 | * @param state state 79 | * @since 0.0.1 80 | */ 81 | @Override 82 | public void loadState(@NotNull MikState state) { 83 | this.myState = state; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/settings/NumberValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.settings; 26 | 27 | import javax.swing.text.AttributeSet; 28 | import javax.swing.text.PlainDocument; 29 | 30 | /** 31 | *

Company: no company

32 | *

Description: 限制输入数字的位数

33 | * 34 | * @author dong4j 35 | * @version 0.0.1 36 | * @email "mailto:dong4j@gmail.com" 37 | * @date 2019.03.14 20:00 38 | * @since 0.0.1 39 | */ 40 | public class NumberValidator extends PlainDocument { 41 | 42 | /** serialVersionUID */ 43 | private static final long serialVersionUID = 1L; 44 | 45 | /** Limit */ 46 | private final int limit; 47 | 48 | /** 49 | * Number validator 50 | * 51 | * @param limit limit 52 | * @since 0.0.1 53 | */ 54 | public NumberValidator(int limit) { 55 | super(); 56 | this.limit = limit; 57 | } 58 | 59 | /** 60 | * Insert string 61 | * 62 | * @param offset offset 63 | * @param str str 64 | * @param attr attr 65 | * @throws BadLocationException bad location exception 66 | * @since 0.0.1 67 | */ 68 | @Override 69 | public void insertString(int offset, String str, AttributeSet attr) 70 | throws javax.swing.text.BadLocationException { 71 | if (str == null) { 72 | return; 73 | } 74 | if ((this.getLength() + str.length()) <= this.limit) { 75 | char[] upper = str.toCharArray(); 76 | int length = 0; 77 | for (int i = 0; i < upper.length; i++) { 78 | if (upper[i] >= '0' && upper[i] <= '9') { 79 | upper[length++] = upper[i]; 80 | } 81 | } 82 | // 插入数字 83 | super.insertString(offset, new String(upper, 0, length), attr); 84 | } 85 | } 86 | 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/settings/QiniuOssState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.settings; 26 | 27 | import info.dong4j.idea.plugin.enums.ZoneEnum; 28 | 29 | import lombok.Data; 30 | import lombok.EqualsAndHashCode; 31 | import lombok.NoArgsConstructor; 32 | 33 | /** 34 | *

Company: no company

35 | *

Description:

36 | * 37 | * @author dong4j 38 | * @version 0.0.1 39 | * @email "mailto:dong4j@gmail.com" 40 | * @date 2019.03.19 19:55 41 | * @since 0.0.1 42 | */ 43 | @EqualsAndHashCode(callSuper = true) 44 | @Data 45 | @NoArgsConstructor 46 | public class QiniuOssState extends OssState { 47 | /** Endpoint */ 48 | private String endpoint = ""; 49 | /** Access key */ 50 | private String accessKey = ""; 51 | /** Access secret key */ 52 | private String accessSecretKey = ""; 53 | /** Bucket name */ 54 | private String bucketName = ""; 55 | /** Zone index */ 56 | private int zoneIndex = ZoneEnum.EAST_CHINA.index; 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/settings/TencentOssState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.settings; 26 | 27 | import lombok.Data; 28 | import lombok.EqualsAndHashCode; 29 | import lombok.NoArgsConstructor; 30 | 31 | /** 32 | *

Company: no company

33 | *

Description:

34 | * 35 | * @author dong4j 36 | * @version 0.0.1 37 | * @email "mailto:dong4j@gmail.com" 38 | * @date 2021.02.14 18:40 39 | * @since 0.0.1 40 | */ 41 | @EqualsAndHashCode(callSuper = true) 42 | @Data 43 | @NoArgsConstructor 44 | public class TencentOssState extends OssState{ 45 | /** Access key */ 46 | private String accessKey = ""; 47 | /** Secret key */ 48 | private String secretKey = ""; 49 | /** Bucket name */ 50 | private String bucketName = ""; 51 | /** Region name */ 52 | private String regionName = ""; 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/settings/WeiboOssState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.settings; 26 | 27 | import lombok.Data; 28 | import lombok.EqualsAndHashCode; 29 | import lombok.NoArgsConstructor; 30 | 31 | /** 32 | *

Company: no company

33 | *

Description:

34 | * 35 | * @author dong4j 36 | * @version 0.0.1 37 | * @email "mailto:dong4j@gmail.com" 38 | * @date 2019.03.19 19:56 39 | * @since 0.0.1 40 | */ 41 | @EqualsAndHashCode(callSuper = true) 42 | @Data 43 | @NoArgsConstructor 44 | public class WeiboOssState extends OssState { 45 | /** User name */ 46 | private String userName = ""; 47 | /** Password */ 48 | private String password = ""; 49 | /** Cookies */ 50 | private String cookies = ""; 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/swing/JTextFieldHintListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.swing; 26 | 27 | import com.intellij.ui.JBColor; 28 | 29 | import java.awt.event.FocusEvent; 30 | import java.awt.event.FocusListener; 31 | 32 | import javax.swing.JTextField; 33 | 34 | /** 35 | *

Company: no company

36 | *

Description:

37 | * 38 | * @author dong4j 39 | * @version 0.0.1 40 | * @email "mailto:dong4j@gmail.com" 41 | * @date 2019.03.14 10:38 42 | * @since 0.0.1 43 | */ 44 | public class JTextFieldHintListener implements FocusListener { 45 | /** Hint text */ 46 | private final String hintText; 47 | /** Text field */ 48 | private final JTextField textField; 49 | 50 | /** 51 | * J text field hint listener 52 | * 53 | * @param jTextField j text field 54 | * @param hintText hint text 55 | * @since 0.0.1 56 | */ 57 | public JTextFieldHintListener(JTextField jTextField, String hintText) { 58 | this.textField = jTextField; 59 | this.hintText = hintText; 60 | // 默认直接显示 61 | jTextField.setText(hintText); 62 | jTextField.setForeground(JBColor.GRAY); 63 | } 64 | 65 | /** 66 | * 焦点获得 67 | * 68 | * @param e e 69 | * @since 0.0.1 70 | */ 71 | @Override 72 | public void focusGained(FocusEvent e) { 73 | // 获取焦点时,清空提示内容 74 | String temp = this.textField.getText(); 75 | if (temp.equals(this.hintText)) { 76 | this.textField.setText(""); 77 | this.textField.setForeground(JBColor.BLACK); 78 | } 79 | } 80 | 81 | /** 82 | * 焦点失去 83 | * 84 | * @param e e 85 | * @since 0.0.1 86 | */ 87 | @Override 88 | public void focusLost(FocusEvent e) { 89 | // 失去焦点时,没有输入内容,显示提示内容 90 | String temp = this.textField.getText(); 91 | if ("".equals(temp)) { 92 | this.textField.setForeground(JBColor.GRAY); 93 | this.textField.setText(this.hintText); 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/task/ActionTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.task; 26 | 27 | import com.intellij.openapi.project.Project; 28 | 29 | import info.dong4j.idea.plugin.chain.ActionManager; 30 | 31 | import org.jetbrains.annotations.Nls; 32 | import org.jetbrains.annotations.NotNull; 33 | import org.jetbrains.annotations.Nullable; 34 | 35 | import lombok.extern.slf4j.Slf4j; 36 | 37 | /** 38 | *

Company: no company

39 | *

Description: 右键,toolbar 上传到指定 OSS

40 | * 41 | * @author dong4j 42 | * @version 0.0.1 43 | * @email "mailto:dong4j@gmail.com" 44 | * @date 2021.02.14 18:40 45 | * @since 0.0.1 46 | */ 47 | @Slf4j 48 | public class ActionTask extends MikTaskBase { 49 | 50 | /** 51 | * Action task 52 | * 53 | * @param project project 54 | * @param title title 55 | * @param manager manager 56 | * @since 0.0.1 57 | */ 58 | public ActionTask(@Nullable Project project, 59 | @Nls(capitalization = Nls.Capitalization.Title) @NotNull String title, 60 | ActionManager manager) { 61 | super(project, title, manager); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/util/EnumsUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.util; 26 | 27 | import java.util.Arrays; 28 | import java.util.Map; 29 | import java.util.Optional; 30 | import java.util.concurrent.ConcurrentHashMap; 31 | import java.util.function.Predicate; 32 | 33 | import lombok.extern.slf4j.Slf4j; 34 | 35 | /** 36 | *

Company: no company

37 | *

Description:

38 | * 39 | * @author dong4j 40 | * @version 0.0.1 41 | * @email "mailto:dong4j@gmail.com" 42 | * @date 2019.03.13 16:00 43 | * @since 0.0.1 44 | */ 45 | @Slf4j 46 | @SuppressWarnings("unchecked") 47 | public final class EnumsUtils { 48 | /** map */ 49 | private static final Map map = new ConcurrentHashMap<>(); 50 | 51 | /** 52 | * 根据条件获取枚举对象 53 | * 54 | * @param the type parameter 55 | * @param className 枚举类 56 | * @param predicate 筛选条件 57 | * @return enum object 58 | * @since 0.0.1 59 | */ 60 | public static Optional getEnumObject(Class className, Predicate predicate) { 61 | if (!className.isEnum()) { 62 | log.info("Class 不是枚举类"); 63 | return Optional.empty(); 64 | } 65 | Object obj = map.get(className); 66 | T[] ts; 67 | if (obj == null) { 68 | ts = className.getEnumConstants(); 69 | map.put(className, ts); 70 | } else { 71 | ts = (T[]) obj; 72 | } 73 | return Arrays.stream(ts).filter(predicate).findAny(); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/util/date/DateFormatUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | // 26 | // Source code recreated from a .class file by IntelliJ IDEA 27 | // (powered by FernFlower decompiler) 28 | // 29 | 30 | package info.dong4j.idea.plugin.util.date; 31 | 32 | import java.util.Date; 33 | import java.util.Locale; 34 | import java.util.TimeZone; 35 | 36 | /** 37 | *

Company: 成都返空汇网络技术有限公司

38 | *

Description:

39 | * 40 | * @author dong4j 41 | * @version 1.0.0 42 | * @email "mailto:dong4j@gmail.com" 43 | * @date 2021.02.14 23:15 44 | * @since 1.1.0 45 | */ 46 | public class DateFormatUtils { 47 | /** SMTP_DATETIME_FORMAT */ 48 | public static final FastDateFormat SMTP_DATETIME_FORMAT; 49 | 50 | /** 51 | * Date format utils 52 | * 53 | * @since 1.1.0 54 | */ 55 | public DateFormatUtils() { 56 | } 57 | 58 | /** 59 | * Format 60 | * 61 | * @param date date 62 | * @param pattern pattern 63 | * @return the string 64 | * @since 1.1.0 65 | */ 66 | public static String format(Date date, String pattern) { 67 | return format(date, pattern, null, null); 68 | } 69 | 70 | /** 71 | * Format 72 | * 73 | * @param date date 74 | * @param pattern pattern 75 | * @param timeZone time zone 76 | * @param locale locale 77 | * @return the string 78 | * @since 1.1.0 79 | */ 80 | public static String format(Date date, String pattern, TimeZone timeZone, Locale locale) { 81 | FastDateFormat df = FastDateFormat.getInstance(pattern, timeZone, locale); 82 | return df.format(date); 83 | } 84 | 85 | static { 86 | SMTP_DATETIME_FORMAT = FastDateFormat.getInstance("EEE, dd MMM yyyy HH:mm:ss Z", Locale.US); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/util/digest/HmacAlgorithms.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | // 26 | // Source code recreated from a .class file by IntelliJ IDEA 27 | // (powered by FernFlower decompiler) 28 | // 29 | 30 | package info.dong4j.idea.plugin.util.digest; 31 | 32 | /** 33 | *

Company: 成都返空汇网络技术有限公司

34 | *

Description:

35 | * 36 | * @author dong4j 37 | * @version 1.0.0 38 | * @email "mailto:dong4j@gmail.com" 39 | * @date 2021.02.14 23:45 40 | * @since 1.1.0 41 | */ 42 | public enum HmacAlgorithms { 43 | /** Hmac md 5 hmac algorithms */ 44 | HMAC_MD5("HmacMD5"), 45 | /** Hmac sha 1 hmac algorithms */ 46 | HMAC_SHA_1("HmacSHA1"), 47 | /** Hmac sha 256 hmac algorithms */ 48 | HMAC_SHA_256("HmacSHA256"), 49 | /** Hmac sha 384 hmac algorithms */ 50 | HMAC_SHA_384("HmacSHA384"), 51 | /** Hmac sha 512 hmac algorithms */ 52 | HMAC_SHA_512("HmacSHA512"); 53 | 54 | /** Algorithm */ 55 | private final String algorithm; 56 | 57 | /** 58 | * Hmac algorithms 59 | * 60 | * @param algorithm algorithm 61 | * @since 1.1.0 62 | */ 63 | HmacAlgorithms(String algorithm) { 64 | this.algorithm = algorithm; 65 | } 66 | 67 | /** 68 | * To string 69 | * 70 | * @return the string 71 | * @since 1.1.0 72 | */ 73 | @Override 74 | public String toString() { 75 | return this.algorithm; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/weibo/UploadRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.weibo; 26 | 27 | import java.io.File; 28 | import java.io.IOException; 29 | 30 | /** 31 | *

Description:

32 | * 33 | * @author echisan 34 | * @version 0.0.1 35 | * @email "mailto:dong4j@gmail.com" 36 | * @date 2018.06.14 22:31 37 | * @update dong4j 38 | * @since 0.0.1 39 | */ 40 | public interface UploadRequest { 41 | 42 | /** 43 | * Upload upload response. 44 | * 45 | * @param image the image 46 | * @return the upload response 47 | * @throws IOException the io exception 48 | * @since 0.0.1 49 | */ 50 | UploadResponse upload(File image) throws IOException; 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/weibo/UploadRequestBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.weibo; 26 | 27 | import info.dong4j.idea.plugin.util.StringUtils; 28 | import info.dong4j.idea.plugin.weibo.http.DefaultWbpHttpRequest; 29 | import info.dong4j.idea.plugin.weibo.http.WbpHttpRequest; 30 | 31 | /** 32 | *

Description:

33 | * 34 | * @author echisan 35 | * @version 0.0.1 36 | * @email "mailto:dong4j@gmail.com" 37 | * @date 2018.06.14 22:31 38 | * @update dong4j 39 | * @since 0.0.1 40 | */ 41 | public class UploadRequestBuilder { 42 | /** Username */ 43 | private String username; 44 | /** Password */ 45 | private String password; 46 | 47 | /** 48 | * Sets acount. 49 | * 50 | * @param username the username 51 | * @param password the password 52 | * @return the acount 53 | * @since 0.0.1 54 | */ 55 | public UploadRequestBuilder setAcount(String username, String password) { 56 | this.username = username; 57 | this.password = password; 58 | return this; 59 | } 60 | 61 | /** 62 | * Build wbp upload request. 63 | * 64 | * @return the wbp upload request 65 | * @since 0.0.1 66 | */ 67 | public WbpUploadRequest build() throws Exception { 68 | WbpHttpRequest request = new DefaultWbpHttpRequest(); 69 | if (StringUtils.isBlank(this.username)) { 70 | throw new IllegalArgumentException("用户名不能为空!"); 71 | } 72 | if (StringUtils.isBlank(this.password)) { 73 | throw new IllegalArgumentException("密码不能为空!"); 74 | } 75 | return new WbpUploadRequest(request, this.username, this.password); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/weibo/UploadResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.weibo; 26 | 27 | import info.dong4j.idea.plugin.weibo.entity.ImageInfo; 28 | 29 | /** 30 | *

Description:

31 | * 32 | * @author echisan 33 | * @version 0.0.1 34 | * @email "mailto:dong4j@gmail.com" 35 | * @date 2018.06.14 22:31 36 | * @update dong4j 37 | * @since 0.0.1 38 | */ 39 | public interface UploadResponse { 40 | 41 | /** 42 | * Gets result. 43 | * 44 | * @return the result 45 | * @since 0.0.1 46 | */ 47 | ResultStatus getResult(); 48 | 49 | /** 50 | * Sets result. 51 | * 52 | * @param rs the rs 53 | * @since 0.0.1 54 | */ 55 | void setResult(ResultStatus rs); 56 | 57 | /** 58 | * Gets message. 59 | * 60 | * @return the message 61 | * @since 0.0.1 62 | */ 63 | String getMessage(); 64 | 65 | /** 66 | * Sets message. 67 | * 68 | * @param message the message 69 | * @since 0.0.1 70 | */ 71 | void setMessage(String message); 72 | 73 | /** 74 | * Gets image info. 75 | * 76 | * @return the image info 77 | * @since 0.0.1 78 | */ 79 | ImageInfo getImageInfo(); 80 | 81 | /** 82 | * Sets image info. 83 | * 84 | * @param imageInfo the image info 85 | * @since 0.0.1 86 | */ 87 | void setImageInfo(ImageInfo imageInfo); 88 | 89 | /** 90 | * The enum Result status. 91 | * 92 | * @author dong4j 93 | * @version 0.0.1 94 | * @email "mailto:dong4j@gmail.com" 95 | * @date 2021.02.14 18:40 96 | * @since 0.0.1 97 | */ 98 | enum ResultStatus { 99 | /** 100 | * Success result status. 101 | */ 102 | SUCCESS, 103 | /** 104 | * Failed result status. 105 | */ 106 | FAILED 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/weibo/WbpUploadResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.weibo; 26 | 27 | import info.dong4j.idea.plugin.weibo.entity.ImageInfo; 28 | 29 | /** 30 | *

Description:

31 | * 32 | * @author echisan 33 | * @version 0.0.1 34 | * @email "mailto:dong4j@gmail.com" 35 | * @date 2018.06.14 22:31 36 | * @update dong4j 37 | * @since 0.0.1 38 | */ 39 | public class WbpUploadResponse implements UploadResponse { 40 | /** Result status */ 41 | private ResultStatus resultStatus; 42 | /** Message */ 43 | private String message; 44 | /** Image info */ 45 | private ImageInfo imageInfo; 46 | 47 | /** 48 | * Gets result * 49 | * 50 | * @return the result 51 | * @since 0.0.1 52 | */ 53 | @Override 54 | public ResultStatus getResult() { 55 | return this.resultStatus; 56 | } 57 | 58 | /** 59 | * Sets result * 60 | * 61 | * @param rs rs 62 | * @since 0.0.1 63 | */ 64 | @Override 65 | public void setResult(ResultStatus rs) { 66 | this.resultStatus = rs; 67 | } 68 | 69 | /** 70 | * Gets message * 71 | * 72 | * @return the message 73 | * @since 0.0.1 74 | */ 75 | @Override 76 | public String getMessage() { 77 | return this.message; 78 | } 79 | 80 | /** 81 | * Sets message * 82 | * 83 | * @param message message 84 | * @since 0.0.1 85 | */ 86 | @Override 87 | public void setMessage(String message) { 88 | this.message = message; 89 | } 90 | 91 | /** 92 | * Gets image info * 93 | * 94 | * @return the image info 95 | * @since 0.0.1 96 | */ 97 | @Override 98 | public ImageInfo getImageInfo() { 99 | return this.imageInfo; 100 | } 101 | 102 | /** 103 | * Sets image info * 104 | * 105 | * @param imageInfo image info 106 | * @since 0.0.1 107 | */ 108 | @Override 109 | public void setImageInfo(ImageInfo imageInfo) { 110 | this.imageInfo = imageInfo; 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/weibo/entity/ImageInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.weibo.entity; 26 | 27 | import lombok.Data; 28 | 29 | /** 30 | *

Description:

31 | * 32 | * @author echisan 33 | * @version 0.0.1 34 | * @email "mailto:dong4j@gmail.com" 35 | * @date 2018.06.14 22:31 36 | * @update dong4j 37 | * @since 0.0.1 38 | */ 39 | @Data 40 | public class ImageInfo { 41 | /** 照片id */ 42 | private String pid; 43 | /** 宽度 */ 44 | private Integer width; 45 | /** 长度 */ 46 | private Integer height; 47 | /** 大小 */ 48 | private Integer size; 49 | /** 原图url */ 50 | private String large; 51 | /** 中等尺寸 */ 52 | private String middle; 53 | /** 缩略图 */ 54 | private String small; 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/weibo/entity/PreLogin.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.weibo.entity; 26 | 27 | import lombok.Data; 28 | 29 | /** 30 | *

Description:

31 | * 32 | * @author echisan 33 | * @version 0.0.1 34 | * @email "mailto:dong4j@gmail.com" 35 | * @date 2018.06.14 22:31 36 | * @update dong4j 37 | * @since 0.0.1 38 | */ 39 | @Data 40 | public class PreLogin { 41 | /** Retcode */ 42 | private Integer retcode; 43 | /** Servertime */ 44 | private Long servertime; 45 | /** Pcid */ 46 | private String pcid; 47 | /** Nonce */ 48 | private String nonce; 49 | /** Pubkey */ 50 | private String pubkey; 51 | /** Rsakv */ 52 | private String rsakv; 53 | /** Is openlock */ 54 | private Integer is_openlock; 55 | /** Showpin */ 56 | private Integer showpin; 57 | /** Exectime */ 58 | private Integer exectime; 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/weibo/entity/UploadResp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.weibo.entity; 26 | 27 | import lombok.Data; 28 | 29 | /** 30 | *

Description:

31 | * 32 | * @author echisan 33 | * @version 0.0.1 34 | * @email "mailto:dong4j@gmail.com" 35 | * @date 2018.06.14 22:31 36 | * @update dong4j 37 | * @since 0.0.1 38 | */ 39 | @Data 40 | public class UploadResp { 41 | /** Code */ 42 | private String code; 43 | /** Data */ 44 | private info.dong4j.idea.plugin.weibo.entity.upload.Data data; 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/weibo/entity/upload/Data.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.weibo.entity.upload; 26 | 27 | /** 28 | *

Description:

29 | * 30 | * @author echisan 31 | * @version 0.0.1 32 | * @email "mailto:dong4j@gmail.com" 33 | * @date 2018.06.14 22:31 34 | * @update dong4j 35 | * @since 0.0.1 36 | */ 37 | @lombok.Data 38 | public class Data { 39 | /** Count */ 40 | private int count; 41 | /** Data */ 42 | private String data; 43 | /** Pics */ 44 | private Pics pics; 45 | } -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/weibo/entity/upload/Pic_1.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.weibo.entity.upload; 26 | 27 | import lombok.Data; 28 | 29 | /** 30 | *

Description:

31 | * 32 | * @author echisan 33 | * @version 0.0.1 34 | * @email "mailto:dong4j@gmail.com" 35 | * @date 2018.06.14 22:31 36 | * @update dong4j 37 | * @since 0.0.1 38 | */ 39 | @Data 40 | public class Pic_1 { 41 | /** Width */ 42 | private int width; 43 | /** Size */ 44 | private int size; 45 | /** Ret */ 46 | private int ret; 47 | /** Height */ 48 | private int height; 49 | /** Name */ 50 | private String name; 51 | /** Pid */ 52 | private String pid; 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/weibo/entity/upload/Pics.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.weibo.entity.upload; 26 | 27 | import lombok.Data; 28 | 29 | /** 30 | *

Description:

31 | * 32 | * @author echisan 33 | * @version 0.0.1 34 | * @email "mailto:dong4j@gmail.com" 35 | * @date 2018.06.14 22:31 36 | * @update dong4j 37 | * @since 0.0.1 38 | */ 39 | @Data 40 | public class Pics { 41 | /** Pic 1 */ 42 | private Pic_1 pic_1; 43 | } -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/weibo/exception/LoginFailedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.weibo.exception; 26 | 27 | /** 28 | *

Description:

29 | * 30 | * @author echisan 31 | * @version 0.0.1 32 | * @email "mailto:dong4j@gmail.com" 33 | * @date 2018.06.14 22:31 34 | * @update dong4j 35 | * @since 0.0.1 36 | */ 37 | public class LoginFailedException extends RuntimeException { 38 | 39 | private static final long serialVersionUID = -1080553329276240278L; 40 | 41 | /** 42 | * Instantiates a new Login failed exception. 43 | * 44 | * @since 0.0.1 45 | */ 46 | public LoginFailedException() { 47 | } 48 | 49 | /** 50 | * Instantiates a new Login failed exception. 51 | * 52 | * @param message the message 53 | * @since 0.0.1 54 | */ 55 | public LoginFailedException(String message) { 56 | super(message); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/weibo/exception/Wbp4jException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.weibo.exception; 26 | 27 | /** 28 | *

Description:

29 | * 30 | * @author echisan 31 | * @version 0.0.1 32 | * @email "mailto:dong4j@gmail.com" 33 | * @date 2018.06.14 22:31 34 | * @update dong4j 35 | * @since 0.0.1 36 | */ 37 | public class Wbp4jException extends RuntimeException { 38 | 39 | private static final long serialVersionUID = 7848372826329873833L; 40 | 41 | /** 42 | * Instantiates a new Wbp 4 j exception. 43 | * 44 | * @since 0.0.1 45 | */ 46 | Wbp4jException() { 47 | } 48 | 49 | /** 50 | * Instantiates a new Wbp 4 j exception. 51 | * 52 | * @param message the message 53 | * @since 0.0.1 54 | */ 55 | Wbp4jException(String message) { 56 | super(message); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/weibo/http/DefaultWbpHttpResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.weibo.http; 26 | 27 | import java.util.Map; 28 | 29 | /** 30 | *

Description:

31 | * 32 | * @author echisan 33 | * @version 0.0.1 34 | * @email "mailto:dong4j@gmail.com" 35 | * @date 2018.06.14 22:31 36 | * @update dong4j 37 | * @since 0.0.1 38 | */ 39 | public class DefaultWbpHttpResponse implements WbpHttpResponse { 40 | /** Status code */ 41 | private final int statusCode; 42 | /** Header */ 43 | private final Map header; 44 | /** Body */ 45 | private final String body; 46 | 47 | /** 48 | * Instantiates a new Default wbp http response. 49 | * 50 | * @param statusCode the status code 51 | * @param header the header 52 | * @param body the body 53 | * @since 0.0.1 54 | */ 55 | DefaultWbpHttpResponse(int statusCode, Map header, String body) { 56 | this.statusCode = statusCode; 57 | this.header = header; 58 | this.body = body; 59 | } 60 | 61 | /** 62 | * Gets status code * 63 | * 64 | * @return the status code 65 | * @since 0.0.1 66 | */ 67 | @Override 68 | public int getStatusCode() { 69 | return this.statusCode; 70 | } 71 | 72 | /** 73 | * Gets header * 74 | * 75 | * @return the header 76 | * @since 0.0.1 77 | */ 78 | @Override 79 | public Map getHeader() { 80 | return this.header; 81 | } 82 | 83 | /** 84 | * Gets body * 85 | * 86 | * @return the body 87 | * @since 0.0.1 88 | */ 89 | @Override 90 | public String getBody() { 91 | return this.body; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/weibo/http/WbpHttpResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.weibo.http; 26 | 27 | import java.util.Map; 28 | 29 | /** 30 | *

Description:

31 | * 32 | * @author echisan 33 | * @version 0.0.1 34 | * @email "mailto:dong4j@gmail.com" 35 | * @date 2018.06.14 22:31 36 | * @update dong4j 37 | * @since 0.0.1 38 | */ 39 | public interface WbpHttpResponse { 40 | /** 41 | * Gets status code. 42 | * 43 | * @return the status code 44 | * @since 0.0.1 45 | */ 46 | int getStatusCode(); 47 | 48 | /** 49 | * Gets header. 50 | * 51 | * @return the header 52 | * @since 0.0.1 53 | */ 54 | Map getHeader(); 55 | 56 | /** 57 | * Gets body. 58 | * 59 | * @return the body 60 | * @since 0.0.1 61 | */ 62 | String getBody(); 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/weibo/io/CookieCacheable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.weibo.io; 26 | 27 | import java.io.IOException; 28 | 29 | /** 30 | *

Description:

31 | * 32 | * @author echisan 33 | * @version 0.0.1 34 | * @email "mailto:dong4j@gmail.com" 35 | * @date 2018.06.14 22:31 36 | * @update dong4j 37 | * @since 0.0.1 38 | */ 39 | public interface CookieCacheable { 40 | 41 | /** 42 | * Save cookie. 43 | * 44 | * @param cookie the cookie 45 | * @throws IOException the io exception 46 | * @since 0.0.1 47 | */ 48 | void saveCookie(String cookie) throws IOException; 49 | 50 | /** 51 | * Read cookie string. 52 | * 53 | * @return the string 54 | * @throws IOException the io exception 55 | * @since 0.0.1 56 | */ 57 | String readCookie() throws IOException; 58 | 59 | /** 60 | * Delete cookie. 61 | * 62 | * @since 0.0.1 63 | */ 64 | void deleteCookie(); 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/info/dong4j/idea/plugin/weibo/io/Resources.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.weibo.io; 26 | 27 | import java.io.IOException; 28 | import java.net.URL; 29 | 30 | /** 31 | *

Description:

32 | * 33 | * @author echisan 34 | * @version 0.0.1 35 | * @email "mailto:dong4j@gmail.com" 36 | * @date 2018.06.14 22:31 37 | * @update dong4j 38 | * @since 0.0.1 39 | */ 40 | public class Resources { 41 | /** classLoaderWrapper */ 42 | private static final ClassLoaderWrapper classLoaderWrapper = new ClassLoaderWrapper(); 43 | 44 | /** 45 | * Instantiates a new Resources. 46 | * 47 | * @since 0.0.1 48 | */ 49 | Resources() { 50 | } 51 | 52 | /** 53 | * Gets default class loader. 54 | * 55 | * @return the default class loader 56 | * @since 0.0.1 57 | */ 58 | public static ClassLoader getDefaultClassLoader() { 59 | return classLoaderWrapper.defaultClassLoader; 60 | } 61 | 62 | /** 63 | * Sets default class loader. 64 | * 65 | * @param classLoader the class loader 66 | * @since 0.0.1 67 | */ 68 | public static void setDefaultClassLoader(ClassLoader classLoader) { 69 | classLoaderWrapper.defaultClassLoader = classLoader; 70 | } 71 | 72 | /** 73 | * Gets resource url. 74 | * 75 | * @param classLoader the class loader 76 | * @param resource the resource 77 | * @return the resource url 78 | * @throws IOException the io exception 79 | * @since 0.0.1 80 | */ 81 | public static URL getResourceURL(ClassLoader classLoader, String resource) throws IOException { 82 | URL url = classLoaderWrapper.getResourceAsURL(resource, classLoader); 83 | if (url == null) { 84 | throw new IOException("Could not find resource" + resource); 85 | } 86 | return url; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/main/resources/icons/aliyun.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dong4j/markdown-image-kit/ead7344e4d5efbe19a17ee8fc1051e78802e84b8/src/main/resources/icons/aliyun.png -------------------------------------------------------------------------------- /src/main/resources/icons/aliyun@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dong4j/markdown-image-kit/ead7344e4d5efbe19a17ee8fc1051e78802e84b8/src/main/resources/icons/aliyun@2x.png -------------------------------------------------------------------------------- /src/main/resources/icons/baidu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dong4j/markdown-image-kit/ead7344e4d5efbe19a17ee8fc1051e78802e84b8/src/main/resources/icons/baidu.png -------------------------------------------------------------------------------- /src/main/resources/icons/baidu@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dong4j/markdown-image-kit/ead7344e4d5efbe19a17ee8fc1051e78802e84b8/src/main/resources/icons/baidu@2x.png -------------------------------------------------------------------------------- /src/main/resources/icons/compress.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dong4j/markdown-image-kit/ead7344e4d5efbe19a17ee8fc1051e78802e84b8/src/main/resources/icons/compress.png -------------------------------------------------------------------------------- /src/main/resources/icons/compress@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dong4j/markdown-image-kit/ead7344e4d5efbe19a17ee8fc1051e78802e84b8/src/main/resources/icons/compress@2x.png -------------------------------------------------------------------------------- /src/main/resources/icons/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dong4j/markdown-image-kit/ead7344e4d5efbe19a17ee8fc1051e78802e84b8/src/main/resources/icons/github.png -------------------------------------------------------------------------------- /src/main/resources/icons/github@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dong4j/markdown-image-kit/ead7344e4d5efbe19a17ee8fc1051e78802e84b8/src/main/resources/icons/github@2x.png -------------------------------------------------------------------------------- /src/main/resources/icons/imgur.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dong4j/markdown-image-kit/ead7344e4d5efbe19a17ee8fc1051e78802e84b8/src/main/resources/icons/imgur.png -------------------------------------------------------------------------------- /src/main/resources/icons/imgur@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dong4j/markdown-image-kit/ead7344e4d5efbe19a17ee8fc1051e78802e84b8/src/main/resources/icons/imgur@2x.png -------------------------------------------------------------------------------- /src/main/resources/icons/jingdong.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dong4j/markdown-image-kit/ead7344e4d5efbe19a17ee8fc1051e78802e84b8/src/main/resources/icons/jingdong.png -------------------------------------------------------------------------------- /src/main/resources/icons/jingdong@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dong4j/markdown-image-kit/ead7344e4d5efbe19a17ee8fc1051e78802e84b8/src/main/resources/icons/jingdong@2x.png -------------------------------------------------------------------------------- /src/main/resources/icons/move.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dong4j/markdown-image-kit/ead7344e4d5efbe19a17ee8fc1051e78802e84b8/src/main/resources/icons/move.png -------------------------------------------------------------------------------- /src/main/resources/icons/move@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dong4j/markdown-image-kit/ead7344e4d5efbe19a17ee8fc1051e78802e84b8/src/main/resources/icons/move@2x.png -------------------------------------------------------------------------------- /src/main/resources/icons/qiniu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dong4j/markdown-image-kit/ead7344e4d5efbe19a17ee8fc1051e78802e84b8/src/main/resources/icons/qiniu.png -------------------------------------------------------------------------------- /src/main/resources/icons/qiniu@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dong4j/markdown-image-kit/ead7344e4d5efbe19a17ee8fc1051e78802e84b8/src/main/resources/icons/qiniu@2x.png -------------------------------------------------------------------------------- /src/main/resources/icons/sm_ms.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dong4j/markdown-image-kit/ead7344e4d5efbe19a17ee8fc1051e78802e84b8/src/main/resources/icons/sm_ms.png -------------------------------------------------------------------------------- /src/main/resources/icons/sm_ms@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dong4j/markdown-image-kit/ead7344e4d5efbe19a17ee8fc1051e78802e84b8/src/main/resources/icons/sm_ms@2x.png -------------------------------------------------------------------------------- /src/main/resources/icons/wangyi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dong4j/markdown-image-kit/ead7344e4d5efbe19a17ee8fc1051e78802e84b8/src/main/resources/icons/wangyi.png -------------------------------------------------------------------------------- /src/main/resources/icons/wangyi@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dong4j/markdown-image-kit/ead7344e4d5efbe19a17ee8fc1051e78802e84b8/src/main/resources/icons/wangyi@2x.png -------------------------------------------------------------------------------- /src/main/resources/icons/weibo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dong4j/markdown-image-kit/ead7344e4d5efbe19a17ee8fc1051e78802e84b8/src/main/resources/icons/weibo.png -------------------------------------------------------------------------------- /src/main/resources/icons/weibo@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dong4j/markdown-image-kit/ead7344e4d5efbe19a17ee8fc1051e78802e84b8/src/main/resources/icons/weibo@2x.png -------------------------------------------------------------------------------- /src/main/resources/icons/youpai.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dong4j/markdown-image-kit/ead7344e4d5efbe19a17ee8fc1051e78802e84b8/src/main/resources/icons/youpai.png -------------------------------------------------------------------------------- /src/main/resources/icons/youpai@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dong4j/markdown-image-kit/ead7344e4d5efbe19a17ee8fc1051e78802e84b8/src/main/resources/icons/youpai@2x.png -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/ImageLabelChangeIntetionAction/description.html: -------------------------------------------------------------------------------- 1 | 24 | 25 | 26 | 27 |

Write your description here. 28 | Start the description with a verb in 3rd person singular, like reports, detects, highlights. 29 | In the first sentence, briefly explain what exactly the inspection helps you detect. 30 | Make sure the sentence is not very long and complicated. 31 | The first sentence must be in a dedicated paragraph separated from the rest of the text. This will make the description easier to read. 32 | Make sure the description doesn’t just repeat the inspection title. 33 |

34 | 35 |

Text after this comment will only be shown in the settings of the inspection.

36 | 37 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/ImageMoveIntentionAction/description.html: -------------------------------------------------------------------------------- 1 | 24 | 25 | 26 | 27 |

Write your description here. 28 | Start the description with a verb in 3rd person singular, like reports, detects, highlights. 29 | In the first sentence, briefly explain what exactly the inspection helps you detect. 30 | Make sure the sentence is not very long and complicated. 31 | The first sentence must be in a dedicated paragraph separated from the rest of the text. This will make the description easier to read. 32 | Make sure the description doesn’t just repeat the inspection title. 33 |

34 | 35 |

Text after this comment will only be shown in the settings of the inspection.

36 | 37 | 38 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/ImageUploadIntentionAction/description.html: -------------------------------------------------------------------------------- 1 | 24 | 25 | 26 | 27 |

Write your description here. 28 | Start the description with a verb in 3rd person singular, like reports, detects, highlights. 29 | In the first sentence, briefly explain what exactly the inspection helps you detect. 30 | Make sure the sentence is not very long and complicated. 31 | The first sentence must be in a dedicated paragraph separated from the rest of the text. This will make the description easier to read. 32 | Make sure the description doesn’t just repeat the inspection title. 33 |

34 | 35 |

Text after this comment will only be shown in the settings of the inspection.

36 | 37 | 38 | -------------------------------------------------------------------------------- /src/main/resources/messages/MikBundle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2021 dong4j 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | 25 | mik.uploading.files.progress=Uploading... 26 | mik.paste.save.progress=Save Image 27 | mik.paste.upload.progress=Upload Image 28 | mik.paste.insert.progress=Inseart Mark 29 | mik.paste.change.progress=Change Mark 30 | mik.help.rest.url=http://rest.dong4j.info/mik/help/ 31 | mik.chain.compress.progress=Image Compress 32 | mik.intention.upload.message=Upload image to {0} 33 | mik.intention.move.message=Move image to {0} 34 | mik.panel.message.domain-field=\u8F93\u5165\u5339\u914D\u5F85\u8FC1\u79FB\u7684\u56FE\u7247 domain 35 | mik.action.upload.process=Upload To {0} Task: 36 | mik.action.move.process=Move To {0} Task: 37 | mik.action.compress.progress=Image Compress Task: 38 | mik.change.mark.message=\u8BF7\u6309\u7167\u4E0A\u9762\u7684\u683C\u5F0F\u8BBE\u7F6E 39 | mik.intention.change.message=Change image label 40 | mik.action.change.process=Change Image Label Task: -------------------------------------------------------------------------------- /src/main/resources/mik.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dong4j/markdown-image-kit/ead7344e4d5efbe19a17ee8fc1051e78802e84b8/src/main/resources/mik.png -------------------------------------------------------------------------------- /src/main/resources/setting.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2021 dong4j 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | 25 | change.to.html.mark=\u66FF\u6362\u4E3A '' 26 | clipboard.control=&Clipboard \u76D1\u542C 27 | copy.to.dir=\u590D\u5236\u56FE\u7247\u5230\u76EE\u5F55 28 | button.test=&Test Upload 29 | oss.auth.weibo.password=&\u5BC6\u7801: 30 | oss.auth.weibo.username=&\u7528\u6237\u540D: 31 | tip.text.test-button=\u53EA\u6709\u6D4B\u8BD5\u6210\u529F\u540E\u53F3\u952E\u4E0A\u4F20\u6309\u94AE\u624D\u53EF\u7528 32 | oss.title.weibo=\u5FAE\u535A 33 | oss.title.aliyun=\u963F\u91CC\u4E91 34 | oss.title.qiniu=\u4E03\u725B\u4E91 35 | button.help=&Help 36 | tip.text.clipboard.control=\u5F00\u542F\u540E\u5C06\u76D1\u542C markdown \u6587\u4EF6\u7684\u64CD\u4F5C 37 | -------------------------------------------------------------------------------- /src/main/resources/setting_en_US.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2021 dong4j 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | 25 | change.to.html.mark=Change To Mark '' 26 | clipboard.control=Clipboard Control 27 | copy.to.dir=Copy Image To Dir 28 | button.test=&Test Upload 29 | oss.auth.weibo.password=Password: 30 | oss.auth.weibo.username=UserName: 31 | tip.text.test-button=\u53EA\u6709\u6D4B\u8BD5\u6210\u529F\u540E\u53F3\u952E\u4E0A\u4F20\u6309\u94AE\u624D\u53EF\u7528 32 | oss.title.weibo=\u5FAE\u535A 33 | oss.title.aliyun=\u963F\u91CC\u4E91 34 | oss.title.qiniu=\u4E03\u725B\u4E91 35 | button.help=&Help 36 | tip.text.clipboard.control=\u5F00\u542F\u540E\u5C06\u76D1\u542C markdown \u6587\u4EF6\u7684\u64CD\u4F5C 37 | xx.xx=eeee -------------------------------------------------------------------------------- /src/main/resources/setting_zh_CN.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2021 dong4j 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | 25 | change.to.html.mark=\u66FF\u6362\u4E3A '' 26 | clipboard.control=Clipboard \u76D1\u542C 27 | copy.to.dir=\u590D\u5236\u56FE\u7247\u5230\u76EE\u5F55 28 | button.test=&Test Upload 29 | oss.auth.weibo.password=\u5BC6\u7801: 30 | oss.auth.weibo.username=&\u7528\u6237\u540D: 31 | tip.text.test-button=\u53EA\u6709\u6D4B\u8BD5\u6210\u529F\u540E\u53F3\u952E\u4E0A\u4F20\u6309\u94AE\u624D\u53EF\u7528 32 | oss.title.weibo=\u5FAE\u535A 33 | oss.title.aliyun=\u963F\u91CC\u4E91 34 | oss.title.qiniu=\u4E03\u725B\u4E91 35 | button.help=&Help 36 | tip.text.clipboard.control=\u5F00\u542F\u540E\u5C06\u76D1\u542C markdown \u6587\u4EF6\u7684\u64CD\u4F5C -------------------------------------------------------------------------------- /src/test/java/info/dong4j/idea/plugin/chain/IActionHandlerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.chain; 26 | 27 | import org.junit.Test; 28 | 29 | /** 30 | *

Company: no company

31 | *

Description: ${description}

32 | * 33 | * @author dong4j 34 | * @version 1.0.0 35 | * @email "mailto:dong4j@gmail.com" 36 | * @date 2019.03.22 19:42 37 | * @since 1.1.0 38 | */ 39 | public class IActionHandlerTest { 40 | /** 41 | * Test 42 | * 43 | * @since 1.1.0 44 | */ 45 | @Test 46 | public void test() { 47 | // ActionManager manager = new ActionManager(); 48 | // manager.addHandler(new SaveAndInsertHandler()); 49 | // manager.addHandler(new UploadAndInsertHandler()); 50 | // manager.addHandler(new FinalActionHandler()); 51 | // manager.invoke(); 52 | } 53 | } -------------------------------------------------------------------------------- /src/test/java/info/dong4j/idea/plugin/client/AbstractOssClientTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.client; 26 | 27 | import com.intellij.testFramework.LightPlatformTestCase; 28 | 29 | import java.util.ServiceLoader; 30 | 31 | import lombok.extern.slf4j.Slf4j; 32 | 33 | /** 34 | *

Company: no company

35 | *

Description: ${description}

36 | * 37 | * @author dong4j 38 | * @version 1.0.0 39 | * @email "mailto:dong4j@gmail.com" 40 | * @date 2019.03.22 15:16 41 | * @since 1.1.0 42 | */ 43 | @Slf4j 44 | public class AbstractOssClientTest extends LightPlatformTestCase { 45 | 46 | /** 47 | * Test 48 | * 49 | * @since 1.1.0 50 | */ 51 | public void test() { 52 | ServiceLoader loader = ServiceLoader.load(OssClient.class); 53 | for (OssClient ossClient : loader) { 54 | log.info("{}", ossClient); 55 | } 56 | } 57 | 58 | } -------------------------------------------------------------------------------- /src/test/java/info/dong4j/idea/plugin/client/AliyunOssClientTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.client; 26 | 27 | import com.intellij.testFramework.LightPlatformTestCase; 28 | 29 | import java.io.File; 30 | import java.io.FileInputStream; 31 | import java.io.FileNotFoundException; 32 | 33 | import lombok.extern.slf4j.Slf4j; 34 | 35 | /** 36 | *

Company: no company

37 | *

Description: ${description}

38 | * 39 | * @author dong4j 40 | * @version 1.0.0 41 | * @email "mailto:dong4j@gmail.com" 42 | * @date 2019.03.18 16:13 43 | * @since 1.1.0 44 | */ 45 | @Slf4j 46 | // @RunsInActiveStoreMode 47 | public class AliyunOssClientTest extends LightPlatformTestCase { 48 | /** 49 | * Test 50 | * 51 | * @throws FileNotFoundException file not found exception 52 | * @since 1.1.0 53 | */ 54 | // @Test 55 | public void test() throws Exception { 56 | AliyunOssClient aliyunOssClient = AliyunOssClient.getInstance(); 57 | String url = aliyunOssClient.upload(new FileInputStream(new File("/Users/dong4j/Downloads/我可要开始皮了.png")), "我可要开始皮了.png"); 58 | log.info(url); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/test/java/info/dong4j/idea/plugin/client/WeiboOssClientTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.client; 26 | 27 | import com.intellij.testFramework.LightPlatformTestCase; 28 | import com.intellij.testFramework.RunsInActiveStoreMode; 29 | 30 | import java.io.File; 31 | import java.io.FileInputStream; 32 | import java.io.FileNotFoundException; 33 | 34 | import lombok.extern.slf4j.Slf4j; 35 | 36 | /** 37 | *

Company: no company

38 | *

Description: ${description}

39 | * 40 | * @author dong4j 41 | * @version 1.0.0 42 | * @email "mailto:dong4j@gmail.com" 43 | * @date 2019.03.19 23:41 44 | * @since 1.1.0 45 | */ 46 | @Slf4j 47 | @RunsInActiveStoreMode 48 | public class WeiboOssClientTest extends LightPlatformTestCase { 49 | /** 50 | * Test 1 51 | * 52 | * @throws FileNotFoundException file not found exception 53 | * @since 1.1.0 54 | */ 55 | public void test1() throws Exception { 56 | WeiboOssClient weiboOssClient = WeiboOssClient.getInstance(); 57 | String url = weiboOssClient.upload(new FileInputStream(new File("/Users/dong4j/Downloads/我可要开始皮了.png")), "我可要开始皮了.png"); 58 | log.info(url); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/test/java/info/dong4j/idea/plugin/handler/PasteImageActionTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.handler; 26 | 27 | import info.dong4j.idea.plugin.util.ImageUtils; 28 | 29 | import org.junit.Test; 30 | 31 | import java.awt.Image; 32 | import java.awt.datatransfer.Clipboard; 33 | import java.awt.datatransfer.DataFlavor; 34 | import java.awt.datatransfer.Transferable; 35 | import java.awt.datatransfer.UnsupportedFlavorException; 36 | import java.awt.image.BufferedImage; 37 | import java.io.File; 38 | import java.io.IOException; 39 | 40 | import javax.imageio.ImageIO; 41 | 42 | import lombok.extern.slf4j.Slf4j; 43 | 44 | /** 45 | *

Company: no company

46 | *

Description: ${description}

47 | * 48 | * @author dong4j 49 | * @version 1.0.0 50 | * @email "mailto:dong4j@gmail.com" 51 | * @date 2019.03.17 12:46 52 | * @since 1.1.0 53 | */ 54 | @Slf4j 55 | public class PasteImageActionTest { 56 | /** 57 | * Test 58 | * 59 | * @throws IOException io exception 60 | * @throws UnsupportedFlavorException unsupported flavor exception 61 | * @since 1.1.0 62 | */ 63 | @Test 64 | public void test() throws IOException, UnsupportedFlavorException { 65 | Clipboard clipboard = java.awt.Toolkit.getDefaultToolkit().getSystemClipboard(); 66 | Transferable cc = clipboard.getContents(null); 67 | if (cc != null && cc.isDataFlavorSupported(DataFlavor.imageFlavor)) { 68 | Image image = (Image) cc.getTransferData(DataFlavor.imageFlavor); 69 | // 保存图片 70 | BufferedImage bufferedImage = ImageUtils.toBufferedImage(image); 71 | File imageFile = new File("/Users/dong4j/Develop/", "test.png"); 72 | ImageIO.write(bufferedImage, "png", imageFile); 73 | } 74 | } 75 | 76 | } -------------------------------------------------------------------------------- /src/test/java/info/dong4j/idea/plugin/settings/MoveToOtherOssSettingsDialogTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.settings; 26 | 27 | import org.junit.Test; 28 | 29 | /** 30 | *

Company: no company

31 | *

Description: ${description}

32 | * 33 | * @author dong4j 34 | * @version 1.0.0 35 | * @email "mailto:dong4j@gmail.com" 36 | * @date 2019.03.27 14:54 37 | * @since 1.1.0 38 | */ 39 | public class MoveToOtherOssSettingsDialogTest { 40 | /** 41 | * Test 42 | * 43 | * @since 1.1.0 44 | */ 45 | @Test 46 | public void test() { 47 | MoveToOtherOssSettingsDialog dialog = new MoveToOtherOssSettingsDialog(); 48 | dialog.pack(); 49 | dialog.setVisible(true); 50 | System.exit(0); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/test/java/info/dong4j/idea/plugin/util/AliyunOssUtilsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.util; 26 | 27 | import org.junit.Test; 28 | 29 | import java.io.FileInputStream; 30 | import java.io.IOException; 31 | 32 | /** 33 | *

Company: 成都返空汇网络技术有限公司

34 | *

Description:

35 | * 36 | * @author dong4j 37 | * @version 1.0.0 38 | * @email "mailto:dong4j@gmail.com" 39 | * @date 2020.04.25 16:36 40 | * @since 1.1.0 41 | */ 42 | public class AliyunOssUtilsTest { 43 | /** secretId */ 44 | private static final String secretId = System.getProperty("secretId"); 45 | /** secretKey */ 46 | private static final String secretKey = System.getProperty("secretKey"); 47 | /** bucketName */ 48 | private static final String bucketName = System.getProperty("bucketName"); 49 | // private static final String ossBucket = "xxx"; 50 | // private static final String accessKeyId = "xxx"; 51 | // private static final String secretAccessKey = "xxx"; 52 | //可根据自己的oss产品自行更改域名 53 | // private static final String endpoint = "oss-cn-shanghai.aliyuncs.com/"; 54 | 55 | /** 56 | * Test 1 57 | * 58 | * @throws IOException io exception 59 | * @since 1.1.0 60 | */ 61 | @Test 62 | public void test_1() throws IOException { 63 | 64 | // key 必须使用 / 为前缀 65 | String putResult = AliyunOssUtils.putObject("/dddd.jpg", 66 | new FileInputStream("/Users/dong4j/Downloads/xu.png"), 67 | bucketName, 68 | "oss-cn-hangzhou.aliyuncs.com", 69 | secretId, 70 | secretKey, 71 | false, 72 | null); 73 | System.out.println("putResult:" + putResult); 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /src/test/java/info/dong4j/idea/plugin/util/BaiduBosUtilsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.util; 26 | 27 | import org.junit.Test; 28 | 29 | import java.io.FileInputStream; 30 | import java.io.IOException; 31 | 32 | /** 33 | *

Company: 成都返空汇网络技术有限公司

34 | *

Description:

35 | * 36 | * @author dong4j 37 | * @version 1.0.0 38 | * @email "mailto:dong4j@gmail.com" 39 | * @date 2020.04.25 16:36 40 | * @since 1.1.0 41 | */ 42 | public class BaiduBosUtilsTest { 43 | /** secretId */ 44 | private static final String secretId = System.getProperty("secretId"); 45 | /** secretKey */ 46 | private static final String secretKey = System.getProperty("secretKey"); 47 | /** bucketName */ 48 | private static final String bucketName = System.getProperty("bucketName"); 49 | // private static final String ossBucket = "xxx"; 50 | // private static final String accessKeyId = "xxx"; 51 | // private static final String secretAccessKey = "xxx"; 52 | //可根据自己的oss产品自行更改域名 53 | // private static final String endpoint = "oss-cn-shanghai.aliyuncs.com/"; 54 | 55 | /** 56 | * Test 1 57 | * 58 | * @throws IOException io exception 59 | * @since 1.1.0 60 | */ 61 | @Test 62 | public void test_1() throws IOException { 63 | 64 | // key 必须使用 / 为前缀 65 | String putResult = BaiduBosUtils.putObject("/c/xu.jpg", 66 | new FileInputStream("/Users/dong4j/Downloads/xu.png"), 67 | bucketName, 68 | "bj.bcebos.com", 69 | secretId, 70 | secretKey, 71 | false, 72 | null); 73 | System.out.println("putResult:" + putResult); 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /src/test/java/info/dong4j/idea/plugin/util/DESTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.util; 26 | 27 | import org.junit.Test; 28 | 29 | /** 30 | *

Company: no company

31 | *

Description: ${description}

32 | * 33 | * @author dong4j 34 | * @version 1.0.0 35 | * @email "mailto:dong4j@gmail.com" 36 | * @date 2019.03.18 06:47 37 | * @since 1.1.0 38 | */ 39 | public class DESTest { 40 | /** 41 | * Test 42 | * 43 | * @since 1.1.0 44 | */ 45 | @Test 46 | public void test() { 47 | String mi = DES.encrypt("", "zxcvbnm"); 48 | System.out.println(mi); 49 | System.out.println("aaa " + DES.decrypt("", "zxcvbnm")); 50 | } 51 | } -------------------------------------------------------------------------------- /src/test/java/info/dong4j/idea/plugin/weibo/WbpUploadRequestTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2021 dong4j 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package info.dong4j.idea.plugin.weibo; 26 | 27 | import org.junit.Test; 28 | 29 | import java.io.File; 30 | import java.io.IOException; 31 | 32 | /** 33 | *

Company: no company

34 | *

Description: ${description}

35 | * 36 | * @author dong4j 37 | * @version 1.0.0 38 | * @email "mailto:dong4j@gmail.com" 39 | * @date 2019.03.17 22:42 40 | * @since 1.1.0 41 | */ 42 | public class WbpUploadRequestTest { 43 | 44 | /** 45 | * Build 46 | * 47 | * @throws IOException io exception 48 | * @since 1.1.0 49 | */ 50 | @Test 51 | public void build() throws Exception { 52 | WbpUploadRequest request = new UploadRequestBuilder() 53 | .setAcount(System.getProperty("username"), System.getProperty("password")) 54 | .build(); 55 | UploadResponse response = request.upload(new File("/Users/dong4j/Downloads/NewInstance.png")); 56 | System.out.println(response.getResult()); 57 | System.out.println(response.getMessage()); 58 | System.out.println(response.getImageInfo()); 59 | System.out.println(response.getImageInfo().getLarge()); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/test/resources/META-INF/services/info.dong4j.idea.plugin.client.OssClient: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2021 dong4j 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | 25 | # 26 | # MIT License 27 | # 28 | # Copyright (c) 2021 dong4j 29 | # 30 | # Permission is hereby granted, free of charge, to any person obtaining a copy 31 | # of this software and associated documentation files (the "Software"), to deal 32 | # in the Software without restriction, including without limitation the rights 33 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 34 | # copies of the Software, and to permit persons to whom the Software is 35 | # furnished to do so, subject to the following conditions: 36 | # 37 | # The above copyright notice and this permission notice shall be included in all 38 | # copies or substantial portions of the Software. 39 | # 40 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 41 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 42 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 43 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 44 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 45 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 46 | # SOFTWARE. 47 | # 48 | 49 | info.dong4j.idea.plugin.client.AliyunOssClient 50 | info.dong4j.idea.plugin.client.QiniuOssClient 51 | info.dong4j.idea.plugin.client.WeiboOssClient -------------------------------------------------------------------------------- /src/test/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2021 dong4j 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | 25 | log4j.rootLogger=TRACE, stdout 26 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 27 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 28 | log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n 29 | --------------------------------------------------------------------------------