Project

General

Profile

Download (1.6 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10

    
11
package eu.etaxonomy.taxeditor;
12

    
13
import org.eclipse.core.runtime.Platform;
14
import org.osgi.framework.Bundle;
15

    
16
import eu.etaxonomy.taxeditor.model.AbstractUtility;
17

    
18
/**
19
 * <p>ApplicationUtil class.</p>
20
 *
21
 * @author n.hoffmann
22
 * @created Oct 13, 2010
23
 * @version 1.0
24
 */
25
public class ApplicationUtil extends AbstractUtility {
26

    
27

    
28
    /**
29
     * Prefix to declare the version as beta
30
     */
31
    private static final String BETA_PREFIX = "[Campanula CDM 3.4]";
32

    
33
    /**
34
     * @return
35
     */
36
    public static String getVersion() {
37
        Bundle bundle = Platform.getBundle("eu.etaxonomy.taxeditor.application");
38
        String version = bundle.getHeaders().get(org.osgi.framework.Constants.BUNDLE_VERSION);
39
        // Checking if this is a beta (snapshot) version
40
        if(version ==null || version.isEmpty()) {
41
            return "";
42
        }
43
        String[] parts = version.split("\\.");
44
        if(parts.length <= 3) {
45
            // this is a stable version
46
            return version;
47
        } else {
48
            return BETA_PREFIX + version;
49
        }
50

    
51
    }
52

    
53
    /**
54
     * @return
55
     */
56
    public static boolean isStable() {
57
        return !getVersion().startsWith(BETA_PREFIX);
58
    }
59
	/**
60
	 * <p>getPluginId</p>
61
	 *
62
	 * @return a {@link java.lang.String} object.
63
	 */
64
	public static String getPluginId(){
65
		return TaxonomicEditorPlugin.PLUGIN_ID;
66
	}
67

    
68

    
69

    
70
}
(3-3/11)