Revision 49c6e8c3
Added by Cherian Mathew over 9 years ago
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ApplicationUtil.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 2 |
/** |
3 | 3 |
* Copyright (C) 2007 EDIT |
4 |
* European Distributed Institute of Taxonomy
|
|
4 |
* European Distributed Institute of Taxonomy |
|
5 | 5 |
* http://www.e-taxonomy.eu |
6 |
*
|
|
6 |
* |
|
7 | 7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
8 | 8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
9 | 9 |
*/ |
10 | 10 |
|
11 | 11 |
package eu.etaxonomy.taxeditor; |
12 | 12 |
|
13 |
import org.eclipse.core.runtime.Platform; |
|
14 |
import org.osgi.framework.Bundle; |
|
15 |
|
|
13 | 16 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
14 | 17 |
|
15 | 18 |
/** |
... | ... | |
21 | 24 |
*/ |
22 | 25 |
public class ApplicationUtil extends AbstractUtility { |
23 | 26 |
|
27 |
|
|
28 |
private static final String BETA_PREFIX = "[BETA]"; |
|
29 |
|
|
30 |
/** |
|
31 |
* @return |
|
32 |
*/ |
|
33 |
public static String getVersion() { |
|
34 |
Bundle bundle = Platform.getBundle("eu.etaxonomy.taxeditor.application"); |
|
35 |
String version = bundle.getHeaders().get(org.osgi.framework.Constants.BUNDLE_VERSION); |
|
36 |
// Checking if this is a beta (snapshot) version |
|
37 |
if(version ==null || version.isEmpty()) { |
|
38 |
return ""; |
|
39 |
} |
|
40 |
String[] parts = version.split("\\."); |
|
41 |
if(parts.length <= 3) { |
|
42 |
// this is a stable version |
|
43 |
return version; |
|
44 |
} else { |
|
45 |
return BETA_PREFIX + version; |
|
46 |
} |
|
47 |
|
|
48 |
} |
|
49 |
|
|
50 |
/** |
|
51 |
* @return |
|
52 |
*/ |
|
53 |
public static boolean isStable() { |
|
54 |
return !getVersion().startsWith(BETA_PREFIX); |
|
55 |
} |
|
24 | 56 |
/** |
25 | 57 |
* <p>getPluginId</p> |
26 | 58 |
* |
... | ... | |
29 | 61 |
public static String getPluginId(){ |
30 | 62 |
return TaxonomicEditorPlugin.PLUGIN_ID; |
31 | 63 |
} |
32 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
33 | 67 |
} |
Also available in: Unified diff
P2 update implementation and editor version extraction
ApplicationWorkbenchAdvisor : clean up
ApplicationWorkbenchWindowAdvisor : added update of editor to startup
P2Util : replaced older class with a new one which handles background update of editor
UpdateHandler : handles modal update of editor when requested
InstallNewSoftwareHandler, PreloadingRepositoryHandler : handlers for installing new software and preloading repositories (not used yet)
ApplicationUtil : added new methods to retrieve editor version number
TaxonomicEditorPlugin : added new methods for retrieving provisioning elements
build.properties, pom.xml, plugin_en.properties, plugin.properties, plugin_de.properties : setup dynamic properties (version number , build date) to be replaced via maven
plugin.xml, MANIFEST.MF : added new dependencies for p2 update mechanism
p2.inf : deleted since we now setup update repositories programmatically