-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Find/Replace overlay: add a search- and replace- history
Adds a history feature for the find and replace bar of the overlay. The history is displayed using a menu filled with entries from the HistoryStore. fixes #1907
- Loading branch information
Maximilian Wittmer
authored and
Maximilian Wittmer
committed
Jun 24, 2024
1 parent
54609c8
commit 074a7fd
Showing
8 changed files
with
139 additions
and
17 deletions.
There are no files selected for viewing
Binary file added
BIN
+331 Bytes
bundles/org.eclipse.ui.workbench.texteditor/icons/full/elcl16/open_history.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+556 Bytes
bundles/org.eclipse.ui.workbench.texteditor/icons/full/elcl16/open_history@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...ench.texteditor/src/org/eclipse/ui/internal/findandreplace/overlay/SearchHistoryMenu.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.eclipse.ui.internal.findandreplace.overlay; | ||
|
||
import org.eclipse.swt.SWT; | ||
import org.eclipse.swt.events.SelectionListener; | ||
import org.eclipse.swt.graphics.Point; | ||
import org.eclipse.swt.graphics.Rectangle; | ||
import org.eclipse.swt.widgets.Control; | ||
import org.eclipse.swt.widgets.Menu; | ||
import org.eclipse.swt.widgets.MenuItem; | ||
|
||
import org.eclipse.ui.internal.findandreplace.HistoryStore; | ||
|
||
public class SearchHistoryMenu { | ||
|
||
public SearchHistoryMenu(Control parent, HistoryStore history, SelectionListener menuItemSelectionListener) { | ||
Menu menu = new Menu(parent); | ||
|
||
for (String entry : history.get()) { | ||
MenuItem item = new MenuItem(menu, SWT.FLAT); | ||
item.setText(entry); | ||
item.addSelectionListener(menuItemSelectionListener); | ||
} | ||
|
||
Point loc = parent.toDisplay(0, 0); | ||
Rectangle rect = parent.getBounds(); | ||
|
||
Point mLoc = new Point(loc.x, loc.y + rect.height); | ||
|
||
menu.setLocation(mLoc); | ||
|
||
menu.setVisible(true); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters