Skip to content

Commit

Permalink
created UI for #22, #23
Browse files Browse the repository at this point in the history
  • Loading branch information
OpherV committed Feb 1, 2014
1 parent 18ace97 commit 2e92adf
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 23 deletions.
13 changes: 12 additions & 1 deletion src/gitflow/GitflowConfigurable.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@

/**
* @author Andreas Vogler ([email protected])
* @author Opher Vishnia ([email protected])
*/

public class GitflowConfigurable implements Configurable {
public static final String GITFLOW_PUSH_ON_FINISH_RELEASE = "Gitflow.pushOnFinishRelease";
public static final String GITFLOW_PUSH_ON_FINISH_HOTFIX = "Gitflow.pushOnFinishHotfix";
public static final String GITFLOW_DONT_TAG_RELEASE = "Gitflow.dontTagRelease";
public static final String GITFLOW_USE_CUSTOM_TAG_COMMIT_MESSAGE = "Gitflow.useCustomTagCommitMessage";
public static final String GITFLOW_CUSTOM_TAG_COMMIT_MESSAGE = "Gitflow.customTagCommitMessage";
Project project;

GitflowOptionsForm gitflowOptionsForm;


Expand Down Expand Up @@ -46,20 +51,26 @@ public JComponent createComponent() {
@Override
public boolean isModified() {
return PropertiesComponent.getInstance(project).getBoolean(GITFLOW_PUSH_ON_FINISH_RELEASE, false) != gitflowOptionsForm.isPushOnFinishRelease() ||
PropertiesComponent.getInstance(project).getBoolean(GITFLOW_PUSH_ON_FINISH_HOTFIX, false) != gitflowOptionsForm.isPushOnFinishHotfix()
PropertiesComponent.getInstance(project).getBoolean(GITFLOW_PUSH_ON_FINISH_HOTFIX, false) != gitflowOptionsForm.isPushOnFinishHotfix() ||
PropertiesComponent.getInstance(project).getBoolean(GITFLOW_DONT_TAG_RELEASE, false) != gitflowOptionsForm.isDontTagRelease() ||
PropertiesComponent.getInstance(project).getBoolean(GITFLOW_USE_CUSTOM_TAG_COMMIT_MESSAGE, false) != gitflowOptionsForm.isDontTagRelease() ||
PropertiesComponent.getInstance(project).getBoolean(GITFLOW_CUSTOM_TAG_COMMIT_MESSAGE, false) != gitflowOptionsForm.isDontTagRelease()
;
}

@Override
public void apply() throws ConfigurationException {
PropertiesComponent.getInstance(project).setValue(GITFLOW_PUSH_ON_FINISH_RELEASE, Boolean.toString(gitflowOptionsForm.isPushOnFinishRelease()));
PropertiesComponent.getInstance(project).setValue(GITFLOW_PUSH_ON_FINISH_HOTFIX, Boolean.toString(gitflowOptionsForm.isPushOnFinishHotfix()));
PropertiesComponent.getInstance(project).setValue(GITFLOW_DONT_TAG_RELEASE, Boolean.toString(gitflowOptionsForm.isDontTagRelease()));
PropertiesComponent.getInstance(project).setValue(GITFLOW_CUSTOM_TAG_COMMIT_MESSAGE, Boolean.toString(gitflowOptionsForm.isDontTagRelease()));
}

@Override
public void reset() {
gitflowOptionsForm.setPushOnFinishRelease(PropertiesComponent.getInstance(project).getBoolean(GITFLOW_PUSH_ON_FINISH_RELEASE, false));
gitflowOptionsForm.setPushOnFinishHotfix(PropertiesComponent.getInstance(project).getBoolean(GITFLOW_PUSH_ON_FINISH_HOTFIX, false));
gitflowOptionsForm.setDontTagRelease(PropertiesComponent.getInstance(project).getBoolean(GITFLOW_DONT_TAG_RELEASE, false));
}

@Override
Expand Down
86 changes: 65 additions & 21 deletions src/gitflow/ui/GitflowOptionsForm.form
Original file line number Diff line number Diff line change
@@ -1,39 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="gitflow.ui.GitflowOptionsForm">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="3" column-count="1" 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="500" height="400"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="ece6c" class="javax.swing.JCheckBox" binding="pushOnFinishRelease">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Push on finish release (-p)"/>
</properties>
</component>
<component id="e578c" class="javax.swing.JCheckBox" binding="pushOnFinishHotfix">
<vspacer id="1a5be">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Push on finish hotfix (-p)"/>
</properties>
</component>
<hspacer id="4e824">
</vspacer>
<grid id="6abe9" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<vspacer id="1a5be">
<properties/>
<border type="none" title="Release"/>
<children>
<component id="1f588" class="javax.swing.JCheckBox" binding="dontTagRelease">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<selected value="false"/>
<text value="Don't tag release (-n)"/>
</properties>
</component>
<component id="ece6c" class="javax.swing.JCheckBox" binding="pushOnFinishRelease">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Push on finish release (-p)"/>
</properties>
</component>
<component id="4a471" class="javax.swing.JCheckBox" binding="useCustomTagCommitMessage">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Use custom tag commit message"/>
</properties>
</component>
<component id="8f1c7" class="javax.swing.JTextField" binding="customTagCommitMessage">
<constraints>
<grid row="2" 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>
<editable value="false"/>
<text value="Tagging version %name%"/>
<toolTipText value="Use %name% for the branch name"/>
</properties>
</component>
</children>
</grid>
<grid id="35b8b" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<properties/>
<border type="none" title="Hotfix"/>
<children>
<component id="e578c" class="javax.swing.JCheckBox" binding="pushOnFinishHotfix">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Push on finish hotfix (-p)"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
</form>
52 changes: 51 additions & 1 deletion src/gitflow/ui/GitflowOptionsForm.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,42 @@
package gitflow.ui;

import javax.swing.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;

/**
* @author Andreas Vogler ([email protected])
* @author Opher Vishnia ([email protected])
*/
public class GitflowOptionsForm {
public class GitflowOptionsForm implements ItemListener {
private JCheckBox pushOnFinishRelease;
private JPanel contentPane;
private JCheckBox pushOnFinishHotfix;
private JCheckBox dontTagRelease;
private JCheckBox useCustomTagCommitMessage;
private JTextField customTagCommitMessage;

public JPanel getContentPane() {
return contentPane;
}

/** Listens to the check boxes. */
public void itemStateChanged(ItemEvent e) {

Object source = e.getItemSelectable();

//disable\enable the tag commit message according to the checkbox state
if (source == useCustomTagCommitMessage) {
if (e.getStateChange() == ItemEvent.SELECTED) {
customTagCommitMessage.setEnabled(true);
}
else{
customTagCommitMessage.setEnabled(false);
}
}

}

public boolean isPushOnFinishRelease()
{
return pushOnFinishRelease.isSelected();
Expand All @@ -31,4 +54,31 @@ public boolean isPushOnFinishHotfix() {
public void setPushOnFinishHotfix(boolean selected) {
pushOnFinishHotfix.setSelected(selected);
}

public boolean isDontTagRelease() {
return dontTagRelease.isSelected();
}

public void setDontTagRelease(boolean selected) {
dontTagRelease.setSelected(selected);
}


/* custom release tag commit message */

public boolean isUseCustomTagCommitMessage() {
return useCustomTagCommitMessage.isSelected();
}

public void setUseCustomTagCommitMessage(boolean selected) {
useCustomTagCommitMessage.setSelected(selected);
}

public String getCustomTagCommitMessage() {
return customTagCommitMessage.getText();
}

public void setCustomTagCommitMessage(String message) {
customTagCommitMessage.setText(message);
}
}

0 comments on commit 2e92adf

Please sign in to comment.