mirror of
https://github.com/ACINQ/eclair.git
synced 2025-02-22 06:21:42 +01:00
Added a label parameter to buildCopyContext
This commit is contained in:
parent
d5dae98c2e
commit
ba8cff0b26
3 changed files with 6 additions and 5 deletions
|
@ -26,13 +26,13 @@ class ChannelPaneController(theirNodeIdValue: String) extends Logging {
|
|||
|
||||
@FXML def handleChannelIdContext(event: ContextMenuEvent): Unit = {
|
||||
if (contextMenu != null) contextMenu.hide()
|
||||
contextMenu = ContextMenuUtils.buildCopyContext(channelIdValue)
|
||||
contextMenu = ContextMenuUtils.buildCopyContext(channelIdValue, "Copy Channel Id")
|
||||
contextMenu.show(channelId, event.getScreenX, event.getScreenY)
|
||||
}
|
||||
|
||||
@FXML def handleTheirNodeIdContext(event: ContextMenuEvent): Unit = {
|
||||
if (contextMenu != null) contextMenu.hide()
|
||||
contextMenu = ContextMenuUtils.buildCopyContext(theirNodeIdValue)
|
||||
contextMenu = ContextMenuUtils.buildCopyContext(theirNodeIdValue, "Copy Node Pubkey")
|
||||
contextMenu.show(nodeId, event.getScreenX, event.getScreenY)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ class MainController(val handlers: Handlers, val stage: Stage, val setup: Setup)
|
|||
bitcoinChain.getStyleClass.add(setup.chain)
|
||||
|
||||
graphTab.setContent(swingNode)
|
||||
contextMenu = ContextMenuUtils.buildCopyContext(Globals.Node.id)
|
||||
contextMenu = ContextMenuUtils.buildCopyContext(Globals.Node.id, "Copy Pubkey")
|
||||
|
||||
if (channelBox.getChildren.size() > 0) {
|
||||
channelInfo.setScaleY(0)
|
||||
|
|
|
@ -14,11 +14,12 @@ object ContextMenuUtils {
|
|||
* Builds a Context Menu with a single Copy action.
|
||||
*
|
||||
* @param valueToCopy the value to copy to clipboard
|
||||
* @param labelOfContextAction the label of the action in the context menu
|
||||
* @return javafx context menu
|
||||
*/
|
||||
def buildCopyContext(valueToCopy: String): ContextMenu = {
|
||||
def buildCopyContext(valueToCopy: String, labelOfContextAction: String = "Copy Value"): ContextMenu = {
|
||||
val context = new ContextMenu()
|
||||
val copyItem = new MenuItem("Copy Value")
|
||||
val copyItem = new MenuItem(labelOfContextAction)
|
||||
copyItem.setOnAction(new EventHandler[ActionEvent] {
|
||||
override def handle(event: ActionEvent): Unit = {
|
||||
val clipContent = new ClipboardContent
|
||||
|
|
Loading…
Add table
Reference in a new issue