Java Code Examples for org.osgi.framework.Version#getMinor()
The following examples show how to use
org.osgi.framework.Version#getMinor() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XStartOnFirstThreadArgumentProcessor.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
@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); } } }
Example 2
Source File: BonitaStudioApplication.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
protected void openErrorDialog(final Display display, final String javaVersion) { final Shell shell = new Shell(display); try { final Version version = Version.parseVersion(ProductVersion.CURRENT_VERSION); final String uriWithProductVersion = ONLINE_DOC_REQUIREMENTS + version.getMajor() + "." + version.getMinor(); final URI uri = new URI(uriWithProductVersion); final MessageDialogWithLink messageDialog = new MessageDialogWithLink(shell, Messages.incompatibleJavaVersionTitle, null, String.format( Messages.incompatibleJavaVersionMessage, org.bonitasoft.studio.common.Messages.bonitaStudioModuleName, javaVersion, "Java 1.8 and Java 11."), MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0, uri); messageDialog.open(); } catch (final URISyntaxException e) { BonitaStudioLog.error(e); } finally { shell.dispose(); } }
Example 3
Source File: M2EUtilities.java From sarl with Apache License 2.0 | 6 votes |
/** Compute the theoretic version just before the given one. * * @param vers the version. * @return the previous version. * @since 0.10 */ @SuppressWarnings("checkstyle:magicnumber") public static Version getPreviousOsgiVersion(Version vers) { int major = vers.getMajor(); int minor = vers.getMinor(); int micro = vers.getMicro(); if (micro <= 0) { micro = MAX_NUMBER; --minor; } if (minor <= 0) { micro = MAX_NUMBER; minor = MAX_NUMBER; --major; } return new Version(major, minor, micro); }
Example 4
Source File: Utilities.java From sarl with Apache License 2.0 | 6 votes |
private static int compareVersionsNoQualifier(Version firstVersion, Version secondVersion) { if (firstVersion == secondVersion) { return 0; } int result = firstVersion.getMajor() - secondVersion.getMajor(); if (result != 0) { return result; } result = firstVersion.getMinor() - secondVersion.getMinor(); if (result != 0) { return result; } return firstVersion.getMicro() - secondVersion.getMicro(); }
Example 5
Source File: BundleLocator.java From knopflerfish.org with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Get the set of version patterns (partial versions) used in the * keys in replacement filters for the given version. * @param version The version to create patterns for. * @return Set of version patterns. */ private static String[] getVersionPatterns(Version version) { if (null==version) { return new String[]{"-N.N.N"}; } final String qualifier = version.getQualifier(); final boolean usesQualifier = null != qualifier && qualifier.length() > 0; final String[] res = new String[usesQualifier ? 5 : 4]; res[0] = "-N.N.N"; res[1] = "-" +version.getMajor() +".N.N"; res[2] = "-" +version.getMajor() +"." +version.getMinor() +".N"; res[3] = "-" +version.getMajor() +"." +version.getMinor() +"." +version.getMicro(); if (usesQualifier) { res[4] = "-" +version.getMajor() +"." +version.getMinor() +"." +version.getMicro() +"." +version.getQualifier(); } return res; }
Example 6
Source File: BundleManifestTask.java From knopflerfish.org with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * If we have a bundle version suffix add it to the * <code>Bundle-Version</code> attribute. */ private void appendVersionSuffix(Manifest mf) { if (versionSuffix != null && !versionSuffix.equals("")) { final Manifest.Attribute bundleVerAttr = mf.getMainSection().getAttribute("Bundle-Version"); if (null!=bundleVerAttr) { final Version ver = new Version(bundleVerAttr.getValue()); String q = ver.getQualifier(); int major = ver.getMajor(); int minor = ver.getMinor(); int micro = ver.getMicro(); if (q.length() == 0) { bundleVerAttr.setValue(new Version(major, minor, micro, versionSuffix).toString()); } else if (!q.endsWith(versionSuffix)) { bundleVerAttr.setValue(new Version(major, minor, micro, q + "-" + versionSuffix).toString()); } } } }
Example 7
Source File: JdtBasedTypeFactory.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
/** * TODO (dennis) consider to make it accessible from other (e.g. o.e.x.common.types.tests) bundles. * * Checks if JDT's (Major,Minor) Version is higher or equals the given one.<br> * Service and qualifier Part will not be checked. * @return <code>true</code> if the avaiable JDT's Version (Major,Minor) is higher or equals the given one. * */ private static boolean isJdtGreaterOrEqual(Version version) { Version installed = JavaCore.getPlugin().getBundle().getVersion(); int minMajor = version.getMajor(); int minMinor = version.getMinor(); if (installed.getMajor() < minMajor) { return false; } if (installed.getMajor() == minMajor && installed.getMinor() < minMinor) { return false; } return true; }
Example 8
Source File: BuildCancellationTest.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
/** * The same as with JdtBasedTypeFactory.isJdtGreaterOrEqual(new Version(3.6.0)) * */ protected boolean isCoreResources_3_7_orLater() { Version installed = org.eclipse.core.resources.ResourcesPlugin.getPlugin().getBundle().getVersion(); int minMajor = 3; int minMinor = 7; if (installed.getMajor() < minMajor) { return false; } if (installed.getMajor() == minMajor && installed.getMinor() < minMinor) { return false; } return true; }
Example 9
Source File: ContentAssistTest.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
/** * The same as with JdtBasedTypeFactory.isJdtGreaterOrEqual(new Version(3.6.0)) * */ protected boolean isJDT_3_6_orLater() { Version installed = JavaCore.getPlugin().getBundle().getVersion(); int minMajor = 3; int minMinor = 6; if (installed.getMajor() < minMajor) { return false; } if (installed.getMajor() == minMajor && installed.getMinor() < minMinor) { return false; } return true; }
Example 10
Source File: Utils.java From sarl with Apache License 2.0 | 5 votes |
/** Check if a version is compatible with the expected SARL library. * * @param version - the version to test. * @return {@code true} if a compatible SARL library was found. * Otherwise {@code false}. */ public static boolean isCompatibleSARLLibraryVersion(String version) { if (version != null) { final Version currentVersion = Version.parseVersion(SARLVersion.SPECIFICATION_RELEASE_VERSION_STRING); final Version paramVersion = Version.parseVersion(version); return currentVersion.getMajor() == paramVersion.getMajor() && currentVersion.getMinor() == paramVersion.getMinor(); } return false; }
Example 11
Source File: TestAssertions.java From sarl with Apache License 2.0 | 5 votes |
/** Assert if the two OSGI version are equal. * * @param expected the expected value. * @param actual the actual value. */ public static void assertOsgiVersionEquals(Version expected, Version actual) { if (Objects.equal(expected, actual)) { return; } if (expected == null) { fail("Version not null"); } if (actual == null) { fail("Unexpected null value"); } if (expected.getMajor() == actual.getMajor() && expected.getMinor() == actual.getMinor() && expected.getMicro() == actual.getMicro()) { if (!Strings.isNullOrEmpty(expected.getQualifier())) { final String expectedQualifier = expected.getQualifier(); if ("qualifier".equals(expectedQualifier)) { if (!Strings.isNullOrEmpty(actual.getQualifier())) { return; } } if (Objects.equal(expected, actual.getQualifier())) { return; } } else { return; } } throw new AssertionFailedError("Not same versions", expected.toString(), actual.toString()); }
Example 12
Source File: PipPackageManager.java From Pydev with Eclipse Public License 1.0 | 5 votes |
private static String getPipModuleName(IInterpreterInfo interpreterInfo) { String version = interpreterInfo.getVersion(); Version version2 = new Version(version); if (version2.getMajor() <= 2 && version2.getMinor() <= 6) { return "pip.__main__"; } return "pip"; }
Example 13
Source File: FeatureInformation.java From packagedrone with Eclipse Public License 1.0 | 4 votes |
@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 ); }
Example 14
Source File: ReleaseNotes.java From statecharts with Eclipse Public License 1.0 | 4 votes |
protected String getCurrentVersion() { Version currentVersion = Activator.getDefault().getBundle().getVersion(); return "" + currentVersion.getMajor() + "." + currentVersion.getMinor() + "." + currentVersion.getMicro(); }
Example 15
Source File: N4JSApplication.java From n4js with Eclipse Public License 1.0 | 4 votes |
/** * @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); }
Example 16
Source File: MDDUtil.java From textuml with Eclipse Public License 1.0 | 4 votes |
private static Version extractMetamodelVersion(Version implementationVersion) { return new Version(implementationVersion.getMajor(), implementationVersion.getMinor(), 0); }
Example 17
Source File: GoPreferencePage.java From goclipse with Eclipse Public License 1.0 | 4 votes |
protected static String getVersionText() { Version version = GoCorePlugin.getDefault().getBundle().getVersion(); return version.getMajor() + "." + version.getMinor() + "." + version.getMicro(); }
Example 18
Source File: OSGiMainLookup.java From netbeans with Apache License 2.0 | 4 votes |
public @Override SpecificationVersion getSpecificationVersion() { Version v = b.getVersion(); return new SpecificationVersion(v.getMajor() % 100 + "." + v.getMinor() + "." + v.getMicro()); }