Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2014-08-01 11:36:55 -0400
committerAndrey Loskutov2015-09-17 14:07:51 -0400
commit3f30f108053b04bfb37441b43e216c5a45a85293 (patch)
treea9b601db5bed1e6c682dff2e255f19d7f732dcd6
parent6d548e3038a6f8f94943d3cc8870b78e0fb20544 (diff)
downloadegit-3f30f108053b04bfb37441b43e216c5a45a85293.tar.gz
egit-3f30f108053b04bfb37441b43e216c5a45a85293.tar.xz
egit-3f30f108053b04bfb37441b43e216c5a45a85293.zip
[historyView] Added "Focus On This File" menu for selected file
Selected file in commit files list have now new "Focus On This File" context menu, which focuses history view on the selection. This is a handy option to change the history view focus and also fixes issue with older Eclipse versions which do not have Show In -> History View entry. Bug: 440994 Change-Id: Id31c410e4df24e2959c094fb188ed69a4b04e818 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIIcons.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java3
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitFileDiffViewer.java32
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties1
4 files changed, 37 insertions, 3 deletions
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 1509ef7ef..193fcb420 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
@@ -272,6 +272,9 @@ public class UIIcons {
/** Stash icon */
public final static ImageDescriptor STASH;
+ /** History view icon */
+ public final static ImageDescriptor HISTORY;
+
/** Search commit icon */
public final static ImageDescriptor SEARCH_COMMIT;
@@ -399,6 +402,7 @@ public class UIIcons {
SUBMODULES = map("obj16/submodules.gif"); //$NON-NLS-1$
CLEAN = map("obj16/clean_obj.gif"); //$NON-NLS-1$
STASH = map("obj16/stash.png"); //$NON-NLS-1$
+ HISTORY = map("obj16/history.gif"); //$NON-NLS-1$
SEARCH_COMMIT = map("obj16/search-commit.gif"); //$NON-NLS-1$
HIERARCHY = map("elcl16/hierarchicalLayout.gif"); //$NON-NLS-1$
FLAT = map("elcl16/flatLayout.gif"); //$NON-NLS-1$
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 6bb064f09..19c2451ef 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
@@ -4249,6 +4249,9 @@ public class UIText extends NLS {
public static String CommitFileDiffViewer_ShowAnnotationsMenuLabel;
/** */
+ public static String CommitFileDiffViewer_ShowInHistoryLabel;
+
+ /** */
public static String CommitGraphTable_CommitId;
/** */
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 8e83b5012..1cf32a859 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
@@ -77,13 +77,16 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Table;
import org.eclipse.team.core.history.IFileRevision;
+import org.eclipse.team.ui.history.IHistoryView;
import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchSite;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.part.IPageSite;
import org.eclipse.ui.part.IShowInSource;
+import org.eclipse.ui.part.IShowInTarget;
import org.eclipse.ui.part.ShowInContext;
import org.eclipse.ui.themes.ColorUtil;
@@ -115,6 +118,8 @@ public class CommitFileDiffViewer extends TableViewer {
private IAction compareWorkingTreeVersion;
+ private IAction showInHistory;
+
private final IWorkbenchSite site;
/**
@@ -292,17 +297,37 @@ public class CommitFileDiffViewer extends TableViewer {
}
};
+ showInHistory = new Action(
+ UIText.CommitFileDiffViewer_ShowInHistoryLabel, UIIcons.HISTORY) {
+ @Override
+ public void run() {
+ ShowInContext context = getShowInContext();
+ if (context == null)
+ return;
+
+ IWorkbenchWindow window = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow();
+ IWorkbenchPage page = window.getActivePage();
+ IWorkbenchPart part = page.getActivePart();
+ // paranoia
+ if (part instanceof IHistoryView) {
+ ((IShowInTarget) part).show(context);
+ }
+ }
+ };
+
mgr.add(openWorkingTreeVersion);
mgr.add(openThisVersion);
mgr.add(openPreviousVersion);
+ mgr.add(new Separator());
mgr.add(compare);
mgr.add(compareWorkingTreeVersion);
mgr.add(blame);
- MenuManager showInSubMenu = UIUtils.createShowInMenu(
- site.getWorkbenchWindow());
-
mgr.add(new Separator());
+ mgr.add(showInHistory);
+ MenuManager showInSubMenu = UIUtils.createShowInMenu(site
+ .getWorkbenchWindow());
mgr.add(showInSubMenu);
mgr.add(new Separator());
@@ -363,6 +388,7 @@ public class CommitFileDiffViewer extends TableViewer {
selectAll.setEnabled(!allSelected);
copy.setEnabled(!sel.isEmpty());
+ showInHistory.setEnabled(!sel.isEmpty());
if (!submoduleSelected) {
boolean oneOrMoreSelected = !sel.isEmpty();
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 837ca558c..ad757b856 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
@@ -1488,6 +1488,7 @@ CommitFileDiffViewer_OpenPreviousInEditorMenuLabel=Open &Previous Version
CommitFileDiffViewer_OpenWorkingTreeVersionInEditorMenuLabel=&Open Workspace Version
StagingView_CompareWithIndexMenuLabel=Compare with Index
CommitFileDiffViewer_ShowAnnotationsMenuLabel=&Show Annotations
+CommitFileDiffViewer_ShowInHistoryLabel=Focus On This File
CommitGraphTable_CommitId=Id
CommitGraphTable_Committer=Committer
CommitGraphTable_committerDataColumn=Committed Date

Back to the top