aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernard Leach2011-05-28 02:09:13 (EDT)
committerChris Aniszczyk2011-06-01 09:53:32 (EDT)
commit562a73978706be62a89d19540c5224c69ff01a48 (patch)
treeae32f444ea852875ac85f8012935dc1f99b33427
parentbc358b9ee27d0dabeb90fa666e02cf746754565d (diff)
downloadegit-562a73978706be62a89d19540c5224c69ff01a48.zip
egit-562a73978706be62a89d19540c5224c69ff01a48.tar.gz
egit-562a73978706be62a89d19540c5224c69ff01a48.tar.bz2
Add link with selection and refresh toolbar items to StagingViewrefs/changes/13/3613/2
Change-Id: I003ab499c18885aa3ce6af5471b9c3a355af1d5a Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.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.java6
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java35
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties2
4 files changed, 45 insertions, 0 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 9f41339..598e4af 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
@@ -142,6 +142,8 @@ public class UIPreferences {
/** */
public static final String STAGING_SHOW_NEW_COMMITS = "StagingView_ShowNewCommits"; //$NON-NLS-1$
/** */
+ public static final String STAGING_VIEW_SYNC_SELECTION = "StagingView_SyncWithSelection"; //$NON-NLS-1$
+ /** */
public static final String PAGE_COMMIT_PREFERENCES = "org.eclipse.egit.ui.internal.preferences.CommitDialogPreferencePage"; //$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 cfd84d4..d437682 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
@@ -3782,6 +3782,12 @@ public class UIText extends NLS {
public static String StagingView_IndexDiffReload;
/** */
+ public static String StagingView_Refresh;
+
+ /** */
+ public static String StagingView_LinkSelection;
+
+ /** */
public static String SynchronizeWithMenu_custom;
/** */
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java
index c3d3e9e..1e6a17f 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java
@@ -42,6 +42,7 @@ import org.eclipse.egit.ui.UIPreferences;
import org.eclipse.egit.ui.UIText;
import org.eclipse.egit.ui.UIUtils;
import org.eclipse.egit.ui.internal.actions.ActionCommands;
+import org.eclipse.egit.ui.internal.actions.BooleanPrefAction;
import org.eclipse.egit.ui.internal.commit.CommitEditor;
import org.eclipse.egit.ui.internal.commit.CommitHelper;
import org.eclipse.egit.ui.internal.commit.CommitUI;
@@ -59,6 +60,8 @@ import org.eclipse.jface.action.Separator;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.preference.IPersistentPreferenceStore;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.IOpenListener;
import org.eclipse.jface.viewers.ISelection;
@@ -369,6 +372,13 @@ public class StagingView extends ViewPart {
}
};
+ IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
+ if (preferenceStore.contains(UIPreferences.STAGING_VIEW_SYNC_SELECTION))
+ reactOnSelection = preferenceStore.getBoolean(
+ UIPreferences.STAGING_VIEW_SYNC_SELECTION);
+ else
+ preferenceStore.setDefault(UIPreferences.STAGING_VIEW_SYNC_SELECTION, true);
+
updateSectionText();
updateToolbar();
@@ -398,6 +408,31 @@ public class StagingView extends ViewPart {
IToolBarManager toolbar = getViewSite().getActionBars()
.getToolBarManager();
+ // refresh
+ Action refreshAction = new Action(UIText.StagingView_Refresh, IAction.AS_PUSH_BUTTON) {
+ public void run() {
+ reload(currentRepository);
+ }
+ };
+ refreshAction.setImageDescriptor(UIIcons.ELCL16_REFRESH);
+ toolbar.add(refreshAction);
+
+ // link with selection
+ Action linkSelectionAction = new BooleanPrefAction(
+ (IPersistentPreferenceStore) Activator.getDefault()
+ .getPreferenceStore(),
+ UIPreferences.STAGING_VIEW_SYNC_SELECTION,
+ UIText.StagingView_LinkSelection) {
+ @Override
+ public void apply(boolean value) {
+ reactOnSelection = value;
+ }
+ };
+ linkSelectionAction.setImageDescriptor(UIIcons.ELCL16_SYNCED);
+ toolbar.add(linkSelectionAction);
+
+ toolbar.add(new Separator());
+
amendPreviousCommitAction = new Action(
UIText.StagingView_Ammend_Previous_Commit, IAction.AS_CHECK_BOX) {
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 fdb5b51..46ca28d 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
@@ -1313,6 +1313,8 @@ StagingView_noStagedFiles=There are no staged files
StagingView_NoSelectionTitle=No repository selected
StagingView_OpenNewCommits=Open new commits
StagingView_IndexDiffReload=Staging view reindexing repository {0}
+StagingView_Refresh=Refresh
+StagingView_LinkSelection=Link with Editor and Selection
SynchronizeWithMenu_custom=&Custom...
SynchronizeFetchJob_JobName=Fetching changes before synchronization launch