1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.taxeditor.util;
|
11
|
|
12
|
import org.eclipse.core.runtime.Platform;
|
13
|
import org.osgi.framework.Bundle;
|
14
|
|
15
|
import eu.etaxonomy.taxeditor.model.AbstractUtility;
|
16
|
|
17
|
/**
|
18
|
* <p>ApplicationUtil class.</p>
|
19
|
*
|
20
|
* @author n.hoffmann
|
21
|
* @created Oct 13, 2010
|
22
|
* @version 1.0
|
23
|
*/
|
24
|
public class ApplicationUtil extends AbstractUtility {
|
25
|
|
26
|
|
27
|
/**
|
28
|
* Prefix to declare the version as beta
|
29
|
*/
|
30
|
private static final String BETA_PREFIX = "[BETA]";
|
31
|
|
32
|
public static String getTitle() {
|
33
|
return "EDIT Taxonomic Editor " + ApplicationUtil.getVersion();
|
34
|
}
|
35
|
/**
|
36
|
* @return
|
37
|
*/
|
38
|
public static String getVersion() {
|
39
|
Bundle bundle = Platform.getBundle("eu.etaxonomy.taxeditor.application");
|
40
|
String version = bundle.getHeaders().get(org.osgi.framework.Constants.BUNDLE_VERSION);
|
41
|
// Checking if this is a beta (snapshot) version
|
42
|
if(version ==null || version.isEmpty()) {
|
43
|
return "";
|
44
|
}
|
45
|
String[] parts = version.split("\\.");
|
46
|
if(parts.length <= 3) {
|
47
|
// this is a stable version
|
48
|
return version;
|
49
|
} else {
|
50
|
return BETA_PREFIX + " " + version + " UTC";
|
51
|
}
|
52
|
|
53
|
}
|
54
|
|
55
|
/**
|
56
|
* @return
|
57
|
*/
|
58
|
public static boolean isStable() {
|
59
|
return !getVersion().startsWith(BETA_PREFIX);
|
60
|
}
|
61
|
|
62
|
|
63
|
}
|