Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2017-06-14 17:36:03 +0000
committerThomas Wolf2017-06-18 11:44:14 +0000
commit34ce4d240ae48e30b601b9bd2ac02a5e0ebc537b (patch)
tree7196f137407d68359217d3193528dec8a7ce219c /org.eclipse.egit.ui
parent1bf3ccac3b17a9dabf8b228526ee774094dc2d3e (diff)
downloadegit-34ce4d240ae48e30b601b9bd2ac02a5e0ebc537b.tar.gz
egit-34ce4d240ae48e30b601b9bd2ac02a5e0ebc537b.tar.xz
egit-34ce4d240ae48e30b601b9bd2ac02a5e0ebc537b.zip
Staging view: add toolbar buttons to stage/unstage all files
The buttons do not appear in the contextual action tooltip. The contextual actions operate on a selection, whereas the new "stage/unstage all" actions also operate on unselected files. Including it in the tooltip would give a confusing UI. Also, if this action were in the tooltip, a slight mis-click would stage/unstage not only the selected files but all of them. Although that would not be a severe problem (the changed files are selected after the operation in the target viewer, so undoing a "stage all" is as easy as using "unstage seleted files"), let's try to avoid this. Bug: 518213 Change-Id: I127dae880c28f851b078736a7940dc698ab42faa Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.egit.ui')
-rw-r--r--org.eclipse.egit.ui/icons/elcl16/add_all.pngbin0 -> 403 bytes
-rw-r--r--org.eclipse.egit.ui/icons/elcl16/add_all@2x.pngbin0 -> 523 bytes
-rw-r--r--org.eclipse.egit.ui/icons/elcl16/unstage_all.pngbin0 -> 278 bytes
-rw-r--r--org.eclipse.egit.ui/icons/elcl16/unstage_all@2x.pngbin0 -> 360 bytes
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIIcons.java7
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java12
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java47
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties8
8 files changed, 71 insertions, 3 deletions
diff --git a/org.eclipse.egit.ui/icons/elcl16/add_all.png b/org.eclipse.egit.ui/icons/elcl16/add_all.png
new file mode 100644
index 0000000000..c09cb6519e
--- /dev/null
+++ b/org.eclipse.egit.ui/icons/elcl16/add_all.png
Binary files differ
diff --git a/org.eclipse.egit.ui/icons/elcl16/add_all@2x.png b/org.eclipse.egit.ui/icons/elcl16/add_all@2x.png
new file mode 100644
index 0000000000..5e5c9b0433
--- /dev/null
+++ b/org.eclipse.egit.ui/icons/elcl16/add_all@2x.png
Binary files differ
diff --git a/org.eclipse.egit.ui/icons/elcl16/unstage_all.png b/org.eclipse.egit.ui/icons/elcl16/unstage_all.png
new file mode 100644
index 0000000000..8faa472d27
--- /dev/null
+++ b/org.eclipse.egit.ui/icons/elcl16/unstage_all.png
Binary files differ
diff --git a/org.eclipse.egit.ui/icons/elcl16/unstage_all@2x.png b/org.eclipse.egit.ui/icons/elcl16/unstage_all@2x.png
new file mode 100644
index 0000000000..91796cae3c
--- /dev/null
+++ b/org.eclipse.egit.ui/icons/elcl16/unstage_all@2x.png
Binary files differ
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIIcons.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIIcons.java
index 503eff49f7..08db44c505 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIIcons.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIIcons.java
@@ -82,6 +82,8 @@ public class UIIcons {
public final static ImageDescriptor ELCL16_DELETE;
/** Add icon */
public final static ImageDescriptor ELCL16_ADD;
+ /** "Add all" icon */
+ public final static ImageDescriptor ELCL16_ADD_ALL;
/** Trash icon */
public final static ImageDescriptor ELCL16_TRASH;
/** Clear icon */
@@ -325,6 +327,9 @@ public class UIIcons {
/** Unstage icon */
public final static ImageDescriptor UNSTAGE;
+ /** "Unstage all" icon */
+ public final static ImageDescriptor UNSTAGE_ALL;
+
/** {@link #BRANCH} overlaid with {@link #OVR_CHECKEDOUT}. */
public final static ImageDescriptor CHECKED_OUT_BRANCH;
@@ -364,6 +369,7 @@ public class UIIcons {
ELCL16_COMMITTER = map("elcl16/committer.png"); //$NON-NLS-1$
ELCL16_DELETE = map("elcl16/delete.png"); //$NON-NLS-1$
ELCL16_ADD = map("elcl16/add.png"); //$NON-NLS-1$
+ ELCL16_ADD_ALL = map("elcl16/add_all.png"); //$NON-NLS-1$
ELCL16_TRASH = map("elcl16/trash.png"); //$NON-NLS-1$
ELCL16_CLEAR = map("elcl16/clear_co.png"); //$NON-NLS-1$
ELCL16_REFRESH = map("elcl16/refresh.png"); //$NON-NLS-1$
@@ -436,6 +442,7 @@ public class UIIcons {
ALPHABETICALLY_SORT = map("obj16/alphab_sort_co.png"); //$NON-NLS-1$
STATE_SORT = map("obj16/state_sort_co.png"); //$NON-NLS-1$
UNSTAGE = map("obj16/unstage.png"); //$NON-NLS-1$
+ UNSTAGE_ALL = map("elcl16/unstage_all.png"); //$NON-NLS-1$
CHECKED_OUT_BRANCH = new DecorationOverlayDescriptor(BRANCH,
OVR_CHECKEDOUT, IDecoration.TOP_LEFT);
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java
index 556abb30b1..7ecf20d831 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java
@@ -5257,6 +5257,12 @@ public class UIText extends NLS {
public static String StagingView_replaceWithHeadRevision;
/** */
+ public static String StagingView_UnstageAllItemMenuLabel;
+
+ /** */
+ public static String StagingView_UnstageAllItemTooltip;
+
+ /** */
public static String StagingView_UnstageItemMenuLabel;
/** */
@@ -5266,6 +5272,12 @@ public class UIText extends NLS {
public static String StagingView_UnstagedSort;
/** */
+ public static String StagingView_StageAllItemMenuLabel;
+
+ /** */
+ public static String StagingView_StageAllItemTooltip;
+
+ /** */
public static String StagingView_StageItemMenuLabel;
/** */
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 7ea7580c10..3d038d72f2 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
@@ -313,6 +313,10 @@ public class StagingView extends ViewPart
private IAction stageAction;
+ private IAction unstageAllAction;
+
+ private IAction stageAllAction;
+
private IAction compareModeAction;
@Nullable
@@ -824,6 +828,30 @@ public class StagingView extends ViewPart
unstageAction.setEnabled(false);
stageAction.setEnabled(false);
+ unstageAllAction = new Action(
+ UIText.StagingView_UnstageAllItemMenuLabel,
+ UIIcons.UNSTAGE_ALL) {
+ @Override
+ public void run() {
+ stagedViewer.getTree().selectAll();
+ unstage((IStructuredSelection) stagedViewer.getSelection());
+ }
+ };
+ unstageAllAction
+ .setToolTipText(UIText.StagingView_UnstageAllItemTooltip);
+ stageAllAction = new Action(UIText.StagingView_StageAllItemMenuLabel,
+ UIIcons.ELCL16_ADD_ALL) {
+ @Override
+ public void run() {
+ unstagedViewer.getTree().selectAll();
+ stage((IStructuredSelection) unstagedViewer.getSelection());
+ }
+ };
+ stageAllAction.setToolTipText(UIText.StagingView_StageAllItemTooltip);
+
+ unstageAllAction.setEnabled(false);
+ stageAllAction.setEnabled(false);
+
unstagedSection = toolkit.createSection(stagingSashForm,
ExpandableComposite.TITLE_BAR);
@@ -840,6 +868,7 @@ public class StagingView extends ViewPart
unstagedViewer = createViewer(unstagedComposite, true,
selection -> unstage(selection), stageAction);
+
unstagedViewer.addSelectionChangedListener(event -> {
boolean hasSelection = !event.getSelection().isEmpty();
if (hasSelection != stageAction.isEnabled()) {
@@ -1510,6 +1539,7 @@ public class StagingView extends ViewPart
unstagedToolBarManager = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL);
unstagedToolBarManager.add(stageAction);
+ unstagedToolBarManager.add(stageAllAction);
unstagedToolBarManager.add(sortAction);
unstagedToolBarManager.add(unstagedExpandAllAction);
unstagedToolBarManager.add(unstagedCollapseAllAction);
@@ -1549,6 +1579,7 @@ public class StagingView extends ViewPart
stagedToolBarManager = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL);
stagedToolBarManager.add(unstageAction);
+ stagedToolBarManager.add(unstageAllAction);
stagedToolBarManager.add(stagedExpandAllAction);
stagedToolBarManager.add(stagedCollapseAllAction);
stagedToolBarManager.update(true);
@@ -1993,7 +2024,21 @@ public class StagingView extends ViewPart
private StagingViewContentProvider createStagingContentProvider(
boolean unstaged) {
StagingViewContentProvider provider = new StagingViewContentProvider(
- this, unstaged);
+ this, unstaged) {
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput,
+ Object newInput) {
+ super.inputChanged(viewer, oldInput, newInput);
+ if (unstaged) {
+ stageAllAction.setEnabled(getCount() > 0);
+ unstagedToolBarManager.update(true);
+ } else {
+ unstageAllAction.setEnabled(getCount() > 0);
+ stagedToolBarManager.update(true);
+ }
+ }
+ };
provider.setFileNameMode(getPreferenceStore().getBoolean(
UIPreferences.STAGING_VIEW_FILENAME_MODE));
return provider;
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties
index 325a88c5d1..9953abb086 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties
@@ -1835,11 +1835,15 @@ StagingView_ReplaceWith=Rep&lace With
StagingView_LinkSelection=Link with Editor and Selection
StagingView_replaceWithFileInGitIndex=Replace with &Index
StagingView_replaceWithHeadRevision=Replace with &HEAD Revision
+StagingView_UnstageAllItemMenuLabel=Remove All Files from Index
+StagingView_UnstageAllItemTooltip=Remove all files including not selected ones from the index
StagingView_UnstageItemMenuLabel=&Remove from Index
-StagingView_UnstageItemTooltip=Remove Selected Files from Index
+StagingView_UnstageItemTooltip=Remove selected files from the index
StagingView_UnstagedSort=Sort by state
+StagingView_StageAllItemMenuLabel=&Add All Files to Index
+StagingView_StageAllItemTooltip=Add all files including not selected ones to the index
StagingView_StageItemMenuLabel=&Add to Index
-StagingView_StageItemTooltip=Add Selected Files to Index
+StagingView_StageItemTooltip=Add selected files to the index
StagingView_IgnoreItemMenuLabel=&Ignore
StagingView_IgnoreFolderMenuLabel=Ignore &Folder
StagingView_DeleteItemMenuLabel=&Delete

Back to the top