Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2015-11-20 23:14:38 +0000
committerThomas Wolf2015-11-21 09:25:36 +0000
commit2d7f89f8363ca0511701ed581463138f2d24357f (patch)
tree3c39a8c283176162092f7bd5689e22f71ba10f7d
parent20ce7751a52160c6f65f9e74c7beb68aebf23b0d (diff)
downloadegit-2d7f89f8363ca0511701ed581463138f2d24357f.tar.gz
egit-2d7f89f8363ca0511701ed581463138f2d24357f.tar.xz
egit-2d7f89f8363ca0511701ed581463138f2d24357f.zip
Harmonize menus a little
* Remove the restriction on a single-element selection from some action handlers. There's no reason for it, and it's confusing for the user. The important thing here is for many commands that all elements in the selection belong to the same repository. * Enable actions also for working sets. The property tester makes sure that actions applicable only to one repository are only enabled if the working set contains only projects belonging to one repository. (Previously, Push to Upstream, Fetch from Upstream, Pull, and Reset were disabled on working sets.) * Enable Team->Repository->Pull when IFolders or IFiles are selected. Change-Id: Id530eb00160cb14cc81b3b8cea1eae7171b27c5f Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
-rw-r--r--org.eclipse.egit.ui/plugin.xml112
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/selection/SelectionPropertyTester.java4
2 files changed, 43 insertions, 73 deletions
diff --git a/org.eclipse.egit.ui/plugin.xml b/org.eclipse.egit.ui/plugin.xml
index d1e69943a8..690a7b3cc4 100644
--- a/org.eclipse.egit.ui/plugin.xml
+++ b/org.eclipse.egit.ui/plugin.xml
@@ -1143,16 +1143,9 @@
class="org.eclipse.egit.ui.internal.actions.SimpleFetchActionHandler">
</class>
<activeWhen>
- <and>
- <count
- value="1">
- </count>
- <iterate>
- <adapt
- type="org.eclipse.core.resources.IResource">
- </adapt>
- </iterate>
- </and>
+ <test
+ property="GitSelection.resourcesSingleRepository">
+ </test>
</activeWhen>
</handler>
<handler
@@ -1189,16 +1182,9 @@
class="org.eclipse.egit.ui.internal.actions.SimplePushActionHandler">
</class>
<activeWhen>
- <and>
- <count
- value="1">
- </count>
- <iterate>
- <adapt
- type="org.eclipse.core.resources.IResource">
- </adapt>
- </iterate>
- </and>
+ <test
+ property="GitSelection.resourcesSingleRepository">
+ </test>
</activeWhen>
</handler>
<handler
@@ -1207,16 +1193,16 @@
class="org.eclipse.egit.ui.internal.actions.PullFromUpstreamActionHandler">
</class>
<activeWhen>
- <iterate>
- <or>
- <adapt
- type="org.eclipse.core.resources.IProject">
- </adapt>
+ <or>
+ <test
+ property="GitSelection.resourcesAllInRepository">
+ </test>
+ <iterate>
<instanceof
value="org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode">
</instanceof>
- </or>
- </iterate>
+ </iterate>
+ </or>
</activeWhen>
</handler>
<handler
@@ -1246,7 +1232,7 @@
</class>
<activeWhen>
<test
- property="GitSelection.projectSingleRepository">
+ property="GitSelection.projectsSingleRepository">
</test>
</activeWhen>
</handler>
@@ -1292,7 +1278,7 @@
</class>
<activeWhen>
<test
- property="GitSelection.projectSingleRepository">
+ property="GitSelection.projectsSingleRepository">
</test>
</activeWhen>
</handler>
@@ -1327,7 +1313,7 @@
<activeWhen>
<or>
<test
- property="GitSelection.projectSingleRepository">
+ property="GitSelection.projectsSingleRepository">
</test>
<and>
<count
@@ -1563,16 +1549,9 @@
class="org.eclipse.egit.ui.internal.actions.MergeActionHandler">
</class>
<activeWhen>
- <and>
- <count
- value="1">
- </count>
- <iterate>
- <adapt
- type="org.eclipse.core.resources.IProject">
- </adapt>
- </iterate>
- </and>
+ <test
+ property="GitSelection.projectsSingleRepository">
+ </test>
</activeWhen>
</handler>
<handler
@@ -1602,7 +1581,7 @@
</class>
<activeWhen>
<test
- property="GitSelection.projectSingleRepository">
+ property="GitSelection.projectsSingleRepository">
</test>
</activeWhen>
</handler>
@@ -1682,16 +1661,9 @@
class="org.eclipse.egit.ui.internal.actions.ResetActionHandler">
</class>
<activeWhen>
- <and>
- <count
- value="1">
- </count>
- <iterate>
- <adapt
- type="org.eclipse.core.resources.IProject">
- </adapt>
- </iterate>
- </and>
+ <test
+ property="GitSelection.projectsSingleRepository">
+ </test>
</activeWhen>
</handler>
<handler
@@ -3863,7 +3835,7 @@
<visibleWhen
checkEnabled="false">
<test
- property="GitSelection.projectSingleRepository">
+ property="GitSelection.projectsSingleRepository">
</test>
</visibleWhen>
</menu>
@@ -3874,7 +3846,7 @@
<visibleWhen
checkEnabled="false">
<test
- property="GitSelection.projectSingleRepository">
+ property="GitSelection.projectsSingleRepository">
</test>
</visibleWhen>
</command>
@@ -3886,7 +3858,7 @@
<visibleWhen
checkEnabled="false">
<test
- property="GitSelection.projectSingleRepository">
+ property="GitSelection.projectsSingleRepository">
</test>
</visibleWhen>
</command>
@@ -3896,7 +3868,7 @@
<visibleWhen
checkEnabled="false">
<test
- property="GitSelection.projectSingleRepository">
+ property="GitSelection.projectsSingleRepository">
</test>
</visibleWhen>
</dynamic>
@@ -3939,7 +3911,7 @@
<visibleWhen
checkEnabled="false">
<test
- property="GitSelection.projectSingleRepository"
+ property="GitSelection.projectsSingleRepository"
args="hasGerritConfiguration">
</test>
</visibleWhen>
@@ -3951,7 +3923,7 @@
<visibleWhen
checkEnabled="false">
<test
- property="GitSelection.projectSingleRepository"
+ property="GitSelection.projectsSingleRepository"
args="hasGerritConfiguration">
</test>
</visibleWhen>
@@ -3973,7 +3945,7 @@
<visibleWhen
checkEnabled="false">
<test
- property="GitSelection.projectSingleRepository">
+ property="GitSelection.projectsSingleRepository">
</test>
</visibleWhen>
</menu>
@@ -3990,7 +3962,7 @@
<visibleWhen
checkEnabled="false">
<test
- property="GitSelection.projectSingleRepository">
+ property="GitSelection.projectsSingleRepository">
</test>
</visibleWhen>
</menu>
@@ -4072,7 +4044,7 @@
<visibleWhen
checkEnabled="false">
<test
- property="GitSelection.projectSingleRepository">
+ property="GitSelection.projectsSingleRepository">
</test>
</visibleWhen>
</command>
@@ -4083,7 +4055,7 @@
<visibleWhen
checkEnabled="false">
<test
- property="GitSelection.projectSingleRepository">
+ property="GitSelection.projectsSingleRepository">
</test>
</visibleWhen>
</command>
@@ -4124,7 +4096,7 @@
<visibleWhen
checkEnabled="false">
<test
- property="GitSelection.projectSingleRepository">
+ property="GitSelection.projectsSingleRepository">
</test>
</visibleWhen>
</command>
@@ -4139,7 +4111,7 @@
<visibleWhen
checkEnabled="false">
<test
- property="GitSelection.projectSingleRepository">
+ property="GitSelection.projectsSingleRepository">
</test>
</visibleWhen>
</command>
@@ -4201,7 +4173,7 @@
<visibleWhen
checkEnabled="false">
<test
- property="GitSelection.projectSingleRepository">
+ property="GitSelection.projectsSingleRepository">
</test>
</visibleWhen>
</command>
@@ -4214,7 +4186,7 @@
label="%RebaseWithDialog_label">
<visibleWhen checkEnabled="false">
<test
- property="GitSelection.projectSingleRepository"
+ property="GitSelection.projectsSingleRepository"
args="isSafe">
</test>
</visibleWhen>
@@ -4228,7 +4200,7 @@
<visibleWhen
checkEnabled="false">
<test
- property="GitSelection.projectSingleRepository"
+ property="GitSelection.projectsSingleRepository"
args="canAbortRebase">
</test>
</visibleWhen>
@@ -4239,7 +4211,7 @@
<visibleWhen
checkEnabled="false">
<test
- property="GitSelection.projectSingleRepository"
+ property="GitSelection.projectsSingleRepository"
args="canAbortRebase">
</test>
</visibleWhen>
@@ -4250,7 +4222,7 @@
<visibleWhen
checkEnabled="false">
<test
- property="GitSelection.projectSingleRepository"
+ property="GitSelection.projectsSingleRepository"
args="canContinueRebase">
</test>
</visibleWhen>
@@ -4263,7 +4235,7 @@
<visibleWhen
checkEnabled="false">
<test
- property="GitSelection.projectSingleRepository">
+ property="GitSelection.projectsSingleRepository">
</test>
</visibleWhen>
</command>
@@ -5253,7 +5225,7 @@
class="org.eclipse.egit.ui.internal.selection.SelectionPropertyTester"
id="org.eclipse.egit.ui.SelectionTester"
namespace="GitSelection"
- properties="projectSingleRepository,projectsWithRepositories,resourcesSingleRepository,fileOrFolderInRepository,resourcesAllInRepository"
+ properties="projectsSingleRepository,projectsWithRepositories,resourcesSingleRepository,fileOrFolderInRepository,resourcesAllInRepository"
type="java.util.Collection">
</propertyTester>
</extension>
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/selection/SelectionPropertyTester.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/selection/SelectionPropertyTester.java
index 45161c3024..bc28b87959 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/selection/SelectionPropertyTester.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/selection/SelectionPropertyTester.java
@@ -37,9 +37,7 @@ public class SelectionPropertyTester extends PropertyTester {
Collection<?> collection = (Collection<?>) receiver;
if (collection.isEmpty())
return false;
- if ("projectSingleRepository".equals(property)) { //$NON-NLS-1$
- if (collection.size() != 1)
- return false;
+ if ("projectsSingleRepository".equals(property)) { //$NON-NLS-1$
Repository repository = getRepositoryOfProjects(collection, true);
return testRepositoryProperties(repository, args);

Back to the top