This commit is contained in:
Aiden Fuller 2025-03-29 14:43:30 +11:00
parent 769af09515
commit d989d1c844
16 changed files with 69 additions and 86 deletions

1
.idea/.name generated Normal file
View file

@ -0,0 +1 @@
hello-world-plugin

16
.idea/csv-editor.xml generated Normal file
View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CsvFileAttributes">
<option name="attributeMap">
<map>
<entry key="/foo">
<value>
<Attribute>
<option name="separator" value="," />
</Attribute>
</value>
</entry>
</map>
</option>
</component>
</project>

16
.idea/gradle.xml generated Normal file
View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

View file

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="DialogTitleCapitalization" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

10
.idea/misc.xml generated Normal file
View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

4
.idea/vcs.xml generated
View file

@ -1,4 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings" defaultProject="true" /> <component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project> </project>

View file

@ -1,61 +0,0 @@
# Hello World JetBrains Plugin Template
This is a simple Hello World template for a JetBrains plugin that will work with any of their IDEs. It demonstrates the basic structure and components needed for a JetBrains plugin.
## Project Structure
- `build.gradle`: Gradle build configuration for the plugin
- `settings.gradle`: Gradle settings for the project
- `src/main/java/org/example/HelloWorldAction.java`: The action class that displays a "Hello World" message
- `src/main/resources/META-INF/plugin.xml`: Plugin configuration file
## Features
- Adds a "Hello World" action to the Tools menu
- Provides a keyboard shortcut (Ctrl+Alt+H) to trigger the action
- Displays a simple message dialog when the action is triggered
## Building the Plugin
To build the plugin, run:
```bash
./gradlew build
```
This will create a plugin ZIP file in the `build/distributions` directory.
## Installing the Plugin
1. Open any JetBrains IDE (IntelliJ IDEA, PyCharm, WebStorm, etc.)
2. Go to Settings/Preferences > Plugins
3. Click on the gear icon and select "Install Plugin from Disk..."
4. Navigate to the `build/distributions` directory and select the ZIP file
5. Restart the IDE when prompted
## Using the Plugin
After installing the plugin:
1. Go to the Tools menu and click on "Hello World", or
2. Use the keyboard shortcut Ctrl+Alt+H
A message dialog will appear with the text "Hello, World!".
## Customizing the Plugin
To customize the plugin:
1. Update the plugin metadata in `plugin.xml`
2. Modify the `HelloWorldAction` class to change the behavior
3. Add more actions or extensions as needed
## Requirements
- Java 11 or later
- Gradle 7.0 or later
- Any JetBrains IDE for testing
## License
This template is available under the MIT License.

View file

@ -3,8 +3,8 @@ plugins {
id 'org.jetbrains.intellij' version '1.17.1' id 'org.jetbrains.intellij' version '1.17.1'
} }
group = 'org.example' group = 'org.cobalyte'
version = '1.0-SNAPSHOT' version = '1.0.0'
repositories { repositories {
mavenCentral() mavenCentral()

View file

@ -1 +1 @@
rootProject.name = 'hello-world-plugin' rootProject.name = 'commit-message-prefixer'

View file

@ -1,2 +0,0 @@
rootProject.name = "untitled"

View file

@ -1,18 +1,13 @@
package org.example; package org.cobalyte;
import com.intellij.icons.AllIcons; import com.intellij.icons.AllIcons;
import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.CheckinProjectPanel; import com.intellij.openapi.vcs.CheckinProjectPanel;
import com.intellij.openapi.vcs.ui.Refreshable; import com.intellij.openapi.vcs.ui.Refreshable;
import com.intellij.openapi.util.IconLoader;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.io.File;
/** /**
* An action that adds a prefix to the commit message based on the current branch name. * An action that adds a prefix to the commit message based on the current branch name.
* This action is added to the commit dialog toolbar for easy access. * This action is added to the commit dialog toolbar for easy access.
@ -28,7 +23,7 @@ public class AddCommitPrefixAction extends AnAction {
} }
// Get the settings // Get the settings
CommitPrefixerSettings settings = CommitPrefixerSettings.getInstance(project); org.cobalyte.CommitPrefixerSettings settings = CommitPrefixerSettings.getInstance(project);
// Only show the button if the plugin is enabled and prefixing mode is MANUAL // Only show the button if the plugin is enabled and prefixing mode is MANUAL
boolean visible = settings.isEnabled() && settings.getPrefixingMode() == CommitPrefixerSettings.PrefixingMode.MANUAL; boolean visible = settings.isEnabled() && settings.getPrefixingMode() == CommitPrefixerSettings.PrefixingMode.MANUAL;

View file

@ -1,4 +1,4 @@
package org.example; package org.cobalyte;
import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;

View file

@ -1,4 +1,4 @@
package org.example; package org.cobalyte;
import com.intellij.openapi.options.Configurable; import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException; import com.intellij.openapi.options.ConfigurationException;

View file

@ -1,4 +1,4 @@
package org.example; package org.cobalyte;
import com.intellij.openapi.components.*; import com.intellij.openapi.components.*;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;

View file

@ -1,4 +1,4 @@
package org.example; package org.cobalyte;
import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;

View file

@ -1,7 +1,7 @@
<idea-plugin> <idea-plugin>
<id>org.example.commit-prefixer</id> <id>org.cobalyte.commit-prefixer</id>
<name>Commit Message Prefixer</name> <name>Commit Message Prefixer</name>
<vendor email="support@example.com" url="http://www.example.com">Example Vendor</vendor> <vendor email="support@cobalyte.com" url="https://www.cobalyte.com">Cobalyte</vendor>
<description><![CDATA[ <description><![CDATA[
A plugin for JetBrains IDEs that automatically prefixes commit messages with information extracted from branch names. A plugin for JetBrains IDEs that automatically prefixes commit messages with information extracted from branch names.
@ -28,23 +28,23 @@
<extensions defaultExtensionNs="com.intellij"> <extensions defaultExtensionNs="com.intellij">
<!-- Register the settings service --> <!-- Register the settings service -->
<projectService serviceImplementation="org.example.CommitPrefixerSettings"/> <projectService serviceImplementation="org.cobalyte.CommitPrefixerSettings"/>
<!-- Register the settings UI --> <!-- Register the settings UI -->
<projectConfigurable <projectConfigurable
parentId="tools" parentId="tools"
instance="org.example.CommitPrefixerConfigurable" instance="org.cobalyte.CommitPrefixerConfigurable"
id="org.example.CommitPrefixerConfigurable" id="org.cobalyte.CommitPrefixerConfigurable"
displayName="Commit Prefixer"/> displayName="Commit Prefixer"/>
<!-- Register the commit message prefixer --> <!-- Register the commit message prefixer -->
<checkinHandlerFactory implementation="org.example.CommitPrefixerCheckinHandlerFactory"/> <checkinHandlerFactory implementation="org.cobalyte.CommitPrefixerCheckinHandlerFactory"/>
</extensions> </extensions>
<actions> <actions>
<!-- Add the commit prefix action to the VCS menu --> <!-- Add the commit prefix action to the VCS menu -->
<action id="org.example.AddCommitPrefixAction" <action id="org.cobalyte.AddCommitPrefixAction"
class="org.example.AddCommitPrefixAction" class="org.cobalyte.AddCommitPrefixAction"
text="Add Prefix" text="Add Prefix"
description="Add a prefix to the commit message based on the current branch name"> description="Add a prefix to the commit message based on the current branch name">
<add-to-group group-id="Vcs.MessageActionGroup" anchor="first"/> <add-to-group group-id="Vcs.MessageActionGroup" anchor="first"/>