-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #191 from rladstaetter/178-textview-loses-selectio…
…n-when-ignore-entries-abovebelow-is-applied #178: fixes selection when applying context actions in textview
- Loading branch information
Showing
8 changed files
with
74 additions
and
26 deletions.
There are no files selected for viewing
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
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
30 changes: 30 additions & 0 deletions
30
app/src/main/scala/app/logorrr/views/text/contextactions/IgnoreAboveMenuItem.scala
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,30 @@ | ||
package app.logorrr.views.text.contextactions | ||
|
||
import app.logorrr.conf.mut.MutLogFileSettings | ||
import app.logorrr.model.LogEntry | ||
import app.logorrr.util.CanLog | ||
import javafx.collections.transformation.FilteredList | ||
import javafx.scene.control.MenuItem | ||
|
||
/** | ||
* Filters out all entries before the given current log entry and updates the current position. | ||
* | ||
* This filter will be reset if any other filter is changed in the filters menu bar. | ||
* | ||
* @param mutLogFileSettings reference to global settings | ||
* @param currentEntry current entry | ||
* @param filteredList filtered list | ||
* @param scrollToActiveLogEntry function to scroll to current active log entry | ||
*/ | ||
class IgnoreAboveMenuItem(mutLogFileSettings: MutLogFileSettings | ||
, currentEntry: LogEntry | ||
, filteredList: FilteredList[LogEntry] | ||
, scrollToActiveLogEntry: () => Unit) extends MenuItem("Ignore entries above") with CanLog { | ||
setOnAction(_ => { | ||
val currPredicate = filteredList.getPredicate | ||
filteredList.setPredicate((entry: LogEntry) => currPredicate.test(entry) && currentEntry.lineNumber <= entry.lineNumber) | ||
mutLogFileSettings.setSelectedLineNumber(currentEntry.lineNumber) | ||
scrollToActiveLogEntry() | ||
}) | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
app/src/main/scala/app/logorrr/views/text/contextactions/IgnoreBelowMenuItem.scala
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,23 @@ | ||
package app.logorrr.views.text.contextactions | ||
|
||
import app.logorrr.model.LogEntry | ||
import app.logorrr.util.CanLog | ||
import javafx.collections.transformation.FilteredList | ||
import javafx.scene.control.MenuItem | ||
|
||
/** | ||
* Cuts away all entries following the current log entry. | ||
* | ||
* Selected log entry stays the same, also no change to current position (compare this to the IgnoreAbove action) | ||
* | ||
* @param currentEntry current selected log entry | ||
* @param filteredList filtered log entry list | ||
*/ | ||
class IgnoreBelowMenuItem(currentEntry: LogEntry, filteredList: FilteredList[LogEntry]) extends MenuItem("Ignore entries below") with CanLog { | ||
|
||
setOnAction(_ => { | ||
val currPredicate = filteredList.getPredicate | ||
filteredList.setPredicate((entry: LogEntry) => currPredicate.test(entry) && entry.lineNumber <= currentEntry.lineNumber) | ||
}) | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...r/views/text/DecreaseTextSizeButton.scala → ...olbaractions/DecreaseTextSizeButton.scala
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
2 changes: 1 addition & 1 deletion
2
...r/views/text/IncreaseTextSizeButton.scala → ...olbaractions/IncreaseTextSizeButton.scala
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