Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Sawicki2012-02-11 10:38:39 +0000
committerMatthias Sohn2012-02-11 10:38:39 +0000
commitb5e9044e8285048e3f19cc53dba6196b2a960260 (patch)
tree74d2f5f8a4229b052f8ba56bd4654f37e6938f7d
parent6152c2acffcec6dd47fed4f8ec14e9cda398f512 (diff)
downloadegit-b5e9044e8285048e3f19cc53dba6196b2a960260.tar.gz
egit-b5e9044e8285048e3f19cc53dba6196b2a960260.tar.xz
egit-b5e9044e8285048e3f19cc53dba6196b2a960260.zip
[historyView] Disable file actions when submodule is selected
Change-Id: Ia0e9c3e6ad6c19ca2b569bd64cb6775d575170e1 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitFileDiffViewer.java37
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiff.java2
2 files changed, 28 insertions, 11 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitFileDiffViewer.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitFileDiffViewer.java
index 40219c1743..0ec9e784e4 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitFileDiffViewer.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitFileDiffViewer.java
@@ -314,19 +314,36 @@ public class CommitFileDiffViewer extends TableViewer {
IStructuredSelection sel = (IStructuredSelection) selection;
boolean allSelected = !sel.isEmpty()
&& sel.size() == getTable().getItemCount();
+ boolean submoduleSelected = false;
+ for (Object item : sel.toArray())
+ if (((FileDiff) item).isSubmodule()) {
+ submoduleSelected = true;
+ break;
+ }
+
selectAll.setEnabled(!allSelected);
copy.setEnabled(!sel.isEmpty());
- open.setEnabled(!sel.isEmpty());
- openWorkingTreeVersion.setEnabled(!sel.isEmpty());
- compare.setEnabled(sel.size() == 1);
-
- if (sel.size() == 1) {
- FileDiff diff = (FileDiff) sel.getFirstElement();
- String path = new Path(getRepository().getWorkTree()
- .getAbsolutePath()).append(diff.getPath()).toOSString();
- compareWorkingTreeVersion.setEnabled(new File(path).exists());
- } else
+
+ if (!submoduleSelected) {
+ open.setEnabled(!sel.isEmpty());
+ openWorkingTreeVersion.setEnabled(!sel.isEmpty());
+ compare.setEnabled(sel.size() == 1);
+ blame.setEnabled(true);
+ if (sel.size() == 1) {
+ FileDiff diff = (FileDiff) sel.getFirstElement();
+ String path = new Path(getRepository().getWorkTree()
+ .getAbsolutePath()).append(diff.getPath()).toOSString();
+ compareWorkingTreeVersion.setEnabled(new File(path).exists()
+ && !submoduleSelected);
+ } else
+ compareWorkingTreeVersion.setEnabled(false);
+ } else {
+ open.setEnabled(false);
+ openWorkingTreeVersion.setEnabled(false);
+ compare.setEnabled(false);
+ blame.setEnabled(false);
compareWorkingTreeVersion.setEnabled(false);
+ }
}
private IAction createStandardAction(final ActionFactory af) {
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiff.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiff.java
index 128102ef75..dd88cdfc21 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiff.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiff.java
@@ -310,7 +310,7 @@ public class FileDiff extends WorkbenchAdapter {
*
* @return true if submodule, false otherwise
*/
- protected boolean isSubmodule() {
+ public boolean isSubmodule() {
if (diffEntry == null)
return false;
return diffEntry.getOldMode() == FileMode.GITLINK

Back to the top