本文整理匯總了Java中org.osgi.framework.Version.getMinor方法的典型用法代碼示例。如果您正苦於以下問題:Java Version.getMinor方法的具體用法?Java Version.getMinor怎麽用?Java Version.getMinor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.osgi.framework.Version
的用法示例。
在下文中一共展示了Version.getMinor方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: Version4Digit
import org.osgi.framework.Version; //導入方法依賴的package包/類
public Version4Digit(String versionString) {
try {
Version v = new Version(versionString);
major = v.getMajor();
minor = v.getMinor();
micro = v.getMicro();
qualifier = v.getQualifier();
} catch (IllegalArgumentException eae) {
// this isn't a valid OSGI Version but we want to support 1.2.3.4+ Versions
String[] bits = versionString.split("\\.");
if (bits.length != 4) {
throw eae; // throw the original exception
}
try {
major = Integer.parseInt(bits[0]);
minor = Integer.parseInt(bits[1]);
micro = Integer.parseInt(bits[2]);
} catch (NumberFormatException e) {
throw eae; // throw the original exception
}
qualifier = bits[3];
}
}
示例2: update
import org.osgi.framework.Version; //導入方法依賴的package包/類
@Override
public void update(ILaunchConfigurationWorkingCopy launchConfig,
IJavaProject javaProject, List<String> programArgs, List<String> vmArgs)
throws CoreException {
// As of Eclipse Kepler(4.3), the use of -XStartOnFirstThread is a built-in launch config
// attribute so it is not necessary to make it an explicit argument. This prevents issues when
// sharing a launch config file across multiple OS platforms.
Bundle bundle = Platform.getBundle("org.eclipse.platform");
if (bundle != null) {
Version bundleVersion = bundle.getVersion();
if (bundleVersion.getMajor() == 4 && bundleVersion.getMinor() >= 3) {
updateEclipse43(launchConfig, javaProject, programArgs, vmArgs);
} else {
updateNonEclipse43(launchConfig, javaProject, programArgs, vmArgs);
}
}
}
示例3: eclipseAndJvmSupportedJavaVersion
import org.osgi.framework.Version; //導入方法依賴的package包/類
/** TopCoder supports java 1.8. */
private static String eclipseAndJvmSupportedJavaVersion() {
boolean jvm18Installed = false;
for(IVMInstallType vm : JavaRuntime.getVMInstallTypes()) {
for(IVMInstall inst : vm.getVMInstalls()) {
if(inst instanceof IVMInstall2) {
String jvmVersion = ((IVMInstall2) inst).getJavaVersion();
String[] jvmVersionParts = jvmVersion.split("\\.");
int major = Integer.parseInt(jvmVersionParts[0]);
int minor = Integer.parseInt(jvmVersionParts[1]);
if((major == 1 && minor >= 8) || major >=2) {
jvm18Installed = true;
}
}
}
}
Version jdtVersion = JavaCore.getJavaCore().getBundle().getVersion();
boolean jdtSupports18 = jdtVersion.getMajor() >= 4
|| (jdtVersion.getMajor() == 3 && jdtVersion.getMinor() >= 10)
|| (jdtVersion.getMajor() == 3 && jdtVersion.getMinor() >= 9 && jdtVersion.getMicro() >= 50);
return jvm18Installed && jdtSupports18 ? "1.8" : "1.7";
}
示例4: createVersionText
import org.osgi.framework.Version; //導入方法依賴的package包/類
private static void createVersionText() {
final Version version = TourbookPlugin.getDefault().getVersion();
final String qualifier = version.getQualifier();
_isDev = qualifier.contains("qualifier"); //$NON-NLS-1$
_qualifierText = _isDev ? //
//
// this text is used to identify development versions
DEVELOPMENT_VERSION_TEXT
//
: qualifier;
_qualifierText += _subVersion;
_versionSimple = UI.EMPTY_STRING
+ version.getMajor()
+ UI.SYMBOL_DOT
+ version.getMinor()
+ UI.SYMBOL_DOT
+ version.getMicro();
_versionFull = _versionSimple + UI.SYMBOL_DOT + _qualifierText;
}
示例5: retrieveEclipseVersionString
import org.osgi.framework.Version; //導入方法依賴的package包/類
private String retrieveEclipseVersionString() {
String product = System.getProperty("eclipse.product");
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint point = registry.getExtensionPoint("org.eclipse.core.runtime.products");
if (point != null) {
IExtension[] extensions = point.getExtensions();
for (IExtension ext : extensions) {
if (product.equals(ext.getUniqueIdentifier())) {
IContributor contributor = ext.getContributor();
if (contributor != null) {
Bundle bundle = Platform.getBundle(contributor.getName());
if (bundle != null) {
Version version = bundle.getVersion();
return version.getMajor() + "." + version.getMinor();
}
}
}
}
}
return null;
}
示例6: start
import org.osgi.framework.Version; //導入方法依賴的package包/類
@Override
public void start(BundleContext context) throws Exception {
// FIXME figure out a more compact way to create a version-aware provider,
// that uses the bundle version but is not too dependent on OSGi APIs itself.
Version bundleVersion = context.getBundle().getVersion();
VersionSpecification providerVersion = new ThreeDigitVersionSpecification(bundleVersion.getMajor(), bundleVersion.getMinor(), bundleVersion.getMicro(),
bundleVersion.getQualifier());
_apSvcReg = context.registerService(ModelElementClassProvider.class.getName(), new DefaultModelElementClassProvider(providerVersion, XYPlotActor.class),
null);
}
示例7: start
import org.osgi.framework.Version; //導入方法依賴的package包/類
@Override
public void start(BundleContext context) throws Exception {
// FIXME figure out a more compact way to create a version-aware provider,
// that uses the bundle version but is not too dependent on OSGi APIs itself.
Version bundleVersion = context.getBundle().getVersion();
VersionSpecification providerVersion = new ThreeDigitVersionSpecification(bundleVersion.getMajor(), bundleVersion.getMinor(), bundleVersion.getMicro(),
bundleVersion.getQualifier());
_apSvcReg = context.registerService(ModelElementClassProvider.class.getName(),
new DefaultModelElementClassProvider(providerVersion, SizeAttribute.class, WindowPropertiesAttribute.class), null);
}
示例8: start
import org.osgi.framework.Version; //導入方法依賴的package包/類
@Override
public void start(BundleContext context) throws Exception {
// FIXME figure out a more compact way to create a version-aware provider,
// that uses the bundle version but is not too dependent on OSGi APIs itself.
Version bundleVersion = context.getBundle().getVersion();
VersionSpecification providerVersion = new ThreeDigitVersionSpecification(bundleVersion.getMajor(), bundleVersion.getMinor(), bundleVersion.getMicro(),
bundleVersion.getQualifier());
_apSvcReg = context.registerService(ModelElementClassProvider.class.getName(), new DefaultModelElementClassProvider(providerVersion, PythonActor.class),
null);
}
示例9: start
import org.osgi.framework.Version; //導入方法依賴的package包/類
@Override
public void start(BundleContext context) throws Exception {
// FIXME figure out a more compact way to create a version-aware provider,
// that uses the bundle version but is not too dependent on OSGi APIs itself.
Version bundleVersion = context.getBundle().getVersion();
VersionSpecification providerVersion = new ThreeDigitVersionSpecification(bundleVersion.getMajor(), bundleVersion.getMinor(), bundleVersion.getMicro(),
bundleVersion.getQualifier());
_apSvcReg = context.registerService(ModelElementClassProvider.class.getName(), new DefaultModelElementClassProvider(providerVersion, TaskBasedActor.class),
null);
}
示例10: toMajorMinorVersion
import org.osgi.framework.Version; //導入方法依賴的package包/類
/**
* @return the major and minor parts of the given version
*/
private static Version toMajorMinorVersion(final Version version) {
return new Version(version.getMajor(), version.getMinor(), 0);
}
示例11: getSpecificationVersion
import org.osgi.framework.Version; //導入方法依賴的package包/類
public @Override SpecificationVersion getSpecificationVersion() {
Version v = b.getVersion();
return new SpecificationVersion(v.getMajor() % 100 + "." + v.getMinor() + "." + v.getMicro());
}
示例12: isEclipse47
import org.osgi.framework.Version; //導入方法依賴的package包/類
public static boolean isEclipse47 () {
Version version = Platform.getBundle("org.eclipse.platform").getVersion();
return (version.getMajor() == 4) && (version.getMinor() == 7);
}
示例13: getKey
import org.osgi.framework.Version; //導入方法依賴的package包/類
private String getKey(Resource res) {
Version version = res.getVersion();
Version simpleVersion = new Version(version.getMajor(), version.getMinor(), version.getMicro());
return res.getSymbolicName() + ";" + simpleVersion.toString();
}
示例14: makeRange
import org.osgi.framework.Version; //導入方法依賴的package包/類
@Override
public VersionRange makeRange ( final Version version )
{
final Version endVersion = new Version ( version.getMajor (), version.getMinor () + 1, 0 );
return new VersionRange ( VersionRange.LEFT_CLOSED, version, endVersion, VersionRange.RIGHT_OPEN );
}
示例15: isNewerThan
import org.osgi.framework.Version; //導入方法依賴的package包/類
/**
* check left value against right value
*
* @param left
* @param right
* @return returns if right is newer than left
*/
public static boolean isNewerThan(final Version left, final Version right) {
// major
if(left.getMajor()>right.getMajor()) return true;
if(left.getMajor()<right.getMajor()) return false;
// minor
if(left.getMinor()>right.getMinor()) return true;
if(left.getMinor()<right.getMinor()) return false;
// micro
if(left.getMicro()>right.getMicro()) return true;
if(left.getMicro()<right.getMicro()) return false;
// qualifier
// left
String q = left.getQualifier();
int index=q.indexOf('-');
String qla = index==-1?"":q.substring(index+1).trim();
String qln=index==-1?q:q.substring(0, index);
int ql = isEmpty(qln)?Integer.MIN_VALUE:Integer.parseInt(qln);
//right
q = right.getQualifier();
index=q.indexOf('-');
String qra = index==-1?"":q.substring(index+1).trim();
String qrn=index==-1?q:q.substring(0, index);
int qr = isEmpty(qln)?Integer.MIN_VALUE:Integer.parseInt(qrn);
if(ql>qr) return true;
if(ql<qr) return false;
int qlan=qualifierAppendix2Number(qla);
int qran=qualifierAppendix2Number(qra);
if(qlan>qran) return true;
if(qlan<qran) return false;
if(qlan==QUALIFIER_APPENDIX_OTHER && qran==QUALIFIER_APPENDIX_OTHER)
return left.compareTo(right) > 0;
return false;
}