KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mountainminds > eclemma > internal > core > EclipseVersion


1 /*******************************************************************************
2  * Copyright (c) 2006 Mountainminds GmbH & Co. KG
3  * This software is provided under the terms of the Eclipse Public License v1.0
4  * See http://www.eclipse.org/legal/epl-v10.html.
5  *
6  * $Id: EclipseVersion.java 377 2007-08-13 15:30:49Z mtnminds $
7  ******************************************************************************/

8 package com.mountainminds.eclemma.internal.core;
9
10 import org.eclipse.core.runtime.Platform;
11 import org.osgi.framework.Bundle;
12 import org.osgi.framework.Version;
13
14 /**
15  * Some constants to behave version specific in some situations. Unfortunately
16  * this is necessary as EclEmma works on multiple Eclipse versions and relies on
17  * internal implementation details.
18  *
19  * @author Marc R. Hoffmann
20  * @version $Revision: 377 $
21  */

22 public class EclipseVersion {
23
24   public static final Version CURRENT;
25   
26   public static final Version V320 = new Version("3.2.0"); //$NON-NLS-1$
27

28   /**
29    * Checks whether the current platform version is greater or equal than the
30    * given version.
31    *
32    * @param version version to compare to
33    * @return true, if the current version is greater or equal than the given one
34    */

35   public static boolean isGreaterOrEqualTo(Version version) {
36     return CURRENT.compareTo(version) >= 0;
37   }
38   
39   static {
40     Bundle rt = Platform.getBundle(Platform.PI_RUNTIME);
41     String JavaDoc version = (String JavaDoc) rt.getHeaders().get(org.osgi.framework.Constants.BUNDLE_VERSION);
42     CURRENT = new Version(version);
43   }
44   
45 }
46
Popular Tags