From 161af59764d0e4df632ace57c6de9d02ae7d3e5d Mon Sep 17 00:00:00 2001 From: tkellner Date: Mon, 27 Jan 2014 17:59:46 +0000 Subject: Make application name a constant git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@479 174cde9d-5d70-4d2a-aa98-46368bc2aaf7 --- pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java | 7 +++++++ pdf-over-gui/src/main/java/at/asit/pdfover/gui/Main.java | 6 +++--- pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java | 4 ++-- .../at/asit/pdfover/gui/composites/ConfigurationComposite.java | 2 +- .../main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java | 3 +-- .../src/main/resources/at/asit/pdfover/gui/messages.properties | 1 - .../src/main/resources/at/asit/pdfover/gui/messages_de.properties | 1 - 7 files changed, 14 insertions(+), 10 deletions(-) (limited to 'pdf-over-gui') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java index d95fd000..a9492f0e 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java @@ -30,6 +30,13 @@ import at.asit.pdfover.gui.workflow.states.mobilebku.MobileBKUs; */ public class Constants { + /** Application name */ + public static final String APP_NAME = "PDF-Over"; //$NON-NLS-1$ + + static { + // Has to be set before (implicitly) initializing Display + Display.setAppName(APP_NAME); + } /** Current display - used for Colors */ private static Display display = Display.getCurrent(); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Main.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Main.java index 03b0bfeb..78e22fbb 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Main.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Main.java @@ -57,13 +57,13 @@ public class Main { File configDir = new File(Constants.CONFIG_DIRECTORY); if(!configDir.exists()) { configDir.mkdir(); - } - + } + File log4j = new File(configDir.getAbsolutePath() + File.separator + Constants.DEFAULT_LOG4J_FILENAME); if(log4j.exists()) { PropertyConfigurator.configureAndWatch(log4j.getAbsolutePath()); } - + StateMachineImpl stateMachine = new StateMachineImpl(args); log.debug("Starting stateMachine ..."); //$NON-NLS-1$ diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java index a243a717..e847fd0c 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java @@ -168,7 +168,6 @@ public class MainWindow { * Reload the localization */ public void reloadLocalization() { - getShell().setText(Messages.getString("main.title")); //$NON-NLS-1$ this.btn_config.setText(Messages.getString("main.configuration")); //$NON-NLS-1$ this.btn_config.setToolTipText(Messages.getString("main.configuration")); //$NON-NLS-1$ this.btn_open.setText(Messages.getString("common.open")); //$NON-NLS-1$ @@ -229,7 +228,8 @@ public class MainWindow { catch (SWTError e) { log.debug("Cannot get display", e); //$NON-NLS-1$ } - getShell().setText(Messages.getString("main.title")); //$NON-NLS-1$ + Display.setAppVersion(this.getClass().getPackage().getImplementationVersion()); + getShell().setText(Constants.APP_NAME); getShell().addShellListener(new ShellAdapter() { @Override diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java index b4b519f1..0b2bbb05 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java @@ -181,7 +181,7 @@ public class ConfigurationComposite extends StateComposite { String version = getClass().getPackage().getImplementationVersion(); version = (version == null ? "" : " v" + version); //$NON-NLS-1$ //$NON-NLS-2$ - getShell().setText(Messages.getString("main.title") + version); //$NON-NLS-1$ + getShell().setText(Constants.APP_NAME + version); this.doLayout(); } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java index 324e9a30..d4c391b5 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java @@ -25,8 +25,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.MainWindow; -import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.controls.Dialog.BUTTONS; +import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.utils.Messages; import at.asit.pdfover.gui.workflow.config.ConfigManipulator; import at.asit.pdfover.gui.workflow.config.ConfigOverlayManipulator; @@ -172,7 +172,6 @@ public class StateMachineImpl implements StateMachine, GUIProvider { this.display = Display.getDefault(); this.mainWindow = new MainWindow(this); - this.mainWindow.open(); this.shell = this.mainWindow.getShell(); diff --git a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties index 208b97fc..0f2c5b2f 100644 --- a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties +++ b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties @@ -119,7 +119,6 @@ main.configuration=Configuration main.done=Finish main.position=Positioning main.signature=Signing -main.title=PDF-Over mobileBKU.number=Number: mobileBKU.password=Password: mobileBKU.show=Show signature data diff --git a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties index 73e63a8c..34840eb8 100644 --- a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties +++ b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties @@ -119,7 +119,6 @@ main.configuration=Konfiguration main.done=Fertig main.position=Positionierung main.signature=Signatur -main.title=PDF-Over mobileBKU.number=Nummer: mobileBKU.password=Passwort: mobileBKU.show=Signaturdaten anzeigen -- cgit v1.2.3