use of org.eclipse.osgi.service.resolver.VersionRange in project tesb-studio-se by Talend.
the class DependencyVersionPart method getVersion.
/**
* Gets the version.
*
* @return the version
*/
public String getVersion() {
if (fIsRanged) {
// if versions are equal they must be inclusive for a range to be
// valid
// blindly set for the user
String minV = getMinVersion();
String maxV = getMaxVersion();
boolean minI = getMinInclusive();
boolean maxI = getMaxInclusive();
if (minV.equals(maxV))
minI = maxI = true;
VersionRange versionRange = new VersionRange(new Version(minV), minI, new Version(maxV), maxI);
if (!versionRange.equals(VersionRange.emptyRange)) {
return versionRange.toString();
}
} else {
String singleversion = extractSingleVersionFromText();
if (!singleversion.isEmpty()) {
Version versionBean = new Version(singleversion);
if (!versionBean.equals(Version.emptyVersion)) {
return versionBean.toString();
}
}
}
return null;
}
use of org.eclipse.osgi.service.resolver.VersionRange in project tesb-studio-se by Talend.
the class DependencyVersionPart method setVersion.
/**
* Sets the version.
*
* @param version
* the new version
*/
public void setVersion(String version) {
try {
if (version != null && !version.equals("")) {
//$NON-NLS-1$
fVersionRange = new VersionRange(version);
Version max = fVersionRange.getMaximum();
if (max.getMajor() != Integer.MAX_VALUE && fVersionRange.getMinimum().compareTo(fVersionRange.getMaximum()) < 0)
fIsRanged = true;
}
} catch (IllegalArgumentException e) {
// illegal version string passed
//$NON-NLS-1$
fVersionRange = new VersionRange("[1.0.0,1.0.0]");
}
}
Aggregations