-
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 #195 from rladstaetter/188-close-all-log-files-sta…
…rt-screen-is-not-shown 188 close all log files start screen is not shown
- Loading branch information
Showing
10 changed files
with
167 additions
and
147 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
112 changes: 0 additions & 112 deletions
112
app/src/main/scala/app/logorrr/views/logfiletab/OpenInFinderMenuItem.scala
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
app/src/main/scala/app/logorrr/views/logfiletab/actions/CloseAllFilesMenuItem.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,20 @@ | ||
package app.logorrr.views.logfiletab.actions | ||
|
||
import app.logorrr.views.logfiletab.LogFileTab | ||
import javafx.scene.control.{MenuItem, Tab} | ||
|
||
import scala.jdk.CollectionConverters.CollectionHasAsScala | ||
|
||
class CloseAllFilesMenuItem(fileTab: => LogFileTab) extends MenuItem("Close All Files") { | ||
private val tabPane = fileTab.getTabPane | ||
setOnAction(_ => { | ||
val toBeDeleted: Seq[Tab] = { | ||
tabPane.getTabs.asScala.flatMap { t => | ||
t.asInstanceOf[LogFileTab].shutdown() | ||
Option(t) | ||
}.toSeq | ||
} | ||
tabPane.getTabs.removeAll(toBeDeleted: _*) | ||
}) | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
app/src/main/scala/app/logorrr/views/logfiletab/actions/CloseLeftFilesMenuItem.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.logfiletab.actions | ||
|
||
import app.logorrr.views.logfiletab.LogFileTab | ||
import javafx.scene.control.{MenuItem, Tab} | ||
|
||
import scala.jdk.CollectionConverters.CollectionHasAsScala | ||
|
||
class CloseLeftFilesMenuItem(fileTab: => LogFileTab) extends MenuItem("Close Files to the Left") { | ||
private val tabPane = fileTab.getTabPane | ||
setOnAction(_ => { | ||
var deletethem = true | ||
val toBeDeleted: Seq[Tab] = { | ||
tabPane.getTabs.asScala.flatMap { t => | ||
if (t.asInstanceOf[LogFileTab].pathAsString == fileTab.pathAsString) { | ||
deletethem = false | ||
None | ||
} else { | ||
if (deletethem) { | ||
t.asInstanceOf[LogFileTab].shutdown() | ||
Option(t) | ||
} else { | ||
None | ||
} | ||
} | ||
}.toSeq | ||
} | ||
tabPane.getTabs.removeAll(toBeDeleted: _*) | ||
}) | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
app/src/main/scala/app/logorrr/views/logfiletab/actions/CloseMenuItem.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,13 @@ | ||
package app.logorrr.views.logfiletab.actions | ||
|
||
import app.logorrr.views.logfiletab.LogFileTab | ||
import javafx.scene.control.MenuItem | ||
|
||
class CloseMenuItem(fileTab: => LogFileTab) extends MenuItem("Close") { | ||
|
||
setOnAction(_ => Option(fileTab.getTabPane.getSelectionModel.getSelectedItem).foreach { t => | ||
fileTab.shutdown() | ||
fileTab.getTabPane.getTabs.remove(t) | ||
}) | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
app/src/main/scala/app/logorrr/views/logfiletab/actions/CloseOtherFilesMenuItem.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,24 @@ | ||
package app.logorrr.views.logfiletab.actions | ||
|
||
import app.logorrr.views.logfiletab.LogFileTab | ||
import javafx.scene.control.{MenuItem, Tab} | ||
|
||
import scala.jdk.CollectionConverters.CollectionHasAsScala | ||
|
||
class CloseOtherFilesMenuItem(fileTab: => LogFileTab) extends MenuItem("Close Other Files") { | ||
private val tabPane = fileTab.getTabPane | ||
setOnAction(_ => { | ||
val toBeDeleted: Seq[Tab] = { | ||
tabPane.getTabs.asScala.flatMap { t => | ||
if (t.asInstanceOf[LogFileTab].pathAsString == fileTab.pathAsString) { | ||
None | ||
} else { | ||
t.asInstanceOf[LogFileTab].shutdown() | ||
Option(t) | ||
} | ||
}.toSeq | ||
} | ||
tabPane.getTabs.removeAll(toBeDeleted: _*) | ||
}) | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
app/src/main/scala/app/logorrr/views/logfiletab/actions/CloseRightFilesMenuItem.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,31 @@ | ||
package app.logorrr.views.logfiletab.actions | ||
|
||
import app.logorrr.views.logfiletab.LogFileTab | ||
import javafx.scene.control.{MenuItem, Tab} | ||
|
||
import scala.jdk.CollectionConverters.CollectionHasAsScala | ||
|
||
|
||
class CloseRightFilesMenuItem(fileTab: => LogFileTab) extends MenuItem("Close Files to the Right") { | ||
private val tabPane = fileTab.getTabPane | ||
setOnAction(_ => { | ||
var deletethem = false | ||
val toBeDeleted: Seq[Tab] = { | ||
tabPane.getTabs.asScala.flatMap { t => | ||
if (t.asInstanceOf[LogFileTab].pathAsString == fileTab.pathAsString) { | ||
deletethem = true | ||
None | ||
} else { | ||
if (deletethem) { | ||
t.asInstanceOf[LogFileTab].shutdown() | ||
Option(t) | ||
} else { | ||
None | ||
} | ||
} | ||
}.toSeq | ||
} | ||
tabPane.getTabs.removeAll(toBeDeleted: _*) | ||
}) | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
app/src/main/scala/app/logorrr/views/logfiletab/actions/OpenInFinderMenuItem.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.logfiletab.actions | ||
|
||
import app.logorrr.util.OsUtil | ||
import javafx.scene.control.MenuItem | ||
|
||
import java.awt.Desktop | ||
import java.nio.file.Paths | ||
|
||
object OpenInFinderMenuItem { | ||
val menuItemText: String = if (OsUtil.isWin) { | ||
"Show Log in Explorer" | ||
} else if (OsUtil.isMac) { | ||
"Show Log in Finder" | ||
} else { | ||
"Show Log ..." | ||
} | ||
} | ||
|
||
class OpenInFinderMenuItem(pathAsString: String) extends MenuItem(OpenInFinderMenuItem.menuItemText) { | ||
|
||
setOnAction(_ => Desktop.getDesktop.open(Paths.get(pathAsString).getParent.toFile)) | ||
|
||
} |
Oops, something went wrong.