summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2014-02-03 15:22:51 +0000
committertkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2014-02-03 15:22:51 +0000
commit521431920bb0079a618ffe5d72bd6280608fc13f (patch)
tree5b8ebc426fc124faae8dc9e3d3d4bc9fdf5147ac
parent45e0bd8a3b2153e910719e6a6ceea94e0e32c2ca (diff)
downloadmocca-521431920bb0079a618ffe5d72bd6280608fc13f.tar.gz
mocca-521431920bb0079a618ffe5d72bd6280608fc13f.tar.bz2
mocca-521431920bb0079a618ffe5d72bd6280608fc13f.zip
Add Application Version Constant
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@505 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java9
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java8
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java4
3 files changed, 11 insertions, 10 deletions
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 a9492f0e..aae15703 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
@@ -33,10 +33,17 @@ public class Constants {
/** Application name */
public static final String APP_NAME = "PDF-Over"; //$NON-NLS-1$
+ /** Application version */
+ public static final String APP_VERSION = Constants.class.getPackage().getImplementationVersion();
+
+ /** Application name + version */
+ public static final String APP_NAME_VERSION = (APP_VERSION == null ? APP_NAME : APP_NAME + " v" + APP_VERSION); //$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();
@@ -68,7 +75,7 @@ public class Constants {
public static final int SIGNATURE_KEYBOARD_POSITIONING_OFFSET = 15;
/** PDF-Over User Agent string */
- public static final String USER_AGENT_STRING = "PDF-Over 4.0"; //$NON-NLS-1$
+ public static final String USER_AGENT_STRING = "PDF-Over " + (APP_VERSION == null ? "4.0" : APP_VERSION); //$NON-NLS-1$ //$NON-NLS-2$
/* Configuration parameters */
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 d994b72a..18135e3f 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
@@ -237,7 +237,7 @@ public class MainWindow {
catch (SWTError e) {
log.debug("Cannot get display", e); //$NON-NLS-1$
}
- Display.setAppVersion(this.getClass().getPackage().getImplementationVersion());
+ Display.setAppVersion(Constants.APP_VERSION);
getShell().setText(Constants.APP_NAME);
getShell().addShellListener(new ShellAdapter() {
@@ -397,13 +397,9 @@ public class MainWindow {
}, new Listener() {
@Override
public void handleEvent(Event arg0) {
- String version = getClass().getPackage()
- .getImplementationVersion();
- version = (version == null ? "" : " v" + version); //$NON-NLS-1$ //$NON-NLS-2$
- String about = Constants.APP_NAME + version;
Dialog dialog = new Dialog(getShell(),
String.format(Messages.getString("main.about"), Constants.APP_NAME), //$NON-NLS-1$
- about, BUTTONS.OK, ICON.INFORMATION);
+ Constants.APP_NAME_VERSION, BUTTONS.OK, ICON.INFORMATION);
dialog.open();
}
}, new Listener() {
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 785597ad..e7b3d1c6 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,9 +181,7 @@ public class ConfigurationComposite extends StateComposite {
this.containerComposite.setLayout(this.compositeStack);
this.compositeStack.topControl = tabFolder;
- String version = getClass().getPackage().getImplementationVersion();
- version = (version == null ? "" : " v" + version); //$NON-NLS-1$ //$NON-NLS-2$
- getShell().setText(Constants.APP_NAME + version);
+ getShell().setText(Constants.APP_NAME_VERSION);
this.doLayout();
}