[
  {
    "path": ".github/dependabot.yml",
    "content": "# Dependabot configuration:\n# https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/configuration-options-for-dependency-updates\n\nversion: 2\nupdates:\n  # Maintain dependencies for Gradle dependencies\n  - package-ecosystem: \"gradle\"\n    directory: \"/\"\n    target-branch: \"next\"\n    schedule:\n      interval: \"daily\"\n  # Maintain dependencies for GitHub Actions\n  - package-ecosystem: \"github-actions\"\n    directory: \"/\"\n    target-branch: \"next\"\n    schedule:\n      interval: \"daily\"\n"
  },
  {
    "path": ".github/workflows/build.yml",
    "content": "# GitHub Actions Workflow is created for testing and preparing the plugin release in the following steps:\n# - validate Gradle Wrapper,\n# - run 'test' and 'verifyPlugin' tasks,\n# - run Qodana inspections,\n# - run 'buildPlugin' task and prepare artifact for the further tests,\n# - run 'runPluginVerifier' task,\n# - create a draft release.\n#\n# Workflow is triggered on push and pull_request events.\n#\n# GitHub Actions reference: https://help.github.com/en/actions\n#\n## JBIJPPTPL\n\nname: Build\non:\n  # Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g. for dependabot pull requests)\n  push:\n    branches: [main]\n  # Trigger the workflow on any pull request\n  pull_request:\n\njobs:\n\n  # Run Gradle Wrapper Validation Action to verify the wrapper's checksum\n  # Run verifyPlugin, IntelliJ Plugin Verifier, and test Gradle tasks\n  # Build plugin and provide the artifact for the next workflow jobs\n  build:\n    name: Build\n    runs-on: ubuntu-latest\n    outputs:\n      version: ${{ steps.properties.outputs.version }}\n      changelog: ${{ steps.properties.outputs.changelog }}\n    steps:\n\n      # Free GitHub Actions Environment Disk Space\n      - name: Maximize Build Space\n        run: |\n          sudo rm -rf /usr/share/dotnet\n          sudo rm -rf /usr/local/lib/android\n          sudo rm -rf /opt/ghc\n\n      # Check out current repository\n      - name: Fetch Sources\n        uses: actions/checkout@v4\n\n      # Validate wrapper\n      - name: Gradle Wrapper Validation\n        uses: gradle/wrapper-validation-action@v3.5.0\n\n      # Setup Java 11 environment for the next steps\n      - name: Setup Java\n        uses: actions/setup-java@v4\n        with:\n          distribution: zulu\n          java-version: 11\n\n      # Set environment variables\n      - name: Export Properties\n        id: properties\n        shell: bash\n        run: |\n          PROPERTIES=\"$(./gradlew properties --console=plain -q)\"\n          VERSION=\"$(echo \"$PROPERTIES\" | grep \"^version:\" | cut -f2- -d ' ')\"\n          NAME=\"$(echo \"$PROPERTIES\" | grep \"^pluginName:\" | cut -f2- -d ' ')\"\n          CHANGELOG=\"$(./gradlew getChangelog --unreleased --no-header --console=plain -q)\"\n\n          echo \"version=$VERSION\" >> $GITHUB_OUTPUT\n          echo \"name=$NAME\" >> $GITHUB_OUTPUT\n          echo \"pluginVerifierHomeDir=~/.pluginVerifier\" >> $GITHUB_OUTPUT\n          \n          echo \"changelog<<EOF\" >> $GITHUB_OUTPUT\n          echo \"$CHANGELOG\" >> $GITHUB_OUTPUT\n          echo \"EOF\" >> $GITHUB_OUTPUT\n\n          ./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier\n\n      # Run tests\n      - name: Run Tests\n        run: ./gradlew check\n\n      # Collect Tests Result of failed tests\n      - name: Collect Tests Result\n        if: ${{ failure() }}\n        uses: actions/upload-artifact@v4\n        with:\n          name: tests-result\n          path: ${{ github.workspace }}/build/reports/tests\n\n      # Upload Kover report to CodeCov\n      - name: Upload Code Coverage Report\n        uses: codecov/codecov-action@v4\n        with:\n          files: ${{ github.workspace }}/build/reports/kover/xml/report.xml\n\n      # Cache Plugin Verifier IDEs\n      - name: Setup Plugin Verifier IDEs Cache\n        uses: actions/cache@v4\n        with:\n          path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides\n          key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}\n\n      # Run Verify Plugin task and IntelliJ Plugin Verifier tool\n      - name: Run Plugin Verification tasks\n        run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}\n\n      # Collect Plugin Verifier Result\n      - name: Collect Plugin Verifier Result\n        if: ${{ always() }}\n        uses: actions/upload-artifact@v4\n        with:\n          name: pluginVerifier-result\n          path: ${{ github.workspace }}/build/reports/pluginVerifier\n\n      # Run Qodana inspections\n#      - name: Qodana - Code Inspection\n#        uses: JetBrains/qodana-action@v2023.3.1\n\n      # Prepare plugin archive content for creating artifact\n      - name: Prepare Plugin Artifact\n        id: artifact\n        shell: bash\n        run: |\n          cd ${{ github.workspace }}/build/distributions\n          FILENAME=`ls *.zip`\n          unzip \"$FILENAME\" -d content\n\n          echo \"filename=${FILENAME:0:-4}\" >> $GITHUB_OUTPUT\n\n      # Store already-built plugin as an artifact for downloading\n      - name: Upload artifact\n        uses: actions/upload-artifact@v4\n        with:\n          name: ${{ steps.artifact.outputs.filename }}\n          path: ./build/distributions/content/*/*\n\n  # Prepare a draft release for GitHub Releases page for the manual verification\n  # If accepted and published, release workflow would be triggered\n  releaseDraft:\n    name: Release Draft\n    if: github.event_name != 'pull_request'\n    needs: build\n    runs-on: ubuntu-latest\n    permissions:\n      contents: write\n    steps:\n\n      # Check out current repository\n      - name: Fetch Sources\n        uses: actions/checkout@v4\n\n      # Remove old release drafts by using the curl request for the available releases with a draft flag\n      - name: Remove Old Release Drafts\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n        run: |\n          gh api repos/{owner}/{repo}/releases \\\n            --jq '.[] | select(.draft == true) | .id' \\\n            | xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}\n\n      # Create a new release draft which is not publicly visible and requires manual acceptance\n      - name: Create Release Draft\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n        run: |\n          gh release create v${{ needs.build.outputs.version }} \\\n            --draft \\\n            --title \"v${{ needs.build.outputs.version }}\" \\\n            --notes \"$(cat << 'EOM'\n          ${{ needs.build.outputs.changelog }}\n          EOM\n          )\"\n"
  },
  {
    "path": ".github/workflows/release.yml",
    "content": "# GitHub Actions Workflow created for handling the release process based on the draft release prepared with the Build workflow.\n# Running the publishPlugin task requires all following secrets to be provided: PUBLISH_TOKEN, PRIVATE_KEY, PRIVATE_KEY_PASSWORD, CERTIFICATE_CHAIN.\n# See https://plugins.jetbrains.com/docs/intellij/plugin-signing.html for more information.\n\nname: Release\non:\n  release:\n    types: [prereleased, released]\n\njobs:\n\n  # Prepare and publish the plugin to the Marketplace repository\n  release:\n    name: Publish Plugin\n    runs-on: ubuntu-latest\n    permissions:\n      contents: write\n      pull-requests: write\n    steps:\n\n      # Check out current repository\n      - name: Fetch Sources\n        uses: actions/checkout@v4\n        with:\n          ref: ${{ github.event.release.tag_name }}\n\n      # Setup Java 11 environment for the next steps\n      - name: Setup Java\n        uses: actions/setup-java@v4\n        with:\n          distribution: zulu\n          java-version: 11\n\n      # Set environment variables\n      - name: Export Properties\n        id: properties\n        shell: bash\n        run: |\n          CHANGELOG=\"$(cat << 'EOM' | sed -e 's/^[[:space:]]*$//g' -e '/./,$!d'\n          ${{ github.event.release.body }}\n          EOM\n          )\"\n          \n          echo \"changelog<<EOF\" >> $GITHUB_OUTPUT\n          echo \"$CHANGELOG\" >> $GITHUB_OUTPUT\n          echo \"EOF\" >> $GITHUB_OUTPUT\n\n      # Update Unreleased section with the current release note\n      - name: Patch Changelog\n        if: ${{ steps.properties.outputs.changelog != '' }}\n        env:\n          CHANGELOG: ${{ steps.properties.outputs.changelog }}\n        run: |\n          ./gradlew patchChangelog --release-note=\"$CHANGELOG\"\n\n      # Publish the plugin to the Marketplace\n      - name: Publish Plugin\n        env:\n          PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}\n          CERTIFICATE_CHAIN: ${{ secrets.CERTIFICATE_CHAIN }}\n          PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}\n          PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }}\n        run: ./gradlew publishPlugin\n\n      # Upload artifact as a release asset\n      - name: Upload Release Asset\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n        run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/*\n\n      # Create pull request\n      - name: Create Pull Request\n        if: ${{ steps.properties.outputs.changelog != '' }}\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n        run: |\n          VERSION=\"${{ github.event.release.tag_name }}\"\n          BRANCH=\"changelog-update-$VERSION\"\n          LABEL=\"release changelog\"\n\n          git config user.email \"action@github.com\"\n          git config user.name \"GitHub Action\"\n\n          git checkout -b $BRANCH\n          git commit -am \"Changelog update - $VERSION\"\n          git push --set-upstream origin $BRANCH\n          \n          gh label create \"$LABEL\" \\\n            --force \\\n            --description \"Pull requests with release changelog update\" \\\n            || true\n\n          gh pr create \\\n            --title \"Changelog update - \\`$VERSION\\`\" \\\n            --body \"Current pull request contains patched \\`CHANGELOG.md\\` file for the \\`$VERSION\\` version.\" \\\n            --label \"$LABEL\" \\\n            --head $BRANCH\n"
  },
  {
    "path": ".github/workflows/run-ui-tests.yml",
    "content": "# GitHub Actions Workflow for launching UI tests on Linux, Windows, and Mac in the following steps:\n# - prepare and launch IDE with your plugin and robot-server plugin, which is needed to interact with UI\n# - wait for IDE to start\n# - run UI tests with separate Gradle task\n#\n# Please check https://github.com/JetBrains/intellij-ui-test-robot for information about UI tests with IntelliJ Platform\n#\n# Workflow is triggered manually.\n\nname: Run UI Tests\non:\n  workflow_dispatch\n\njobs:\n\n  testUI:\n    runs-on: ${{ matrix.os }}\n    strategy:\n      fail-fast: false\n      matrix:\n        include:\n          - os: ubuntu-latest\n            runIde: |\n              export DISPLAY=:99.0\n              Xvfb -ac :99 -screen 0 1920x1080x16 &\n              gradle runIdeForUiTests &\n          - os: windows-latest\n            runIde: start gradlew.bat runIdeForUiTests\n          - os: macos-latest\n            runIde: ./gradlew runIdeForUiTests &\n\n    steps:\n\n      # Check out current repository\n      - name: Fetch Sources\n        uses: actions/checkout@v4\n\n      # Setup Java 11 environment for the next steps\n      - name: Setup Java\n        uses: actions/setup-java@v4\n        with:\n          distribution: zulu\n          java-version: 11\n\n      # Run IDEA prepared for UI testing\n      - name: Run IDE\n        run: ${{ matrix.runIde }}\n\n      # Wait for IDEA to be started\n      - name: Health Check\n        uses: jtalk/url-health-check-action@v4\n        with:\n          url: http://127.0.0.1:8082\n          max-attempts: 15\n          retry-delay: 30s\n\n      # Run tests\n      - name: Tests\n        run: ./gradlew test\n"
  },
  {
    "path": ".gitignore",
    "content": ".gradle\n.idea\n.qodana\nbuild\n"
  },
  {
    "path": ".run/Run IDE for UI Tests.run.xml",
    "content": "<component name=\"ProjectRunConfigurationManager\">\n  <configuration default=\"false\" name=\"Run IDE for UI Tests\" type=\"GradleRunConfiguration\" factoryName=\"Gradle\">\n    <log_file alias=\"idea.log\" path=\"$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log\" />\n    <ExternalSystemSettings>\n      <option name=\"executionName\" />\n      <option name=\"externalProjectPath\" value=\"$PROJECT_DIR$\" />\n      <option name=\"externalSystemIdString\" value=\"GRADLE\" />\n      <option name=\"scriptParameters\" value=\"runIdeForUiTests\" />\n      <option name=\"taskDescriptions\">\n        <list />\n      </option>\n      <option name=\"taskNames\">\n        <list />\n      </option>\n      <option name=\"vmOptions\" />\n    </ExternalSystemSettings>\n    <ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>\n    <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>\n    <DebugAllEnabled>false</DebugAllEnabled>\n    <method v=\"2\" />\n  </configuration>\n</component>"
  },
  {
    "path": ".run/Run IDE with Plugin.run.xml",
    "content": "<component name=\"ProjectRunConfigurationManager\">\n  <configuration default=\"false\" name=\"Run Plugin\" type=\"GradleRunConfiguration\" factoryName=\"Gradle\">\n    <log_file alias=\"idea.log\" path=\"$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log\" />\n    <ExternalSystemSettings>\n      <option name=\"executionName\" />\n      <option name=\"externalProjectPath\" value=\"$PROJECT_DIR$\" />\n      <option name=\"externalSystemIdString\" value=\"GRADLE\" />\n      <option name=\"scriptParameters\" value=\"\" />\n      <option name=\"taskDescriptions\">\n        <list />\n      </option>\n      <option name=\"taskNames\">\n        <list>\n          <option value=\"runIde\" />\n        </list>\n      </option>\n      <option name=\"vmOptions\" value=\"\" />\n    </ExternalSystemSettings>\n    <ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>\n    <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>\n    <DebugAllEnabled>false</DebugAllEnabled>\n    <method v=\"2\" />\n  </configuration>\n</component>"
  },
  {
    "path": ".run/Run Plugin Tests.run.xml",
    "content": "<component name=\"ProjectRunConfigurationManager\">\n  <configuration default=\"false\" name=\"Run Tests\" type=\"GradleRunConfiguration\" factoryName=\"Gradle\">\n    <log_file alias=\"idea.log\" path=\"$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log\" />\n    <ExternalSystemSettings>\n      <option name=\"executionName\" />\n      <option name=\"externalProjectPath\" value=\"$PROJECT_DIR$\" />\n      <option name=\"externalSystemIdString\" value=\"GRADLE\" />\n      <option name=\"scriptParameters\" value=\"\" />\n      <option name=\"taskDescriptions\">\n        <list />\n      </option>\n      <option name=\"taskNames\">\n        <list>\n          <option value=\"check\" />\n        </list>\n      </option>\n      <option name=\"vmOptions\" value=\"\" />\n    </ExternalSystemSettings>\n    <ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>\n    <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>\n    <DebugAllEnabled>false</DebugAllEnabled>\n    <method v=\"2\" />\n  </configuration>\n</component>\n"
  },
  {
    "path": ".run/Run Plugin Verification.run.xml",
    "content": "<component name=\"ProjectRunConfigurationManager\">\n  <configuration default=\"false\" name=\"Run Verifications\" type=\"GradleRunConfiguration\" factoryName=\"Gradle\">\n    <log_file alias=\"idea.log\" path=\"$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log\" />\n    <ExternalSystemSettings>\n      <option name=\"executionName\" />\n      <option name=\"externalProjectPath\" value=\"$PROJECT_DIR$\" />\n      <option name=\"externalSystemIdString\" value=\"GRADLE\" />\n      <option name=\"scriptParameters\" value=\"\" />\n      <option name=\"taskDescriptions\">\n        <list />\n      </option>\n      <option name=\"taskNames\">\n        <list>\n          <option value=\"runPluginVerifier\" />\n        </list>\n      </option>\n      <option name=\"vmOptions\" value=\"\" />\n    </ExternalSystemSettings>\n    <ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>\n    <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>\n    <DebugAllEnabled>false</DebugAllEnabled>\n    <method v=\"2\">\n      <option name=\"Gradle.BeforeRunTask\" enabled=\"true\" tasks=\"clean\" externalProjectPath=\"$PROJECT_DIR$\" vmOptions=\"\" scriptParameters=\"\" />\n    </method>\n  </configuration>\n</component>"
  },
  {
    "path": ".run/Run Qodana.run.xml",
    "content": "<component name=\"ProjectRunConfigurationManager\">\n  <configuration default=\"false\" name=\"Run Qodana\" type=\"GradleRunConfiguration\" factoryName=\"Gradle\">\n    <ExternalSystemSettings>\n      <option name=\"env\">\n        <map>\n          <entry key=\"QODANA_SHOW_REPORT\" value=\"true\" />\n        </map>\n      </option>\n      <option name=\"executionName\" />\n      <option name=\"externalProjectPath\" value=\"$PROJECT_DIR$\" />\n      <option name=\"externalSystemIdString\" value=\"GRADLE\" />\n      <option name=\"scriptParameters\" value=\"cleanInspections runInspections\" />\n      <option name=\"taskDescriptions\">\n        <list />\n      </option>\n      <option name=\"taskNames\">\n        <list />\n      </option>\n      <option name=\"vmOptions\" />\n    </ExternalSystemSettings>\n    <ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>\n    <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>\n    <DebugAllEnabled>false</DebugAllEnabled>\n    <method v=\"2\" />\n  </configuration>\n</component>"
  },
  {
    "path": "CHANGELOG.md",
    "content": "<!-- Keep a Changelog guide -> https://keepachangelog.com -->\n\n# intellij-platform-git-stats-plugin Changelog\n\n## [Unreleased]\n\n## [0.6.2] - 2025-05-13\n\n**2025.05.13**\n\n- ✨ Support 2025.1\n\n## [0.6.1] - 2024-11-19\n\n**2024.11.19**\n\n- 🐛 Fixed error basePath\n- 🐛 Fixed label width\n\n## [0.6.0] - 2024-11-17\n\n**2024.11.17**\n\n- ✨ Add git exclude path\n- ✨ Support 2024.3\n\n## [0.5.0] - 2024-09-18\n\n**2024.09.18**\n\n- ✨ Support 2024.2\n\n## [0.4.0] - 2024-05-29\n\n**2024.05.29**\n\n- ✨ Support UTF-8\n\n## [0.0.2] - 2023-05-26\n\n**2023.05.26**\n\n- ✨ Add advanced mode\n- ✨ 添加高级模式\n\n## [0.0.1] - 2023-05-15\n\n### Added\n\n- Displays the code statistics table\n\n[Unreleased]: https://github.com/zhensherlock/intellij-platform-git-stats-plugin/compare/v0.6.2...HEAD\n[0.6.2]: https://github.com/zhensherlock/intellij-platform-git-stats-plugin/compare/v0.6.1...v0.6.2\n[0.6.1]: https://github.com/zhensherlock/intellij-platform-git-stats-plugin/compare/v0.6.0...v0.6.1\n[0.6.0]: https://github.com/zhensherlock/intellij-platform-git-stats-plugin/compare/v0.5.0...v0.6.0\n[0.5.0]: https://github.com/zhensherlock/intellij-platform-git-stats-plugin/compare/v0.4.0...v0.5.0\n[0.4.0]: https://github.com/zhensherlock/intellij-platform-git-stats-plugin/compare/v0.0.2...v0.4.0\n[0.0.2]: https://github.com/zhensherlock/intellij-platform-git-stats-plugin/compare/v0.0.1...v0.0.2\n[0.0.1]: https://github.com/zhensherlock/intellij-platform-git-stats-plugin/commits/v0.0.1\n[//]: #\n"
  },
  {
    "path": "README.md",
    "content": "# intellij-platform-git-stats-plugin\n\n![Build](https://github.com/zhensherlock/intellij-platform-git-stats-plugin/workflows/Build/badge.svg)\n[![Version](https://img.shields.io/jetbrains/plugin/v/com.huayi.intellijplatform.gitstats.svg)](https://plugins.jetbrains.com/plugin/com.huayi.intellijplatform.gitstats)\n[![Downloads](https://img.shields.io/jetbrains/plugin/d/com.huayi.intellijplatform.gitstats.svg)](https://plugins.jetbrains.com/plugin/com.huayi.intellijplatform.gitstats)\n\n[//]: # (## Template ToDo list)\n\n[//]: # (- [x] Create a new [IntelliJ Platform Plugin Template][template] project.)\n\n[//]: # (- [ ] Get familiar with the [template documentation][template].)\n\n[//]: # (- [ ] Adjust the [pluginGroup]&#40;./gradle.properties&#41;, [plugin ID]&#40;./src/main/resources/META-INF/plugin.xml&#41; and [sources package]&#40;./src/main/kotlin&#41;.)\n\n[//]: # (- [ ] Adjust the plugin description in `README` &#40;see [Tips][docs:plugin-description]&#41;)\n\n[//]: # (- [ ] Review the [Legal Agreements]&#40;https://plugins.jetbrains.com/docs/marketplace/legal-agreements.html?from=IJPluginTemplate&#41;.)\n\n[//]: # (- [ ] [Publish a plugin manually]&#40;https://plugins.jetbrains.com/docs/intellij/publishing-plugin.html?from=IJPluginTemplate&#41; for the first time.)\n\n[//]: # (- [ ] Set the `PLUGIN_ID` in the above README badges.)\n\n[//]: # (- [ ] Set the [Plugin Signing]&#40;https://plugins.jetbrains.com/docs/intellij/plugin-signing.html?from=IJPluginTemplate&#41; related [secrets]&#40;https://github.com/JetBrains/intellij-platform-plugin-template#environment-variables&#41;.)\n\n[//]: # (- [ ] Set the [Deployment Token]&#40;https://plugins.jetbrains.com/docs/marketplace/plugin-upload.html?from=IJPluginTemplate&#41;.)\n\n[//]: # (- [ ] Click the <kbd>Watch</kbd> button on the top of the [IntelliJ Platform Plugin Template][template] to be notified about releases containing new features and fixes.)\n\n<!-- Plugin description -->\nThis plugin aims to help users better understand their code writing by counting the modifications of the source code in the project directory opened by the current IDE. It groups and counts the number of added lines of code, deleted lines of code, and modified files within a certain time period, and finally presents the results in a list form, allowing users to have a clear understanding of the overall code writing situation of their projects.\n\n本插件旨在通过统计当前IDE打开的项目目录中的源代码修改情况，帮助用户更好地了解自己的代码编写情况。通过分组统计某个时间段内的添加代码行数、删除代码行数、修改文件数量，最后用列表形式展现，让用户清晰地了解自己项目的整体编写情况。\n<!-- Plugin description end -->\n\n## Installation\n\n- Using IDE built-in plugin system:\n  \n  <kbd>Settings/Preferences</kbd> > <kbd>Plugins</kbd> > <kbd>Marketplace</kbd> > <kbd>Search for \"intellij-platform-git-stats-plugin\"</kbd> >\n  <kbd>Install Plugin</kbd>\n  \n- Manually:\n\n  Download the [latest release](https://github.com/zhensherlock/intellij-platform-git-stats-plugin/releases/latest) and install it manually using\n  <kbd>Settings/Preferences</kbd> > <kbd>Plugins</kbd> > <kbd>⚙️</kbd> > <kbd>Install plugin from disk...</kbd>\n\n\n---\nPlugin based on the [IntelliJ Platform Plugin Template][template].\n\n[template]: https://github.com/JetBrains/intellij-platform-plugin-template\n[docs:plugin-description]: https://plugins.jetbrains.com/docs/intellij/plugin-user-experience.html#plugin-description-and-presentation"
  },
  {
    "path": "build.gradle.kts",
    "content": "import org.jetbrains.changelog.Changelog\nimport org.jetbrains.changelog.markdownToHTML\n\nfun properties(key: String) = providers.gradleProperty(key)\nfun environment(key: String) = providers.environmentVariable(key)\n\nplugins {\n    id(\"java\") // Java support\n    alias(libs.plugins.kotlin) // Kotlin support\n    alias(libs.plugins.gradleIntelliJPlugin) // Gradle IntelliJ Plugin\n    alias(libs.plugins.changelog) // Gradle Changelog Plugin\n    alias(libs.plugins.qodana) // Gradle Qodana Plugin\n    alias(libs.plugins.kover) // Gradle Kover Plugin\n}\n\ngroup = properties(\"pluginGroup\").get()\nversion = properties(\"pluginVersion\").get()\n\n// Configure project's dependencies\nrepositories {\n    mavenCentral()\n}\n\n// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog\ndependencies {\n//    implementation(libs.annotations)\n//    implementation(\"org.swinglabs:swingx:1.6.1\")\n//    implementation(\"org.jfxtras:jfxtras-controls:17-r1\")\n//    implementation(\"org.eclipse.jgit:org.eclipse.jgit:6.5.0.202303070854-r\")\n}\n\n// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+.\nkotlin {\n    jvmToolchain(11)\n}\n\n// Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html\nintellij {\n    pluginName = properties(\"pluginName\")\n    version = properties(\"platformVersion\")\n    type = properties(\"platformType\")\n\n    // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.\n    plugins = properties(\"platformPlugins\").map { it.split(',').map(String::trim).filter(String::isNotEmpty) }\n}\n\n// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin\nchangelog {\n    groups.empty()\n    repositoryUrl = properties(\"pluginRepositoryUrl\")\n}\n\n// Configure Gradle Qodana Plugin - read more: https://github.com/JetBrains/gradle-qodana-plugin\n//qodana {\n//    cachePath = provider { file(\".qodana\").canonicalPath }\n//    reportPath = provider { file(\"build/reports/inspections\").canonicalPath }\n//    saveReport = true\n//    showReport = environment(\"QODANA_SHOW_REPORT\").map { it.toBoolean() }.getOrElse(false)\n//}\n\n// Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration\n//koverReport {\n//    defaults {\n//        xml {\n//            onCheck = true\n//        }\n//    }\n//}\n\ntasks {\n    wrapper {\n        gradleVersion = properties(\"gradleVersion\").get()\n    }\n\n    patchPluginXml {\n        version = properties(\"pluginVersion\")\n        sinceBuild = properties(\"pluginSinceBuild\")\n        untilBuild = properties(\"pluginUntilBuild\")\n\n        // Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest\n        pluginDescription = providers.fileContents(layout.projectDirectory.file(\"README.md\")).asText.map {\n            val start = \"<!-- Plugin description -->\"\n            val end = \"<!-- Plugin description end -->\"\n\n            with (it.lines()) {\n                if (!containsAll(listOf(start, end))) {\n                    throw GradleException(\"Plugin description section not found in README.md:\\n$start ... $end\")\n                }\n                subList(indexOf(start) + 1, indexOf(end)).joinToString(\"\\n\").let(::markdownToHTML)\n            }\n        }\n\n        val changelog = project.changelog // local variable for configuration cache compatibility\n        // Get the latest available change notes from the changelog file\n        changeNotes = properties(\"pluginVersion\").map { pluginVersion ->\n            with(changelog) {\n                renderItem(\n                    (getOrNull(pluginVersion) ?: getUnreleased())\n                        .withHeader(false)\n                        .withEmptySections(false),\n                    Changelog.OutputType.HTML,\n                )\n            }\n        }\n    }\n\n    // Configure UI tests plugin\n    // Read more: https://github.com/JetBrains/intellij-ui-test-robot\n    runIdeForUiTests {\n        systemProperty(\"robot-server.port\", \"8082\")\n        systemProperty(\"ide.mac.message.dialogs.as.sheets\", \"false\")\n        systemProperty(\"jb.privacy.policy.text\", \"<!--999.999-->\")\n        systemProperty(\"jb.consents.confirmation.enabled\", \"false\")\n    }\n\n    signPlugin {\n        certificateChain = environment(\"CERTIFICATE_CHAIN\")\n        privateKey = environment(\"PRIVATE_KEY\")\n        password = environment(\"PRIVATE_KEY_PASSWORD\")\n    }\n\n    publishPlugin {\n        dependsOn(\"patchChangelog\")\n        token = environment(\"PUBLISH_TOKEN\")\n        // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3\n        // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:\n        // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel\n        channels = properties(\"pluginVersion\").map { listOf(it.split('-').getOrElse(1) { \"default\" }.split('.').first()) }\n    }\n}\n"
  },
  {
    "path": "gradle/libs.versions.toml",
    "content": "[versions]\n# libraries\nannotations = \"24.1.0\"\n\n# plugins\ndokka = \"1.9.20\"\nkotlin = \"2.0.10\"\nchangelog = \"2.2.1\"\ngradleIntelliJPlugin = \"1.17.4\"\nqodana = \"2024.3.3\"\nkover = \"0.8.3\"\n\n[libraries]\nannotations = { group = \"org.jetbrains\", name = \"annotations\", version.ref = \"annotations\" }\n\n[plugins]\nchangelog = { id = \"org.jetbrains.changelog\", version.ref = \"changelog\" }\ndokka = { id = \"org.jetbrains.dokka\", version.ref = \"dokka\" }\ngradleIntelliJPlugin = { id = \"org.jetbrains.intellij\", version.ref = \"gradleIntelliJPlugin\" }\nkotlin = { id = \"org.jetbrains.kotlin.jvm\", version.ref = \"kotlin\" }\nkover = { id = \"org.jetbrains.kotlinx.kover\", version.ref = \"kover\" }\nqodana = { id = \"org.jetbrains.qodana\", version.ref = \"qodana\" }\n"
  },
  {
    "path": "gradle/wrapper/gradle-wrapper.properties",
    "content": "distributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-8.1-bin.zip\nnetworkTimeout=10000\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\n"
  },
  {
    "path": "gradle.properties",
    "content": "# IntelliJ Platform Artifacts Repositories -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html\n\npluginGroup = com.huayi.intellijplatform.gitstats\npluginName = GitStats\npluginRepositoryUrl = https://github.com/zhensherlock/intellij-platform-git-stats-plugin\n# SemVer format -> https://semver.org\npluginVersion = 0.6.2\n\n# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html\npluginSinceBuild = 221\npluginUntilBuild = 251.*\n\n# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension\nplatformType = IC\nplatformVersion = 2022.1.4\n\n# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html\n# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22\nplatformPlugins = Git4Idea\n\n# Gradle Releases -> https://github.com/gradle/gradle/releases\ngradleVersion = 8.1\n\n# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib\nkotlin.stdlib.default.dependency = false\n\n# Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html\norg.gradle.configuration-cache = true\n\n# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html\norg.gradle.caching = true\n\n# Enable Gradle Kotlin DSL Lazy Property Assignment -> https://docs.gradle.org/current/userguide/kotlin_dsl.html#kotdsl:assignment\nsystemProp.org.gradle.unsafe.kotlin.assignment = true\n\n# Temporary workaround for Kotlin Compiler OutOfMemoryError -> https://jb.gg/intellij-platform-kotlin-oom\nkotlin.incremental.useClasspathSnapshot = false\n"
  },
  {
    "path": "gradlew",
    "content": "#!/bin/sh\n\n#\n# Copyright © 2015-2021 the original authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#      https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n##############################################################################\n#\n#   Gradle start up script for POSIX generated by Gradle.\n#\n#   Important for running:\n#\n#   (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is\n#       noncompliant, but you have some other compliant shell such as ksh or\n#       bash, then to run this script, type that shell name before the whole\n#       command line, like:\n#\n#           ksh Gradle\n#\n#       Busybox and similar reduced shells will NOT work, because this script\n#       requires all of these POSIX shell features:\n#         * functions;\n#         * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,\n#           «${var#prefix}», «${var%suffix}», and «$( cmd )»;\n#         * compound commands having a testable exit status, especially «case»;\n#         * various built-in commands including «command», «set», and «ulimit».\n#\n#   Important for patching:\n#\n#   (2) This script targets any POSIX shell, so it avoids extensions provided\n#       by Bash, Ksh, etc; in particular arrays are avoided.\n#\n#       The \"traditional\" practice of packing multiple parameters into a\n#       space-separated string is a well documented source of bugs and security\n#       problems, so this is (mostly) avoided, by progressively accumulating\n#       options in \"$@\", and eventually passing that to Java.\n#\n#       Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,\n#       and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;\n#       see the in-line comments for details.\n#\n#       There are tweaks for specific operating systems such as AIX, CygWin,\n#       Darwin, MinGW, and NonStop.\n#\n#   (3) This script is generated from the Groovy template\n#       https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt\n#       within the Gradle project.\n#\n#       You can find Gradle at https://github.com/gradle/gradle/.\n#\n##############################################################################\n\n# Attempt to set APP_HOME\n\n# Resolve links: $0 may be a link\napp_path=$0\n\n# Need this for daisy-chained symlinks.\nwhile\n    APP_HOME=${app_path%\"${app_path##*/}\"}  # leaves a trailing /; empty if no leading path\n    [ -h \"$app_path\" ]\ndo\n    ls=$( ls -ld \"$app_path\" )\n    link=${ls#*' -> '}\n    case $link in             #(\n      /*)   app_path=$link ;; #(\n      *)    app_path=$APP_HOME$link ;;\n    esac\ndone\n\n# This is normally unused\n# shellcheck disable=SC2034\nAPP_BASE_NAME=${0##*/}\nAPP_HOME=$( cd \"${APP_HOME:-./}\" && pwd -P ) || exit\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=maximum\n\nwarn () {\n    echo \"$*\"\n} >&2\n\ndie () {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n} >&2\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\nnonstop=false\ncase \"$( uname )\" in                #(\n  CYGWIN* )         cygwin=true  ;; #(\n  Darwin* )         darwin=true  ;; #(\n  MSYS* | MINGW* )  msys=true    ;; #(\n  NONSTOP* )        nonstop=true ;;\nesac\n\nCLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar\n\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=$JAVA_HOME/jre/sh/java\n    else\n        JAVACMD=$JAVA_HOME/bin/java\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=java\n    which java >/dev/null 2>&1 || die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\nfi\n\n# Increase the maximum file descriptors if we can.\nif ! \"$cygwin\" && ! \"$darwin\" && ! \"$nonstop\" ; then\n    case $MAX_FD in #(\n      max*)\n        # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.\n        # shellcheck disable=SC3045\n        MAX_FD=$( ulimit -H -n ) ||\n            warn \"Could not query maximum file descriptor limit\"\n    esac\n    case $MAX_FD in  #(\n      '' | soft) :;; #(\n      *)\n        # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.\n        # shellcheck disable=SC3045\n        ulimit -n \"$MAX_FD\" ||\n            warn \"Could not set maximum file descriptor limit to $MAX_FD\"\n    esac\nfi\n\n# Collect all arguments for the java command, stacking in reverse order:\n#   * args from the command line\n#   * the main class name\n#   * -classpath\n#   * -D...appname settings\n#   * --module-path (only if needed)\n#   * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.\n\n# For Cygwin or MSYS, switch paths to Windows format before running java\nif \"$cygwin\" || \"$msys\" ; then\n    APP_HOME=$( cygpath --path --mixed \"$APP_HOME\" )\n    CLASSPATH=$( cygpath --path --mixed \"$CLASSPATH\" )\n\n    JAVACMD=$( cygpath --unix \"$JAVACMD\" )\n\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    for arg do\n        if\n            case $arg in                                #(\n              -*)   false ;;                            # don't mess with options #(\n              /?*)  t=${arg#/} t=/${t%%/*}              # looks like a POSIX filepath\n                    [ -e \"$t\" ] ;;                      #(\n              *)    false ;;\n            esac\n        then\n            arg=$( cygpath --path --ignore --mixed \"$arg\" )\n        fi\n        # Roll the args list around exactly as many times as the number of\n        # args, so each arg winds up back in the position where it started, but\n        # possibly modified.\n        #\n        # NB: a `for` loop captures its iteration list before it begins, so\n        # changing the positional parameters here affects neither the number of\n        # iterations, nor the values presented in `arg`.\n        shift                   # remove old arg\n        set -- \"$@\" \"$arg\"      # push replacement arg\n    done\nfi\n\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS='\"-Xmx64m\" \"-Xms64m\"'\n\n# Collect all arguments for the java command;\n#   * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of\n#     shell script including quotes and variable substitutions, so put them in\n#     double quotes to make sure that they get re-expanded; and\n#   * put everything else in single quotes, so that it's not re-expanded.\n\nset -- \\\n        \"-Dorg.gradle.appname=$APP_BASE_NAME\" \\\n        -classpath \"$CLASSPATH\" \\\n        org.gradle.wrapper.GradleWrapperMain \\\n        \"$@\"\n\n# Stop when \"xargs\" is not available.\nif ! command -v xargs >/dev/null 2>&1\nthen\n    die \"xargs is not available\"\nfi\n\n# Use \"xargs\" to parse quoted args.\n#\n# With -n1 it outputs one arg per line, with the quotes and backslashes removed.\n#\n# In Bash we could simply go:\n#\n#   readarray ARGS < <( xargs -n1 <<<\"$var\" ) &&\n#   set -- \"${ARGS[@]}\" \"$@\"\n#\n# but POSIX shell has neither arrays nor command substitution, so instead we\n# post-process each arg (as a line of input to sed) to backslash-escape any\n# character that might be a shell metacharacter, then use eval to reverse\n# that process (while maintaining the separation between arguments), and wrap\n# the whole thing up as a single \"set\" statement.\n#\n# This will of course break if any of these variables contains a newline or\n# an unmatched quote.\n#\n\neval \"set -- $(\n        printf '%s\\n' \"$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS\" |\n        xargs -n1 |\n        sed ' s~[^-[:alnum:]+,./:=@_]~\\\\&~g; ' |\n        tr '\\n' ' '\n    )\" '\"$@\"'\n\nexec \"$JAVACMD\" \"$@\"\n"
  },
  {
    "path": "gradlew.bat",
    "content": "@rem\n@rem Copyright 2015 the original author or authors.\n@rem\n@rem Licensed under the Apache License, Version 2.0 (the \"License\");\n@rem you may not use this file except in compliance with the License.\n@rem You may obtain a copy of the License at\n@rem\n@rem      https://www.apache.org/licenses/LICENSE-2.0\n@rem\n@rem Unless required by applicable law or agreed to in writing, software\n@rem distributed under the License is distributed on an \"AS IS\" BASIS,\n@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n@rem See the License for the specific language governing permissions and\n@rem limitations under the License.\n@rem\n\n@if \"%DEBUG%\"==\"\" @echo off\n@rem ##########################################################################\n@rem\n@rem  Gradle startup script for Windows\n@rem\n@rem ##########################################################################\n\n@rem Set local scope for the variables with windows NT shell\nif \"%OS%\"==\"Windows_NT\" setlocal\n\nset DIRNAME=%~dp0\nif \"%DIRNAME%\"==\"\" set DIRNAME=.\n@rem This is normally unused\nset APP_BASE_NAME=%~n0\nset APP_HOME=%DIRNAME%\n\n@rem Resolve any \".\" and \"..\" in APP_HOME to make it shorter.\nfor %%i in (\"%APP_HOME%\") do set APP_HOME=%%~fi\n\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nset DEFAULT_JVM_OPTS=\"-Xmx64m\" \"-Xms64m\"\n\n@rem Find java.exe\nif defined JAVA_HOME goto findJavaFromJavaHome\n\nset JAVA_EXE=java.exe\n%JAVA_EXE% -version >NUL 2>&1\nif %ERRORLEVEL% equ 0 goto execute\n\necho.\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:findJavaFromJavaHome\nset JAVA_HOME=%JAVA_HOME:\"=%\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\n\nif exist \"%JAVA_EXE%\" goto execute\n\necho.\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:execute\n@rem Setup the command line\n\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\n\n\n@rem Execute Gradle\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %*\n\n:end\n@rem End local scope for the variables with windows NT shell\nif %ERRORLEVEL% equ 0 goto mainEnd\n\n:fail\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\nrem the _cmd.exe /c_ return code!\nset EXIT_CODE=%ERRORLEVEL%\nif %EXIT_CODE% equ 0 set EXIT_CODE=1\nif not \"\"==\"%GRADLE_EXIT_CONSOLE%\" exit %EXIT_CODE%\nexit /b %EXIT_CODE%\n\n:mainEnd\nif \"%OS%\"==\"Windows_NT\" endlocal\n\n:omega\n"
  },
  {
    "path": "qodana.yml",
    "content": "# Qodana configuration:\n# https://www.jetbrains.com/help/qodana/qodana-yaml.html\n\nversion: 1.0\nlinter: jetbrains/qodana-jvm-community:latest\nprojectJDK: \"17\"\nprofile:\n  name: qodana.recommended\nexclude:\n  - name: All\n    paths:\n      - .qodana\n"
  },
  {
    "path": "settings.gradle.kts",
    "content": "rootProject.name = \"intellij-platform-git-stats-plugin\"\n"
  },
  {
    "path": "src/main/kotlin/com/huayi/intellijplatform/gitstats/MyBundle.kt",
    "content": "package com.huayi.intellijplatform.gitstats\n\nimport com.intellij.DynamicBundle\nimport org.jetbrains.annotations.NonNls\nimport org.jetbrains.annotations.PropertyKey\n\n@NonNls\nprivate const val BUNDLE = \"messages.MyBundle\"\n\nobject MyBundle : DynamicBundle(BUNDLE) {\n\n    @Suppress(\"SpreadOperator\")\n    @JvmStatic\n    fun message(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any) =\n        getMessage(key, *params)\n\n    @Suppress(\"SpreadOperator\", \"unused\")\n    @JvmStatic\n    fun messagePointer(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any) =\n        getLazyMessage(key, *params)\n}\n"
  },
  {
    "path": "src/main/kotlin/com/huayi/intellijplatform/gitstats/components/RefreshButton.kt",
    "content": "package com.huayi.intellijplatform.gitstats.components\n\nimport java.awt.event.ActionEvent\nimport java.awt.event.ActionListener\nimport javax.swing.JButton\nimport javax.swing.SwingWorker\n\n\nclass RefreshButton(text: String?) : JButton(text), ActionListener {\n    private var isLoading = false\n\n    init {\n        addActionListener(this)\n    }\n\n    override fun actionPerformed(e: ActionEvent) {\n        isLoading = true\n        isEnabled = false\n        text = \"Loading...\"\n        BackgroundTask().execute()\n    }\n\n    private inner class BackgroundTask : SwingWorker<String, String>() {\n        override fun doInBackground(): String {\n            return \"null\"\n        }\n\n        override fun done() {\n            isLoading = false\n            isEnabled = true\n            text = \"Click me\"\n        }\n    }\n}"
  },
  {
    "path": "src/main/kotlin/com/huayi/intellijplatform/gitstats/components/SettingAction.kt",
    "content": "package com.huayi.intellijplatform.gitstats.components\n\nimport com.huayi.intellijplatform.gitstats.models.SettingModel\nimport com.intellij.icons.AllIcons\nimport com.intellij.openapi.actionSystem.AnActionEvent\nimport com.intellij.openapi.project.DumbAwareAction\nimport org.jetbrains.annotations.Nls\nimport java.util.function.Supplier\n\nclass SettingAction(text: @Nls String, defaultSettingModel: SettingModel, private val onSettingChanged: (SettingModel) -> Unit) :\n    DumbAwareAction(Supplier { text }, AllIcons.General.Settings) {\n    private var settingModel: SettingModel = defaultSettingModel\n        set(value) {\n            field = value\n            onSettingChanged.invoke(value)\n        }\n\n    override fun actionPerformed(e: AnActionEvent) {\n        val dialogWrapper = SettingDialogWrapper(settingModel)\n        dialogWrapper.showAndGet()\n        if (dialogWrapper.isOK) {\n            settingModel = dialogWrapper.settingModel\n        }\n    }\n}"
  },
  {
    "path": "src/main/kotlin/com/huayi/intellijplatform/gitstats/components/SettingDialogWrapper.kt",
    "content": "package com.huayi.intellijplatform.gitstats.components\n\nimport com.huayi.intellijplatform.gitstats.MyBundle\nimport com.huayi.intellijplatform.gitstats.models.SettingModel\nimport com.intellij.openapi.ui.ComboBox\nimport com.intellij.openapi.ui.DialogWrapper\nimport com.intellij.ui.components.JBTextField\nimport com.intellij.ui.components.JBLabel\nimport com.intellij.ui.components.JBPanel\nimport java.awt.Dimension\nimport java.awt.GridLayout\nimport javax.swing.BoxLayout\nimport javax.swing.JComponent\n\n\nclass SettingDialogWrapper(defaultSettingModel: SettingModel) : DialogWrapper(true) {\n    var settingModel: SettingModel = defaultSettingModel\n    private lateinit var modeComboBox: ComboBox<String>\n    private lateinit var excludeField: JBTextField\n    init {\n        title = \"Git Stats Setting\"\n        init()\n    }\n    override fun createCenterPanel(): JComponent {\n        val dialogPanel = JBPanel<JBPanel<*>>().apply {\n            layout = GridLayout(2, 1, 0, 5)\n            preferredSize = Dimension(260, 60)\n        }\n        val modeFieldPanel = JBPanel<JBPanel<*>>().apply {\n            layout = BoxLayout(this, BoxLayout.X_AXIS)\n            add(JBLabel(MyBundle.message(\"settingDialogModeLabel\", \"\")).apply {\n                preferredSize = Dimension(60, 30)\n            })\n            modeComboBox = ComboBox<String>().apply {\n                addItem(\"Top-speed\")\n                addItem(\"Advanced\")\n                selectedItem = settingModel.mode\n            }\n            add(modeComboBox)\n        }\n        dialogPanel.add(modeFieldPanel)\n\n        val excludeFieldPanel = JBPanel<JBPanel<*>>().apply {\n            layout = BoxLayout(this, BoxLayout.X_AXIS)\n            add(JBLabel(MyBundle.message(\"settingDialogExcludeLabel\", \"\")).apply {\n                preferredSize = Dimension(60, 30)\n            })\n            excludeField = JBTextField().apply {\n                text = settingModel.exclude\n            }\n            add(excludeField)\n        }\n        dialogPanel.add(excludeFieldPanel)\n\n        return dialogPanel\n    }\n\n    override fun doOKAction() {\n        settingModel.mode = modeComboBox.selectedItem as String\n        settingModel.exclude = excludeField.text\n        super.doOKAction()\n    }\n}"
  },
  {
    "path": "src/main/kotlin/com/huayi/intellijplatform/gitstats/listeners/MyFrameStateListener.kt",
    "content": "package com.huayi.intellijplatform.gitstats.listeners\n\nimport com.intellij.ide.FrameStateListener\nimport com.intellij.openapi.diagnostic.thisLogger\n\ninternal class MyFrameStateListener : FrameStateListener {\n\n    override fun onFrameActivated() {\n        thisLogger().warn(\"Don't forget to remove all non-needed sample code files with their corresponding registration entries in `plugin.xml`.\")\n    }\n}\n"
  },
  {
    "path": "src/main/kotlin/com/huayi/intellijplatform/gitstats/models/SettingModel.kt",
    "content": "package com.huayi.intellijplatform.gitstats.models\n\ndata class SettingModel (\n    var mode: String = \"Top-speed\",\n    var exclude: String = \"\"\n)"
  },
  {
    "path": "src/main/kotlin/com/huayi/intellijplatform/gitstats/services/GitStatsService.kt",
    "content": "package com.huayi.intellijplatform.gitstats.services\n\nimport com.huayi.intellijplatform.gitstats.models.SettingModel\nimport com.intellij.openapi.components.Service\nimport com.intellij.openapi.project.Project\nimport com.huayi.intellijplatform.gitstats.toolWindow.StatsTableModel\nimport com.huayi.intellijplatform.gitstats.utils.GitUtils\nimport com.huayi.intellijplatform.gitstats.utils.Utils\nimport java.text.SimpleDateFormat\nimport java.util.*\n\n@Service(Service.Level.PROJECT)\nclass GitStatsService(p: Project) {\n    private var project: Project\n\n    init {\n        project = p\n//        thisLogger().info(MyBundle.message(\"projectService\", project.name))\n    }\n\n//    fun getRandomNumber() = (1..100).random()\n\n    fun getUserStats(startTime: Date, endTime: Date, settingModel: SettingModel): StatsTableModel {\n        if (!Utils.checkDirectoryExists(project.basePath)) {\n            return StatsTableModel(arrayOf(), arrayOf())\n        }\n        val gitUtils = GitUtils(project)\n        val userStats = gitUtils.getUserStats(\n            SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\").format(startTime),\n            SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\").format(endTime),\n            settingModel\n        )\n        val data = userStats.map { item ->\n            arrayOf(\n                item.author,\n                item.commitCount.toString(),\n                item.addedLines.toString(),\n                item.deletedLines.toString(),\n                item.modifiedFileCount.toString()\n            )\n        }.toTypedArray()\n        return StatsTableModel(\n            data,\n            arrayOf(\"Author\", \"CommitCount\", \"AddedLines\", \"DeletedLines\", \"ModifiedFileCount\")\n        )\n    }\n\n    fun getTopSpeedUserStats(startTime: Date, endTime: Date, settingModel: SettingModel): StatsTableModel {\n        if (!Utils.checkDirectoryExists(project.basePath)) {\n            return StatsTableModel(arrayOf(), arrayOf())\n        }\n        val gitUtils = GitUtils(project)\n        val userStats = gitUtils.getTopSpeedUserStats(\n            SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\").format(startTime),\n            SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\").format(endTime),\n            settingModel\n        )\n        val data = userStats.map { item ->\n            arrayOf(\n                item.author,\n                item.addedLines.toString(),\n                item.deletedLines.toString(),\n                item.modifiedFileCount.toString()\n            )\n        }.toTypedArray()\n        return StatsTableModel(\n            data,\n            arrayOf(\"Author\", \"AddedLines\", \"DeletedLines\", \"ModifiedFileCount\")\n        )\n    }\n}\n"
  },
  {
    "path": "src/main/kotlin/com/huayi/intellijplatform/gitstats/toolWindow/GitStatsWindowFactory.kt",
    "content": "package com.huayi.intellijplatform.gitstats.toolWindow\n\nimport com.huayi.intellijplatform.gitstats.MyBundle\nimport com.huayi.intellijplatform.gitstats.components.SettingAction\nimport com.huayi.intellijplatform.gitstats.models.SettingModel\nimport com.huayi.intellijplatform.gitstats.services.GitStatsService\nimport com.huayi.intellijplatform.gitstats.utils.Utils\nimport com.intellij.icons.AllIcons\nimport com.intellij.openapi.actionSystem.AnAction\nimport com.intellij.openapi.components.service\nimport com.intellij.openapi.diagnostic.thisLogger\nimport com.intellij.openapi.project.Project\nimport com.intellij.openapi.wm.ToolWindow\nimport com.intellij.openapi.wm.ToolWindowFactory\nimport com.intellij.ui.components.*\nimport com.intellij.ui.content.ContentFactory\nimport com.intellij.ui.table.JBTable\nimport com.michaelbaranov.microba.calendar.DatePicker\nimport java.awt.BorderLayout\nimport java.awt.CardLayout\nimport java.awt.Dimension\nimport java.awt.Font\nimport java.util.*\nimport javax.swing.*\nimport kotlin.concurrent.thread\n\n\nclass GitStatsWindowFactory : ToolWindowFactory {\n\n//    init {\n//        thisLogger().warn(\"Don't forget to remove all non-needed sample code files with their corresponding registration entries in `plugin.xml`.\")\n//    }\n\n    private val contentFactory = ContentFactory.SERVICE.getInstance()\n\n    override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) {\n        val gitStatsWindow = GitStatsWindow(toolWindow)\n        val content = contentFactory.createContent(gitStatsWindow.getContent(toolWindow), null, false)\n        toolWindow.contentManager.addContent(content)\n    }\n\n    override fun shouldBeAvailable(project: Project) = true\n\n    class GitStatsWindow(toolWindow: ToolWindow) {\n\n        private val service = toolWindow.project.service<GitStatsService>()\n\n        fun getContent(toolWindow: ToolWindow) = JBPanel<JBPanel<*>>(BorderLayout()).apply {\n            var (startTime, endTime) = Utils.getThisWeekDateTimeRange()\n            val settingModel = SettingModel().apply {\n                mode = \"Top-speed\"\n                exclude = \"\"\n            }\n            val table = JBTable().apply {\n                font = Font(\"Microsoft YaHei\", Font.PLAIN, 14)\n                tableHeader.font = Font(\"Microsoft YaHei\", Font.BOLD, 14)\n                border = BorderFactory.createEmptyBorder(0, 0, 0, 0)\n                columnSelectionAllowed = false\n                rowSelectionAllowed = true\n                rowHeight = 30\n                setSelectionMode(ListSelectionModel.SINGLE_SELECTION)\n            }\n            var refreshButton: JButton\n            border = BorderFactory.createEmptyBorder(0, 0, 0, 0)\n\n            val contentPanel = JBPanel<JBPanel<*>>().apply {\n                val tablePanel = JBScrollPane(table).apply {\n                    isFocusable = false\n                    border = BorderFactory.createEmptyBorder(0, 0, 0, 0)\n                }\n                add(tablePanel)\n\n                val loadingPanel = JBLoadingPanel(BorderLayout(), toolWindow.project).also {\n                    it.startLoading()\n                }\n                add(loadingPanel)\n\n                layout = CardLayout().also {\n                    it.addLayoutComponent(tablePanel, \"content_table\")\n                    it.addLayoutComponent(loadingPanel, \"content_loading\")\n                }\n            }\n            val headerPanel = JBPanel<JBPanel<*>>().apply {\n                layout = BoxLayout(this, BoxLayout.X_AXIS)\n                add(JBBox.createHorizontalStrut(10))\n                add(JBLabel(MyBundle.message(\"filterStartTimeLabel\", \"\")))\n//                add(LocalDateTimePicker(LocalDateTime.now()))\n//                datePicker.dateFormat = SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\")\n//                add(CalendarView())\n//                val datePicker = JXDatePicker()\n//                datePicker.date = Date()\n//                add(DatePicker(Date.from(startTime.atStartOfDay(ZoneId.systemDefault()).toInstant())).apply {\n                add(DatePicker(startTime).apply {\n                    isDropdownFocusable = false\n//                    isFieldEditable = false\n                    val size = Dimension(200, preferredSize.height)\n                    preferredSize = size\n                    maximumSize = size\n                    minimumSize = size\n                    isShowNoneButton = false\n                    isShowNumberOfWeek = true\n                    isStripTime = true\n                    components.last().preferredSize = Dimension(30, 30)\n                    addPropertyChangeListener {\n                        if (it.propertyName == \"date\" && it.newValue != null) {\n                            startTime = it.newValue as Date\n                        }\n                    }\n                })\n                add(JBBox.createHorizontalStrut(10))\n                add(JBLabel(MyBundle.message(\"filterEndTimeLabel\", \"\")))\n                add(DatePicker(endTime).apply {\n                    isDropdownFocusable = false\n                    val size = Dimension(200, preferredSize.height)\n                    preferredSize = size\n                    maximumSize = size\n                    minimumSize = size\n                    isShowNoneButton = false\n                    isShowNumberOfWeek = true\n                    isStripTime = true\n                    components.last().preferredSize = Dimension(30, 30)\n                    addPropertyChangeListener {\n                        if (it.propertyName == \"date\" && it.newValue != null) {\n                            val calendar = Calendar.getInstance()\n                            calendar.time = (it.newValue as Date)\n                            calendar[Calendar.HOUR_OF_DAY] = 23\n                            calendar[Calendar.MINUTE] = 59\n                            calendar[Calendar.SECOND] = 59\n                            calendar[Calendar.MILLISECOND] = 999\n                            endTime = calendar.time\n                        }\n                    }\n                })\n//                add(LoadingButton(MyBundle.message(\"refreshButtonLabel\")))\n                refreshButton = JButton(MyBundle.message(\"refreshButtonLabel\"), AllIcons.Actions.Refresh).apply {\n                    addActionListener {\n                        (contentPanel.layout as CardLayout).show(contentPanel, \"content_loading\")\n                        isEnabled = false\n                        text = MyBundle.message(\"refreshButtonLoadingLabel\")\n                        thread {\n                            if (settingModel.mode === \"Top-speed\") {\n                                table.model = service.getTopSpeedUserStats(startTime, endTime, settingModel)\n                            } else {\n                                table.model = service.getUserStats(startTime, endTime, settingModel)\n                            }\n                            SwingUtilities.invokeLater {\n                                (contentPanel.layout as CardLayout).show(contentPanel, \"content_table\")\n                                isEnabled = true\n                                text = MyBundle.message(\"refreshButtonLabel\")\n                            }\n                        }\n                    }\n                    doClick()\n                }\n                add(refreshButton)\n                add(Box.createHorizontalGlue())\n//                add(IconLabelButton(AllIcons.General.Settings) {\n//                    SettingDialogWrapper().showAndGet()\n//                }.apply {\n//                    toolTipText = MyBundle.message(\"settingButtonTooltipText\")\n//                })\n//                add(JBBox.createHorizontalStrut(10))\n            }\n            add(headerPanel, BorderLayout.NORTH)\n\n            add(contentPanel, BorderLayout.CENTER)\n\n            val actionList: MutableList<AnAction> = ArrayList()\n            val settingAction =\n                SettingAction(MyBundle.message(\"settingButtonTooltipText\"), settingModel) { value ->\n                    settingModel.mode = value.mode\n                    settingModel.exclude = value.exclude\n                    refreshButton.doClick()\n                }\n            actionList.add(settingAction)\n            toolWindow.setTitleActions(actionList)\n        }\n    }\n}\n"
  },
  {
    "path": "src/main/kotlin/com/huayi/intellijplatform/gitstats/toolWindow/StatsTableModel.kt",
    "content": "package com.huayi.intellijplatform.gitstats.toolWindow\n\nimport javax.swing.table.DefaultTableModel\n\nclass StatsTableModel(data: Array<Array<String>>, columnNames: Array<String>) : DefaultTableModel(data, columnNames) {\n    override fun isCellEditable(row: Int, column: Int): Boolean {\n        return false\n    }\n}"
  },
  {
    "path": "src/main/kotlin/com/huayi/intellijplatform/gitstats/utils/GitUtils.kt",
    "content": "package com.huayi.intellijplatform.gitstats.utils\n\nimport git4idea.config.GitExecutableManager\nimport git4idea.config.GitExecutableDetector\nimport java.util.concurrent.TimeUnit\nimport com.intellij.openapi.project.Project\nimport com.huayi.intellijplatform.gitstats.models.SettingModel\n\ndata class UserStats(\n    val author: String,\n    var addedLines: Int = 0,\n    var deletedLines: Int = 0,\n    var modifiedFileCount: Int = 0,\n    var commitCount: Int = 0,\n    var commits: MutableList<CommitStats> = mutableListOf()\n)\n\ndata class CommitStats(\n    val hash: String,\n    val date: String,\n    var addedLines: Int = 0,\n    var deletedLines: Int = 0,\n    var modifiedFileCount: Int = 0,\n    var files: MutableList<CommitFilesStats> = mutableListOf()\n)\n\ndata class CommitFilesStats(\n    var addedLines: Int = 0, var deletedLines: Int = 0, var fileName: String\n)\n\nclass GitUtils(project: Project) {\n    private val gitExecutablePath: String = GitExecutableManager.getInstance().getExecutable(project).exePath\n    private val basePath: String = project.basePath as String\n//    private val basePath: String = \"/Users/sunzhenxuan/work/qcc/code/qcc_pro/pro-front\"\n    private val gitBashExecutablePath: String? = GitExecutableDetector.getBashExecutablePath(gitExecutablePath)\n\n//    init {\n//    }\n//    companion object {\n//        fun getGitExecutablePath(project: Project): String {\n//            return GitExecutableManager.getInstance().getExecutable(project).exePath\n//        }\n//    }\n\n    fun getTopSpeedUserStats(\n        startDate: String, endDate: String, settingModel: SettingModel\n    ): Array<UserStats> {\n        val timeoutAmount = 60L\n        val timeUnit = TimeUnit.SECONDS\n        val os = Utils.getOS()\n        val commands = mutableListOf<String>()\n        val folder = if (settingModel.exclude.isEmpty()) \".\" else \". ':(exclude)${settingModel.exclude}'\"\n        when {\n            os == \"Windows\" && gitBashExecutablePath?.isNotEmpty() ?: false -> {\n                commands += gitBashExecutablePath!!\n                commands += \"-c\"\n                commands += \"git log --format=\\\"%aN\\\" | sort -u | while read name; do echo \\\"\\$name\\\"; git log --author=\\\\\\\"\\$name\\\\\\\" --pretty=tformat: --since=\\\\\\\"${startDate}\\\\\\\" --until=\\\\\\\"${endDate}\\\\\\\" --numstat -- $folder | awk '{ add += \\$1; subs += \\$2; file++ } END { printf(\\\\\\\"added lines: %s, removed lines: %s, modified files: %s\\\\n\\\\\\\", add ? add : 0, subs ? subs : 0, file ? file : 0) }' -; done\"\n            }\n            os == \"Windows\" && gitBashExecutablePath?.isEmpty() ?: false -> {\n                commands += \"powershell\"\n                commands += \"/c\"\n//                commands += \"C:\\\\\\\"Program Files\\\"\\\\Git\\\\cmd\\\\git.exe log --format='%aN' | sort -u | % { $name=$_; Write-Output $name; git log --author=$name --pretty=tformat: --since='2023-05-15 00:00:00' --until='2023-05-21 23:59:59' --numstat | ? { $_ -match '\\\\d' } | % { $add += [int]$_.Split()[0]; $subs += [int]$_.Split()[1]; $files++ } ; Write-Output ( 'added lines: ' + $add + ', removed lines: ' + $subs + ', modified files: ' + $files ) }\"\n            }\n            else -> {\n                commands += \"/bin/sh\"\n                commands += \"-c\"\n                commands += \"$gitExecutablePath log --format=\\\"%aN\\\" | sort -u | while read name; do echo \\\"\\$name\\\"; git log --author=\\\"\\$name\\\" --pretty=\\\"tformat:\\\" --since=\\\"$startDate\\\" --until=\\\"$endDate\\\" --numstat -- $folder | awk '{ add += \\$1; subs += \\$2; file++ } END { printf \\\"added lines: %s, removed lines: %s, modified files: %s\\\\n\\\", add ? add : 0, subs ? subs : 0, file ? file : 0 }' -; done\"\n            }\n        }\n        val process = Utils.runCommand(basePath, commands, timeoutAmount, timeUnit)\n        val regex = Regex(\"(.+)\\\\n+added lines: (\\\\d*), removed lines: (\\\\d+), modified files: (\\\\d+)\")\n        return regex.findAll(process!!.inputStream.bufferedReader().readText())\n            .map { result ->\n                val (author, addedLines, deletedLines, modifiedFileCount) = result.destructured\n                UserStats(author, addedLines.toInt(), deletedLines.toInt(), modifiedFileCount.toInt())\n            }.sortedByDescending { it.addedLines }.toList().toTypedArray()\n    }\n\n    fun getUserStats(\n        startDate: String,\n        endDate: String,\n        settingModel: SettingModel\n    ): Array<UserStats> {\n        val timeoutAmount = 60L\n        val timeUnit = TimeUnit.SECONDS\n        val separator = \"--\"\n        val os = Utils.getOS()\n        val commands = mutableListOf<String>()\n        val folder = if (settingModel.exclude.isEmpty()) \".\" else \". ':(exclude)${settingModel.exclude}'\"\n        if (os == \"Windows\" && gitBashExecutablePath?.isNotEmpty() == true) {\n            commands += gitBashExecutablePath\n            commands += \"-c\"\n            commands += \"git log --numstat --pretty=\\\"format:${separator}%h${separator}%ad${separator}%aN\\\" --since=\\\\\\\"${startDate}\\\\\\\" --until=\\\\\\\"${endDate}\\\\\\\" -- $folder\"\n        } else {\n            commands += \"/bin/sh\"\n            commands += \"-c\"\n            commands += \"$gitExecutablePath log --numstat --pretty=\\\"format:${separator}%h${separator}%ad${separator}%aN\\\" --since=\\\"$startDate\\\" --until=\\\"$endDate\\\" -- $folder\"\n        }\n\n        val process = Utils.runCommand(basePath, commands, timeoutAmount, timeUnit)\n\n        val userStatsData = mutableMapOf<String, UserStats>()\n        process!!.inputStream.bufferedReader().use { reader ->\n            var currentUserStatsData: UserStats? = null\n            reader.forEachLine { line ->\n                if (line.startsWith(separator)) {\n                    val (_, hash, date, author) = line.split(separator)\n                    currentUserStatsData = userStatsData.getOrPut(author) { UserStats(author) }.apply {\n                        commitCount++\n                        commits.add(CommitStats(hash, date))\n                    }\n                    return@forEachLine\n                }\n                if (line.isNotEmpty()) {\n                    val commitFilesStatsData = line.split(\"\\t\").let {\n                        CommitFilesStats(it[0].toIntOrNull() ?: 0, it[1].toIntOrNull() ?: 0, it[2])\n                    }\n                    currentUserStatsData!!.let { userStats ->\n                        userStats.apply {\n                            addedLines += commitFilesStatsData.addedLines\n                            deletedLines += commitFilesStatsData.deletedLines\n                            modifiedFileCount++\n                        }\n                        userStats.commits.last().let { commitStats ->\n                            commitStats.apply {\n                                files.add(commitFilesStatsData)\n                                addedLines += commitFilesStatsData.addedLines\n                                deletedLines += commitFilesStatsData.deletedLines\n                                modifiedFileCount++\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        return userStatsData.values.toTypedArray()\n    }\n}"
  },
  {
    "path": "src/main/kotlin/com/huayi/intellijplatform/gitstats/utils/Utils.kt",
    "content": "package com.huayi.intellijplatform.gitstats.utils\n\nimport com.intellij.openapi.diagnostic.thisLogger\nimport java.io.File\nimport java.time.DayOfWeek\nimport java.time.LocalDate\nimport java.time.temporal.TemporalAdjusters\nimport java.util.*\nimport java.util.concurrent.TimeUnit\n\nobject Utils {\n    fun checkDirectoryExists(directoryPath: String?): Boolean {\n        if (directoryPath.isNullOrEmpty()) {\n            return false\n        }\n        val directory = File(directoryPath)\n        return directory.exists() && directory.isDirectory\n    }\n\n    fun getOS(): String {\n        val os = System.getProperty(\"os.name\").lowercase(Locale.getDefault())\n        return if (os.contains(\"win\")) {\n            \"Windows\"\n        } else if (os.contains(\"nix\") || os.contains(\"nux\") || os.contains(\"aix\")) {\n            \"Unix\"\n        } else if (os.contains(\"mac\")) {\n            \"OSX\"\n        } else {\n            \"Unknown\"\n        }\n    }\n\n    fun runCommand(\n        repoPath: String,\n        cmd: List<String>,\n        timeoutAmount: Long = 60L,\n        timeUnit: TimeUnit = TimeUnit.SECONDS\n    ): Process? {\n        return runCatching {\n            ProcessBuilder(cmd)\n                .directory(File(repoPath))\n                .redirectErrorStream(true)\n                .redirectOutput(ProcessBuilder.Redirect.PIPE)\n                .start().also { it.waitFor(timeoutAmount, timeUnit) }\n        }.onFailure {\n            thisLogger().info(it.printStackTrace().toString())\n        }.getOrNull()\n    }\n\n    fun runCommand(repoPath: String, vararg cmd: String): Process? = runCommand(repoPath, listOf(*cmd))\n\n    fun getThisWeekDateRange(): Pair<LocalDate, LocalDate> {\n        val now = LocalDate.now()\n        val startOfWeek = now.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY))\n        val endOfWeek = now.with(TemporalAdjusters.nextOrSame(DayOfWeek.SUNDAY))\n        return Pair(startOfWeek, endOfWeek)\n    }\n\n    fun getThisWeekDateTimeRange(): Pair<Date, Date> {\n        val calendar = Calendar.getInstance()\n        val today = calendar.time\n        calendar.firstDayOfWeek = Calendar.MONDAY\n        calendar.time = today\n        calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY)\n        calendar.set(Calendar.HOUR_OF_DAY, calendar.getActualMinimum(Calendar.HOUR_OF_DAY))\n        calendar.set(Calendar.MINUTE, calendar.getActualMinimum(Calendar.MINUTE))\n        calendar.set(Calendar.SECOND, calendar.getActualMinimum(Calendar.SECOND))\n        calendar.set(Calendar.MILLISECOND, calendar.getActualMinimum(Calendar.MILLISECOND))\n        val startOfWeek = calendar.time\n        calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY)\n        calendar.set(Calendar.HOUR_OF_DAY, calendar.getActualMaximum(Calendar.HOUR_OF_DAY))\n        calendar.set(Calendar.MINUTE, calendar.getActualMaximum(Calendar.MINUTE))\n        calendar.set(Calendar.SECOND, calendar.getActualMaximum(Calendar.SECOND))\n        calendar.set(Calendar.MILLISECOND, calendar.getActualMaximum(Calendar.MILLISECOND))\n        val endOfWeek = calendar.time\n        return Pair(startOfWeek, endOfWeek)\n    }\n}"
  },
  {
    "path": "src/main/resources/META-INF/plugin.xml",
    "content": "<!-- Plugin Configuration File. Read more: https://plugins.jetbrains.com/docs/intellij/plugin-configuration-file.html -->\n<idea-plugin>\n    <id>com.huayi.intellijplatform.gitstats</id>\n    <name>GitStats</name>\n    <vendor>huayi</vendor>\n\n    <depends>com.intellij.modules.platform</depends>\n    <depends>com.intellij.modules.vcs</depends>\n    <depends>Git4Idea</depends>\n<!--    <depends optional=\"true\" config-file=\"plugin-with-Git4Idea.xml\">Git4Idea</depends>-->\n\n    <resource-bundle>messages.MyBundle</resource-bundle>\n\n    <extensions defaultExtensionNs=\"com.intellij\">\n        <toolWindow id=\"Git Stats\" secondary=\"true\" icon=\"/META-INF/icon.svg\" anchor=\"bottom\"\n                    factoryClass=\"com.huayi.intellijplatform.gitstats.toolWindow.GitStatsWindowFactory\"/>\n    </extensions>\n\n    <applicationListeners>\n        <listener class=\"com.huayi.intellijplatform.gitstats.listeners.MyFrameStateListener\" topic=\"com.intellij.ide.FrameStateListener\"/>\n    </applicationListeners>\n</idea-plugin>\n"
  },
  {
    "path": "src/main/resources/messages/MyBundle.properties",
    "content": "name=GitStats\nprojectService=Project service: {0}\nrandomLabel=The random number is: {0}\nshuffle=Shuffle\nfilterStartTimeLabel=StartTime: {0}\nfilterEndTimeLabel=EndTime: {0}\nrefreshButtonLabel=Refresh\nrefreshButtonLoadingLabel=Loading\nsettingButtonTooltipText=Show Setting\nsettingDialogModeLabel=Mode:\nsettingDialogExcludeLabel=Exclude:\n"
  },
  {
    "path": "src/test/kotlin/com/huayi/intellijplatform/gitstats/MyPluginTest.kt",
    "content": "package com.huayi.intellijplatform.gitstats\n\nimport com.intellij.ide.highlighter.XmlFileType\n//import com.intellij.openapi.components.service\nimport com.intellij.psi.xml.XmlFile\nimport com.intellij.testFramework.TestDataPath\nimport com.intellij.testFramework.fixtures.BasePlatformTestCase\nimport com.intellij.util.PsiErrorElementUtil\n//import com.huayi.intellijplatform.gitstats.services.GitStatsService\n\n@TestDataPath(\"\\$CONTENT_ROOT/src/test/testData\")\nclass MyPluginTest : BasePlatformTestCase() {\n\n    fun testXMLFile() {\n        val psiFile = myFixture.configureByText(XmlFileType.INSTANCE, \"<foo>bar</foo>\")\n        val xmlFile = assertInstanceOf(psiFile, XmlFile::class.java)\n\n        assertFalse(PsiErrorElementUtil.hasErrors(project, xmlFile.virtualFile))\n\n        assertNotNull(xmlFile.rootTag)\n\n        xmlFile.rootTag?.let {\n            assertEquals(\"foo\", it.name)\n            assertEquals(\"bar\", it.value.text)\n        }\n    }\n\n    fun testRename() {\n        myFixture.testRename(\"foo.xml\", \"foo_after.xml\", \"a2\")\n    }\n\n//    fun testProjectService() {\n//        val projectService = project.service<GitStatsService>()\n//\n//        assertNotSame(projectService.getRandomNumber(), projectService.getRandomNumber())\n//    }\n\n    override fun getTestDataPath() = \"src/test/testData/rename\"\n}\n"
  },
  {
    "path": "src/test/testData/rename/foo.xml",
    "content": "<root>\n    <a<caret>1>Foo</a1>\n</root>\n"
  },
  {
    "path": "src/test/testData/rename/foo_after.xml",
    "content": "<root>\n    <a2>Foo</a2>\n</root>\n"
  }
]