diff --git a/pom.xml b/pom.xml
index ca4915b..7a4c5af 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
com.erikmafo
big-table-viewer
- 1.0.9
+ 1.0.10
jar
Big Table Viewer
diff --git a/src/main/java/com/erikmafo/btviewer/ui/projectexplorer/ProjectExplorerController.java b/src/main/java/com/erikmafo/btviewer/ui/projectexplorer/ProjectExplorerController.java
index 71bf489..e7fce53 100644
--- a/src/main/java/com/erikmafo/btviewer/ui/projectexplorer/ProjectExplorerController.java
+++ b/src/main/java/com/erikmafo/btviewer/ui/projectexplorer/ProjectExplorerController.java
@@ -5,6 +5,7 @@
import com.erikmafo.btviewer.services.instance.SaveInstanceService;
import com.erikmafo.btviewer.services.project.RemoveProjectService;
import com.erikmafo.btviewer.ui.util.AlertUtil;
+import com.erikmafo.btviewer.ui.util.FontAwesomeUtil;
import com.google.inject.Provider;
import javafx.beans.property.ReadOnlyObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
@@ -17,6 +18,7 @@
import javafx.scene.control.ProgressIndicator;
import javafx.scene.control.TreeCell;
import javafx.scene.control.TreeView;
+import org.controlsfx.glyphfont.FontAwesome;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -109,11 +111,13 @@ public ContextMenu createContextMenu(@NotNull TreeItemData item){
ContextMenu menu = null;
if (item.isProject()) {
var addInstance = new MenuItem("Add instance");
+ addInstance.setGraphic(FontAwesomeUtil.create(FontAwesome.Glyph.PLUS));
addInstance.setOnAction(actionEvent ->
AddInstanceDialog
.displayAndAwaitResult(item.getProjectId())
.whenComplete(this::handleAddInstanceResult));
var removeProject = new MenuItem("Remove");
+ removeProject.setGraphic(FontAwesomeUtil.create(FontAwesome.Glyph.REMOVE));
removeProject.setOnAction(actionEvent -> {
removeProjectService.setProjectId(item.getProjectId());
removeProjectService.setOnSucceeded(event -> ((RootTreeItem)treeView.getRoot()).removeProject((item.getProjectId())));
@@ -124,6 +128,7 @@ public ContextMenu createContextMenu(@NotNull TreeItemData item){
menu = new ContextMenu(addInstance, removeProject);
} else if (item.isInstance()) {
var refreshTables = new MenuItem("Refresh tables");
+ refreshTables.setGraphic(FontAwesomeUtil.create(FontAwesome.Glyph.REFRESH));
refreshTables.setOnAction(e -> ((InstanceTreeItem)item.getTreeItem()).loadChildren());
menu = new ContextMenu(refreshTables);
}
diff --git a/src/main/java/com/erikmafo/btviewer/ui/querybox/QueryBoxController.java b/src/main/java/com/erikmafo/btviewer/ui/querybox/QueryBoxController.java
index b5d965e..fa25f01 100644
--- a/src/main/java/com/erikmafo/btviewer/ui/querybox/QueryBoxController.java
+++ b/src/main/java/com/erikmafo/btviewer/ui/querybox/QueryBoxController.java
@@ -8,7 +8,7 @@
import com.erikmafo.btviewer.sql.SqlQuery;
import com.erikmafo.btviewer.ui.timer.TimerView;
import com.erikmafo.btviewer.ui.util.AlertUtil;
-import com.erikmafo.btviewer.ui.util.FontAwesomeUtil;
+import com.erikmafo.btviewer.ui.util.ContextMenuUtil;
import com.erikmafo.btviewer.util.StringUtil;
import javafx.application.Platform;
import javafx.beans.binding.Bindings;
@@ -20,13 +20,11 @@
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.ContextMenu;
-import javafx.scene.control.MenuItem;
import javafx.scene.control.ProgressBar;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
-import org.controlsfx.glyphfont.FontAwesome;
import org.fxmisc.richtext.CodeArea;
import org.fxmisc.richtext.LineNumberFactory;
import org.jetbrains.annotations.NotNull;
@@ -165,35 +163,11 @@ private void onMousePressed(@NotNull MouseEvent event) {
private ContextMenu getOrCreateContextMenu() {
ContextMenu contextMenu = codeArea.getContextMenu();
if (contextMenu == null) {
- contextMenu = new ContextMenu();
- contextMenu.setAutoHide(true);
- contextMenu.setHideOnEscape(true);
- contextMenu.getItems().addAll(getCutMenuItem(), getCopyMenuItem(), getPastMenuItem());
+ contextMenu = ContextMenuUtil.createContextMenu(
+ ContextMenuUtil.createCutMenuItem(e -> codeArea.cut()),
+ ContextMenuUtil.createCopyMenuItem(e -> codeArea.copy()),
+ ContextMenuUtil.createPasteMenuItem(e -> codeArea.paste()));
}
return contextMenu;
}
-
- @NotNull
- private MenuItem getPastMenuItem() {
- var paste = new MenuItem("Paste");
- paste.setGraphic(FontAwesomeUtil.create(FontAwesome.Glyph.PASTE));
- paste.setOnAction(e -> codeArea.paste());
- return paste;
- }
-
- @NotNull
- private MenuItem getCopyMenuItem() {
- var copy = new MenuItem("Copy");
- copy.setGraphic(FontAwesomeUtil.create(FontAwesome.Glyph.COPY));
- copy.setOnAction(e -> codeArea.copy());
- return copy;
- }
-
- @NotNull
- private MenuItem getCutMenuItem() {
- var cut = new MenuItem("Cut");
- cut.setGraphic(FontAwesomeUtil.create(FontAwesome.Glyph.CUT));
- cut.setOnAction(e -> codeArea.cut());
- return cut;
- }
}
diff --git a/src/main/java/com/erikmafo/btviewer/ui/queryresult/QueryResultViewController.java b/src/main/java/com/erikmafo/btviewer/ui/queryresult/QueryResultViewController.java
index d0ed3f3..567d1b5 100644
--- a/src/main/java/com/erikmafo/btviewer/ui/queryresult/QueryResultViewController.java
+++ b/src/main/java/com/erikmafo/btviewer/ui/queryresult/QueryResultViewController.java
@@ -39,6 +39,9 @@
import java.util.function.Consumer;
import java.util.stream.Collectors;
+import static com.erikmafo.btviewer.ui.util.ContextMenuUtil.createContextMenu;
+import static com.erikmafo.btviewer.ui.util.ContextMenuUtil.createCopyMenuItem;
+
public class QueryResultViewController {
private static final String ROW_KEY = "key";
@@ -130,12 +133,7 @@ public void onTableViewKeyPressed(@NotNull KeyEvent keyEvent) {
@NotNull
private ContextMenu createTableViewContextMenu() {
- ContextMenu contextMenu = new ContextMenu();
- contextMenu.setAutoHide(true);
- MenuItem copy = new MenuItem("Copy");
- copy.setOnAction(actionEvent -> copySelectedCellsToClipboard());
- contextMenu.getItems().add(copy);
- return contextMenu;
+ return createContextMenu(createCopyMenuItem(e -> copySelectedCellsToClipboard()));
}
public void setRows(@NotNull ObservableList rows) {
diff --git a/src/main/java/com/erikmafo/btviewer/ui/util/ContextMenuUtil.java b/src/main/java/com/erikmafo/btviewer/ui/util/ContextMenuUtil.java
new file mode 100644
index 0000000..bb0f8b9
--- /dev/null
+++ b/src/main/java/com/erikmafo/btviewer/ui/util/ContextMenuUtil.java
@@ -0,0 +1,46 @@
+package com.erikmafo.btviewer.ui.util;
+
+import javafx.event.ActionEvent;
+import javafx.event.EventHandler;
+import javafx.scene.control.ContextMenu;
+import javafx.scene.control.MenuItem;
+import org.controlsfx.glyphfont.FontAwesome;
+import org.jetbrains.annotations.NotNull;
+
+
+public class ContextMenuUtil {
+
+ @NotNull
+ public static ContextMenu createContextMenu(MenuItem... items) {
+ var contextMenu = new ContextMenu();
+ contextMenu.setStyle("");
+ contextMenu.setAutoHide(true);
+ contextMenu.setHideOnEscape(true);
+ contextMenu.getItems().addAll(items);
+ return contextMenu;
+ }
+
+ @NotNull
+ public static MenuItem createCutMenuItem(EventHandler handler) {
+ var menuItem = new MenuItem("Cut");
+ menuItem.setGraphic(FontAwesomeUtil.create(FontAwesome.Glyph.CUT));
+ menuItem.setOnAction(handler);
+ return menuItem;
+ }
+
+ @NotNull
+ public static MenuItem createCopyMenuItem(EventHandler handler) {
+ var menuItem = new MenuItem("Copy");
+ menuItem.setGraphic(FontAwesomeUtil.create(FontAwesome.Glyph.COPY));
+ menuItem.setOnAction(handler);
+ return menuItem;
+ }
+
+ @NotNull
+ public static MenuItem createPasteMenuItem(EventHandler handler) {
+ var menuItem = new MenuItem("Paste");
+ menuItem.setGraphic(FontAwesomeUtil.create(FontAwesome.Glyph.PASTE));
+ menuItem.setOnAction(handler);
+ return menuItem;
+ }
+}
diff --git a/src/main/resources/css/query_box.css b/src/main/resources/css/query_box.css
index f1f91fd..073a7bb 100644
--- a/src/main/resources/css/query_box.css
+++ b/src/main/resources/css/query_box.css
@@ -2,7 +2,6 @@
.code-area {
-fx-font-size: 14;
- -fx-font-weight: 690;
}
.keyword {