diff --git a/pom.xml b/pom.xml
index 3b00037..913cc55 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
de.marza.firstspirit.modules
the-second-hand-log
- 1.0.3
+ 1.0.4
jar
The Second-Hand Log
diff --git a/src/main/java/de/marza/firstspirit/modules/logging/console/ConsoleWindow.java b/src/main/java/de/marza/firstspirit/modules/logging/console/ConsoleWindow.java
index 6f4f3b0..98cedde 100644
--- a/src/main/java/de/marza/firstspirit/modules/logging/console/ConsoleWindow.java
+++ b/src/main/java/de/marza/firstspirit/modules/logging/console/ConsoleWindow.java
@@ -5,6 +5,8 @@
import javax.swing.*;
import javax.swing.text.JTextComponent;
import java.awt.*;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
import java.util.Locale;
import java.util.ResourceBundle;
@@ -16,6 +18,7 @@ public class ConsoleWindow {
private final ResourceBundle menuLabels;
private JFrame window;
private MessageConsole console;
+ private JTextComponent textComponent;
@NotNull
public static ConsoleWindow getInstance() {
@@ -35,9 +38,9 @@ public JFrame getFrame() {
setupMenu();
- final JTextComponent textComponent = setupUI();
+ textComponent = setupUI();
- setupConsole(textComponent);
+ setupConsole();
window.pack();
}
@@ -74,6 +77,17 @@ private void setupMenu() {
close.setMnemonic(isGerman() ? 'S' : 'C');
close.setAccelerator(KeyStroke.getKeyStroke("alt F4"));
+ final JMenu edit = new JMenu(menuLabels.getString("editMenu"));
+ menubar.add(edit);
+ edit.setMnemonic(isGerman() ? 'B' : 'E');
+
+ final JMenuItem clear = new JMenuItem(menuLabels.getString("clearLog"));
+ edit.add(clear);
+ clear.setActionCommand(MenuActions.CLEAR_LOG.name());
+ clear.addActionListener(menuActionLisener);
+ clear.setMnemonic(isGerman() ? 'L' : 'C');
+ clear.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0));
+
final JMenu helpMenu = new JMenu(menuLabels.getString("helpMenu"));
menubar.add(helpMenu);
helpMenu.setMnemonic('H');
@@ -82,11 +96,13 @@ private void setupMenu() {
helpMenu.add(contents);
contents.addActionListener(menuActionLisener);
contents.setActionCommand(MenuActions.SHOW_HELP_CONTENTS.name());
+ contents.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
final JMenuItem report = new JMenuItem(menuLabels.getString("report.a.bug.or.feature"));
helpMenu.add(report);
report.addActionListener(menuActionLisener);
report.setActionCommand(MenuActions.SHOW_BUGS_FEATURES.name());
+ report.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_B, InputEvent.CTRL_MASK));
helpMenu.addSeparator();
@@ -111,7 +127,7 @@ private JTextComponent setupUI() {
return textComponent;
}
- private void setupConsole(final JTextComponent textComponent) {
+ private void setupConsole() {
console = new MessageConsole(textComponent);
console.redirectOut(null, System.out);
console.redirectErr(Color.RED, System.err);
@@ -144,4 +160,8 @@ public ImageIcon getImageIconPressed() {
public ResourceBundle getMenuLabels() {
return menuLabels;
}
+
+ public void clearLog() {
+ textComponent.setText("");
+ }
}
diff --git a/src/main/java/de/marza/firstspirit/modules/logging/console/MenuActions.java b/src/main/java/de/marza/firstspirit/modules/logging/console/MenuActions.java
index a842964..c4e5a75 100644
--- a/src/main/java/de/marza/firstspirit/modules/logging/console/MenuActions.java
+++ b/src/main/java/de/marza/firstspirit/modules/logging/console/MenuActions.java
@@ -3,6 +3,6 @@
public enum MenuActions {
- CLOSE, SHOW_INFO, SHOW_HELP_CONTENTS, SHOW_BUGS_FEATURES
+ CLOSE, CLEAR_LOG, SHOW_INFO, SHOW_HELP_CONTENTS, SHOW_BUGS_FEATURES
}
diff --git a/src/main/java/de/marza/firstspirit/modules/logging/console/MenuController.java b/src/main/java/de/marza/firstspirit/modules/logging/console/MenuController.java
index 296cdb5..4220c06 100644
--- a/src/main/java/de/marza/firstspirit/modules/logging/console/MenuController.java
+++ b/src/main/java/de/marza/firstspirit/modules/logging/console/MenuController.java
@@ -27,15 +27,20 @@ public void run() {
case CLOSE:
parent.setVisible(false);
break;
+ case CLEAR_LOG:
+ consoleWindow.clearLog();
+ break;
case SHOW_INFO:
final String title = consoleWindow.getMenuLabels().getString("aboutItem");
JOptionPane.showMessageDialog(parent, readAboutText(), title, JOptionPane.PLAIN_MESSAGE);
break;
case SHOW_BUGS_FEATURES:
- HyperlinkExecutor.browseTo(URI.create("https://github.com/zaplatynski/second-hand-log/issues"));
+ final URI issues = URI.create("https://github.com/zaplatynski/second-hand-log/issues");
+ HyperlinkExecutor.browseTo(issues);
break;
case SHOW_HELP_CONTENTS:
- HyperlinkExecutor.browseTo(URI.create("https://github.com/zaplatynski/second-hand-log/wiki"));
+ final URI wiki = URI.create("https://github.com/zaplatynski/second-hand-log/wiki");
+ HyperlinkExecutor.browseTo(wiki);
break;
default:
final String errorMessage = consoleWindow.getMenuLabels().getString("missing.menu.action");
diff --git a/src/main/resources/de/marza/firstspirit/modules/logging/MenuLabels.properties b/src/main/resources/de/marza/firstspirit/modules/logging/MenuLabels.properties
index 69aa8ba..d8b9422 100644
--- a/src/main/resources/de/marza/firstspirit/modules/logging/MenuLabels.properties
+++ b/src/main/resources/de/marza/firstspirit/modules/logging/MenuLabels.properties
@@ -6,4 +6,6 @@ helpMenu=Help
contents=Contents...
report.a.bug.or.feature=Report a bug or feature...
missing.menu.action=Missing menu action!
-unkown.menu.command=Unkown Menu Command
\ No newline at end of file
+unkown.menu.command=Unkown Menu Command
+editMenu=Edit
+clearLog=Clear log messages
\ No newline at end of file
diff --git a/src/main/resources/de/marza/firstspirit/modules/logging/MenuLabels_de.properties b/src/main/resources/de/marza/firstspirit/modules/logging/MenuLabels_de.properties
index 04402e1..7bd0f8c 100644
--- a/src/main/resources/de/marza/firstspirit/modules/logging/MenuLabels_de.properties
+++ b/src/main/resources/de/marza/firstspirit/modules/logging/MenuLabels_de.properties
@@ -1,6 +1,8 @@
aboutItem=\u00DCber
+clearLog=L\u00F6sche Lognachrichten
closeItem=Schlie\u00DFen
contents=Inhalt...
+editMenu=Bearbeiten
fileMenu=Datei
helpMenu=Hilfe
missing.menu.action=Fehlende Men\u00FCaktion!