From 831507f5f0bac77a115ce28ee5052171d54b0cc8 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Tue, 2 Nov 2021 07:12:49 +0100 Subject: [PATCH 1/2] git show history action should display results for folders automatically without having to press search. It was limited to files only. --- .../netbeans/modules/git/ui/history/SearchHistoryAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ide/git/src/org/netbeans/modules/git/ui/history/SearchHistoryAction.java b/ide/git/src/org/netbeans/modules/git/ui/history/SearchHistoryAction.java index 04514770cdbe..6507c73918c8 100644 --- a/ide/git/src/org/netbeans/modules/git/ui/history/SearchHistoryAction.java +++ b/ide/git/src/org/netbeans/modules/git/ui/history/SearchHistoryAction.java @@ -63,7 +63,7 @@ public static void openSearch(final File repository, final File[] roots, final S } public static void openSearch (final File repository, final File[] roots, final String branchName, final String contextName) { - openSearch(repository, roots, branchName, contextName, roots != null && (roots.length == 1 && roots[0].isFile() || roots.length > 1 && Utils.shareCommonDataObject(roots))); + openSearch(repository, roots, branchName, contextName, roots != null && (roots.length == 1 || roots.length > 1 && Utils.shareCommonDataObject(roots))); } public static void openSearch (final File repository, final File[] roots, final String branchName, final String contextName, final boolean invokeSearch) { From 5524e01f24c00bbf691a70a1a2de1845210ce3cb Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Tue, 2 Nov 2021 07:18:07 +0100 Subject: [PATCH 2/2] lambda renovation. --- .../git/ui/history/SearchHistoryAction.java | 69 ++++++++----------- 1 file changed, 30 insertions(+), 39 deletions(-) diff --git a/ide/git/src/org/netbeans/modules/git/ui/history/SearchHistoryAction.java b/ide/git/src/org/netbeans/modules/git/ui/history/SearchHistoryAction.java index 6507c73918c8..8e1a08b73df1 100644 --- a/ide/git/src/org/netbeans/modules/git/ui/history/SearchHistoryAction.java +++ b/ide/git/src/org/netbeans/modules/git/ui/history/SearchHistoryAction.java @@ -69,57 +69,48 @@ public static void openSearch (final File repository, final File[] roots, final public static void openSearch (final File repository, final File[] roots, final String branchName, final String contextName, final boolean invokeSearch) { final String title = NbBundle.getMessage(SearchHistoryTopComponent.class, "LBL_SearchHistoryTopComponent.title", contextName); final RepositoryInfo info = RepositoryInfo.getInstance(repository); - EventQueue.invokeLater(new Runnable() { - @Override - public void run () { - SearchHistoryTopComponent tc = new SearchHistoryTopComponent(repository, info, roots); - tc.setBranch(branchName); - tc.setDisplayName(title); - tc.open(); - tc.requestActive(); - if (invokeSearch) { - tc.search(false); - } + EventQueue.invokeLater(() -> { + SearchHistoryTopComponent tc = new SearchHistoryTopComponent(repository, info, roots); + tc.setBranch(branchName); + tc.setDisplayName(title); + tc.open(); + tc.requestActive(); + if (invokeSearch) { + tc.search(false); } }); } - public static void openSearch (final File repository, final File root, final String contextName, - final String commitIdFrom, final String commitIdTo) { + public static void openSearch (final File repository, final File root, final String contextName, final String commitIdFrom, final String commitIdTo) { final String title = NbBundle.getMessage(SearchHistoryTopComponent.class, "LBL_SearchHistoryTopComponent.title", contextName); final RepositoryInfo info = RepositoryInfo.getInstance(repository); - Mutex.EVENT.readAccess(new Runnable() { - @Override - public void run () { - SearchHistoryTopComponent tc = new SearchHistoryTopComponent(repository, info, new File[] { root }); - tc.setDisplayName(title); - tc.open(); - tc.requestActive(); - tc.setSearchCommitFrom(commitIdFrom); - tc.setSearchCommitTo(commitIdTo); - tc.search(true); - } + Mutex.EVENT.readAccess(() -> { + SearchHistoryTopComponent tc = new SearchHistoryTopComponent(repository, info, new File[] { root }); + tc.setDisplayName(title); + tc.open(); + tc.requestActive(); + tc.setSearchCommitFrom(commitIdFrom); + tc.setSearchCommitTo(commitIdTo); + tc.search(true); }); } public static void openSearch (final File repository, final File root, final String contextName, final int lineNumber) { final String title = NbBundle.getMessage(SearchHistoryTopComponent.class, "LBL_SearchHistoryTopComponent.title", contextName); final RepositoryInfo info = RepositoryInfo.getInstance(repository); - EventQueue.invokeLater(new Runnable() { - @Override - public void run () { - SearchHistoryTopComponent tc = new SearchHistoryTopComponent(repository, info, root, new SearchHistoryTopComponent.DiffResultsViewFactory() { - @Override - DiffResultsView createDiffResultsView(SearchHistoryPanel panel, List results) { - return new DiffResultsViewForLine(panel, results, lineNumber); - } - }); - tc.setDisplayName(title); - tc.open(); - tc.requestActive(); - tc.search(true); - tc.activateDiffView(true); - } + EventQueue.invokeLater(() -> { + SearchHistoryTopComponent tc = new SearchHistoryTopComponent(repository, info, root, + new SearchHistoryTopComponent.DiffResultsViewFactory() { + @Override + DiffResultsView createDiffResultsView(SearchHistoryPanel panel, List results) { + return new DiffResultsViewForLine(panel, results, lineNumber); + } + }); + tc.setDisplayName(title); + tc.open(); + tc.requestActive(); + tc.search(true); + tc.activateDiffView(true); }); }