Skip to content

Commit

Permalink
Merged janwidmer branch to add issue number
Browse files Browse the repository at this point in the history
  • Loading branch information
sthauv committed Nov 5, 2018
2 parents 98c3a54 + 2e5cc00 commit cb3a4f2
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This plugin allows to create a commit message with the following template:

```
<type>(<scope>): <subject>
<type>(<scope>): <subject> [<issue no>]
<BLANK LINE>
<body>
<BLANK LINE>
Expand Down
6 changes: 3 additions & 3 deletions resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<idea-plugin>
<id>commit-template-idea-plugin</id>
<name>Git Commit Template</name>
<version>1.0.0</version>
<version>1.1.2</version>

<vendor email="[email protected]" />

<description><![CDATA[
<p>Create a commit message with the following template:</p>
<pre>
&lt;type&gt;(&lt;scope&gt;): &lt;subject&gt;
&lt;type&gt;(&lt;scope&gt;): &lt;subject&gt; [&lt;issue no&gt;]
&lt;BLANK LINE&gt;
&lt;body&gt;
&lt;BLANK LINE&gt;
Expand All @@ -34,4 +34,4 @@
</action>
</actions>

</idea-plugin>
</idea-plugin>
10 changes: 9 additions & 1 deletion src/com/leroymerlin/commit/CommitDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,23 @@ protected JComponent createCenterPanel() {
}

String getCommitMessage() {
return String.format("%s%s: %s%n%n%s%s%s",
return String.format("%s%s: %s%s%n%n%s%s%s",
panel.getChangeType(),
(panel.getChangeScope().isEmpty()?"":String.format("(%s)", panel.getChangeScope())),
panel.getShortDescription(),
getIssueNo(),
getLongDescription(),
getBreakingChanges(),
getClosedIssues());
}

private String getIssueNo() {
if (isBlank(panel.getIssueNo())) {
return "";
}
return String.format(" [%s]", panel.getIssueNo());
}

private String getLongDescription() {
return breakLines(panel.getLongDescription(), 100);
}
Expand Down
34 changes: 26 additions & 8 deletions src/com/leroymerlin/commit/CommitPanel.form
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.leroymerlin.commit.CommitPanel">
<grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="7" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="8" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="954" height="629"/>
Expand All @@ -10,7 +10,7 @@
<children>
<vspacer id="80732">
<constraints>
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<grid row="7" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="8bb2e" class="javax.swing.JLabel">
Expand Down Expand Up @@ -56,23 +56,23 @@
</component>
<component id="a5d3c" class="javax.swing.JLabel">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Long description"/>
</properties>
</component>
<component id="32600" class="javax.swing.JTextArea" binding="longDescription">
<constraints>
<grid row="3" column="1" row-span="1" col-span="2" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false">
<grid row="4" column="1" row-span="1" col-span="2" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="150" height="50"/>
</grid>
</constraints>
<properties/>
</component>
<component id="83b17" class="javax.swing.JLabel">
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Closed issues"/>
Expand All @@ -88,28 +88,46 @@
</component>
<component id="73448" class="javax.swing.JTextField" binding="closedIssues">
<constraints>
<grid row="5" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<grid row="6" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="c313a" class="javax.swing.JLabel">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Breaking changes"/>
</properties>
</component>
<component id="d09c0" class="javax.swing.JTextField" binding="breakingChanges">
<constraints>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="7eaaf" class="javax.swing.JTextField" binding="issueNo">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="63bb4" class="javax.swing.JLabel">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<enabled value="true"/>
<horizontalTextPosition value="2"/>
<text value="Issue No"/>
</properties>
</component>
</children>
</grid>
</form>
5 changes: 5 additions & 0 deletions src/com/leroymerlin/commit/CommitPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class CommitPanel {
private JComboBox changeType;
private JTextField changeScope;
private JTextField shortDescription;
private JTextField issueNo;
private JTextArea longDescription;
private JTextField closedIssues;
private JTextField breakingChanges;
Expand Down Expand Up @@ -39,6 +40,10 @@ String getShortDescription() {
return shortDescription.getText().trim();
}

String getIssueNo() {
return issueNo.getText().trim();
}

String getLongDescription() {
return longDescription.getText().trim();
}
Expand Down
Binary file modified static/commit-template-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cb3a4f2

Please sign in to comment.