当前位置: 首页>>代码示例>>Java>>正文


Java Version.getMajor方法代码示例

本文整理汇总了Java中org.osgi.framework.Version.getMajor方法的典型用法代码示例。如果您正苦于以下问题:Java Version.getMajor方法的具体用法?Java Version.getMajor怎么用?Java Version.getMajor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.osgi.framework.Version的用法示例。


在下文中一共展示了Version.getMajor方法的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];
    }

}
 
开发者ID:WASdev,项目名称:tool.lars,代码行数:25,代码来源:Version4Digit.java

示例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);
    }
  }
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:19,代码来源:XStartOnFirstThreadArgumentProcessor.java

示例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";
}
 
开发者ID:fmoraes74,项目名称:eclipseforces,代码行数:25,代码来源:JavaLanguageSupport.java

示例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;
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:26,代码来源:ApplicationVersion.java

示例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;
}
 
开发者ID:USESystemEngineeringBV,项目名称:cmake-eclipse-helper,代码行数:22,代码来源:CMakeLauncher.java

示例6: doNew

import org.osgi.framework.Version; //导入方法依赖的package包/类
public static UpdateInfo doNew(CFMLEngine engine, Resource contextDir, boolean readOnly) {
	lucee.Info info = engine.getInfo();
	try {
		String strOldVersion;
		final Resource resOldVersion = contextDir.getRealResource("version");
		String strNewVersion = info.getVersion() + "-" + info.getRealeaseTime();
		
		// fresh install
		if (!resOldVersion.exists()) {
			if(!readOnly) {
				resOldVersion.createNewFile();
				IOUtil.write(resOldVersion, strNewVersion, SystemUtil.getCharset(), false);
			}
			return UpdateInfo.NEW_FRESH;
		}
		// changed version
		else if (!(strOldVersion=IOUtil.toString(resOldVersion, SystemUtil.getCharset())).equals(strNewVersion)) {
			if(!readOnly) IOUtil.write(resOldVersion, strNewVersion, SystemUtil.getCharset(), false);
			Version oldVersion = OSGiUtil.toVersion(strOldVersion);
			
			return new UpdateInfo(oldVersion,oldVersion.getMajor()<5?NEW_FROM4:NEW_MINOR);
		}
	}
	catch(Throwable t) {ExceptionUtil.rethrowIfNecessary(t);}
	return UpdateInfo.NEW_NONE;
}
 
开发者ID:lucee,项目名称:Lucee,代码行数:27,代码来源:XMLConfigFactory.java

示例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, XYPlotActor.class),
      null);
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:13,代码来源:Activator.java

示例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, SizeAttribute.class, WindowPropertiesAttribute.class), null);
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:13,代码来源:Activator.java

示例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, PythonActor.class),
      null);
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:13,代码来源:Activator.java

示例10: 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);
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:13,代码来源:Activator.java

示例11: handle_legacy_LED

import org.osgi.framework.Version; //导入方法依赖的package包/类
/** Helper for configurator to handle legacy LED sizing and common options */
protected static void handle_legacy_LED(final Widget widget, final Version xml_version, final Element xml)
            throws Exception
{
    final BaseLEDWidget led = (BaseLEDWidget) widget;
    if (xml_version.getMajor() < 2)
    {   // Border was included in the size,
        // so with the same nominal size an "alarm sensitive" LED
        // was smaller than a non-a.s. LED */
        if (widget.getProperty(propBorderAlarmSensitive).getValue())
        {
            // Use old border width, defaulting to 2 for style 'None'
            final int style = Integer.parseInt(XMLUtil.getChildString(xml, "border_style").orElse("0"));
            final int border = style <= 0
                             ? 2
                             : Integer.parseInt(XMLUtil.getChildString(xml, "border_width").orElse("1"));

            // Border goes around the widget,
            // so X, Y get adjusted by 1*border
            // and Width, Height by 2*border.
            WidgetProperty<Integer> prop = led.getProperty(propX);
            prop.setValue(prop.getValue() + border);
            prop = led.getProperty(propY);
            prop.setValue(prop.getValue() + border);
            prop = led.getProperty(propWidth);
            prop.setValue(prop.getValue() - 2*border);
            prop = led.getProperty(propHeight);
            prop.setValue(prop.getValue() - 2*border);
        }

        // Legacy used "square_led" instead of "square"
        led.propSquare().setValue(XMLUtil.getChildBoolean(xml, "square_led").orElse(false));
    }
}
 
开发者ID:kasemir,项目名称:org.csstudio.display.builder,代码行数:35,代码来源:BaseLEDWidget.java

示例12: 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);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:7,代码来源:N4JSApplication.java

示例13: 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());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:OSGiMainLookup.java

示例14: 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);
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:5,代码来源:GW4EPlatform.java

示例15: 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();
}
 
开发者ID:cschneider,项目名称:reactive-components,代码行数:6,代码来源:BundleUris.java


注:本文中的org.osgi.framework.Version.getMajor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。