aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndré Dietisheim2012-09-25 17:24:54 (EDT)
committerMatthias Sohn2012-09-25 17:24:54 (EDT)
commit2091948aada1ebcadb0831a0f39445f7af57852f (patch)
treed958e4941b61c0b210ebca28206594b1787e70a4
parent334390383c858261dc51d9501c21aa01d2756795 (diff)
downloadegit-2091948aada1ebcadb0831a0f39445f7af57852f.zip
egit-2091948aada1ebcadb0831a0f39445f7af57852f.tar.gz
egit-2091948aada1ebcadb0831a0f39445f7af57852f.tar.bz2
Add "Commit and Push" button to the commit dialogrefs/changes/13/7913/2
Removed the push section with the "push to upstream" checkbox. Replaced it by an additional button that allows committing and pushing in 1 step. Bug: 389708 Change-Id: I4ada4d8768f119c2f5320f31b68d64333a55c1ae Signed-off-by: Andre Dietisheim <adietish@redhat.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIPreferences.java2
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java9
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/CommitUI.java2
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitDialog.java64
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties3
5 files changed, 34 insertions, 46 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIPreferences.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIPreferences.java
index a88ae8b..dbed532 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIPreferences.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIPreferences.java
@@ -73,8 +73,6 @@ public class UIPreferences {
/** */
public final static String COMMIT_DIALOG_INCLUDE_UNTRACKED = "commit_dialog_include_untracked"; //$NON-NLS-1$
/** */
- public final static String COMMIT_DIALOG_PUSH_UPSTREAM = "commit_dialog_push_upstream"; //$NON-NLS-1$
- /** */
public final static String CHECKOUT_PROJECT_RESTORE = "restore_projects_on_checkout"; //$NON-NLS-1$
/** */
public final static String THEME_CommitGraphNormalFont = "org.eclipse.egit.ui.CommitGraphNormalFont"; //$NON-NLS-1$
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java
index 5bc5874..2e6639c 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java
@@ -1863,6 +1863,9 @@ public class UIText extends NLS {
public static String CommitDialog_Commit;
/** */
+ public static String CommitDialog_CommitAndPush;
+
+ /** */
public static String CommitDialog_CommitChanges;
/** */
@@ -1968,12 +1971,6 @@ public class UIText extends NLS {
public static String CommitDialog_Title;
/** */
- public static String CommitDialog_PushSectionTitle;
-
- /** */
- public static String CommitDialog_PushUpstream;
-
- /** */
public static String ConfigurationChecker_gitPrefixWarningMessage;
/** */
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/CommitUI.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/CommitUI.java
index 288bd61..19e85e9 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/CommitUI.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/commit/CommitUI.java
@@ -212,7 +212,7 @@ public class CommitUI {
if (commitHelper.isMergedResolved)
commitOperation.setRepository(repo);
Job commitJob = createCommitJob(repo, commitOperation, false);
- if (commitDialog.isPushEnabled())
+ if (commitDialog.isPushRequested())
pushWhenFinished(commitJob);
commitJob.schedule();
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitDialog.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitDialog.java
index 2a29c7c..61fff7a 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitDialog.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitDialog.java
@@ -301,6 +301,11 @@ public class CommitDialog extends TitleAreaDialog {
private static final String SHOW_UNTRACKED_PREF = "CommitDialog.showUntracked"; //$NON-NLS-1$
+ /**
+ * A constant used for the 'commit and push button' button
+ */
+ public static final int COMMIT_AND_PUSH_ID = 30;
+
FormToolkit toolkit;
CommitMessageComponent commitMessageComponent;
@@ -325,6 +330,8 @@ public class CommitDialog extends TitleAreaDialog {
Button commitButton;
+ Button commitAndPushButton;
+
ArrayList<CommitItem> items = new ArrayList<CommitItem>();
private String commitMessage = null;
@@ -354,7 +361,7 @@ public class CommitDialog extends TitleAreaDialog {
private Repository repository;
- private boolean pushEnabled = false;
+ private boolean isPushRequested = false;
/**
* @param parentShell
@@ -510,23 +517,34 @@ public class CommitDialog extends TitleAreaDialog {
}
/**
- * Returns whether we are pushing after the commit
- * @return pushing
+ * @return true if push shall be executed
*/
- public boolean isPushEnabled() {
- return pushEnabled;
+ public boolean isPushRequested() {
+ return isPushRequested;
}
@Override
protected void createButtonsForButtonBar(Composite parent) {
toolkit.adapt(parent, false, false);
- commitButton = createButton(parent, IDialogConstants.OK_ID,
- UIText.CommitDialog_Commit, true);
createButton(parent, IDialogConstants.CANCEL_ID,
IDialogConstants.CANCEL_LABEL, false);
+ commitButton = createButton(parent, IDialogConstants.OK_ID,
+ UIText.CommitDialog_Commit, true);
+ commitAndPushButton = createButton(parent, COMMIT_AND_PUSH_ID,
+ UIText.CommitDialog_CommitAndPush, false);
updateMessage();
}
+ protected void buttonPressed(int buttonId) {
+ if (IDialogConstants.OK_ID == buttonId)
+ okPressed();
+ else if (COMMIT_AND_PUSH_ID == buttonId) {
+ isPushRequested = true;
+ okPressed();
+ } else if (IDialogConstants.CANCEL_ID == buttonId)
+ cancelPressed();
+ }
+
@Override
protected Control createButtonBar(Composite parent) {
toolkit.adapt(parent, false, false);
@@ -890,32 +908,6 @@ public class CommitDialog extends TitleAreaDialog {
}
}
- Section pushSection = toolkit.createSection(container,
- ExpandableComposite.TITLE_BAR
- | ExpandableComposite.CLIENT_INDENT);
- GridDataFactory.fillDefaults().grab(true, true).applyTo(pushSection);
- Composite pushArea = toolkit.createComposite(pushSection);
- pushSection.setClient(pushArea);
- toolkit.paintBordersFor(pushArea);
- GridLayoutFactory.fillDefaults().extendedMargins(2, 2, 2, 2)
- .applyTo(pushArea);
- pushSection.setText(UIText.CommitDialog_PushSectionTitle);
- final Button pushCheckbox = toolkit.createButton(pushArea,
- UIText.CommitDialog_PushUpstream, SWT.CHECK);
- pushCheckbox.setSelection(getPreferenceStore().getBoolean(
- UIPreferences.COMMIT_DIALOG_PUSH_UPSTREAM));
- pushEnabled = getPreferenceStore().getBoolean(
- UIPreferences.COMMIT_DIALOG_PUSH_UPSTREAM);
- pushCheckbox.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- pushEnabled = pushCheckbox.getSelection();
- getPreferenceStore().setValue(
- UIPreferences.COMMIT_DIALOG_PUSH_UPSTREAM, pushEnabled);
- }
- });
-
applyDialogFont(container);
statCol.pack();
resourceCol.pack();
@@ -985,8 +977,10 @@ public class CommitDialog extends TitleAreaDialog {
}
setMessage(message, type);
- commitButton.setEnabled(type == IMessageProvider.WARNING
- || type == IMessageProvider.NONE);
+ boolean commitEnabled = type == IMessageProvider.WARNING
+ || type == IMessageProvider.NONE;
+ commitButton.setEnabled(commitEnabled);
+ commitAndPushButton.setEnabled(commitEnabled);
}
private boolean isCommitWithoutFilesAllowed() {
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
index 942af97..c7d25cc 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
@@ -648,6 +648,7 @@ CommitDialog_AddSOB=Add Signed-off-&by
CommitDialog_AmendPreviousCommit=Am&end Previous Commit
CommitDialog_Author=&Author:
CommitDialog_Commit=&Commit
+CommitDialog_CommitAndPush=Commit and &Push
CommitDialog_CommitChanges=Commit Changes
CommitDialog_Committer=Committer:
CommitDialog_CommitMessage=Commit message
@@ -683,8 +684,6 @@ CommitDialog_MessageNoFilesSelected=Select one or more files to commit
CommitDialog_Path=Path
CommitDialog_Title=Commit Changes to Git Repository
CommitDialog_WrongTypeOfCommitMessageProvider=The extension used as CommitMessageProvider has the wrong type (it must implement org.eclipse.egit.ui.ICommitMessageProvider)
-CommitDialog_PushSectionTitle=Push
-CommitDialog_PushUpstream=&Push the changes to upstream
SpellcheckableMessageArea_redo=Redo
SpellcheckableMessageArea_showWhitespace=Show &Whitespace Characters