use of com.liferay.ide.maven.core.IMavenProject in project liferay-ide by liferay.
the class MavenProjectAdapter method adapt.
public <T> T adapt(ILiferayProject liferayProject, Class<T> adapterType) {
if (liferayProject instanceof IMavenProject && IProjectBuilder.class.equals(adapterType)) {
// only use this builder for versions of Liferay less than 6.2
ILiferayPortal portal = liferayProject.adapt(ILiferayPortal.class);
if (portal != null) {
String version = portal.getVersion();
if (!CoreUtil.isNullOrEmpty(version)) {
// we only need to match the first 2 characters
Matcher matcher = _majorMinor.matcher(version);
String matchedVersion = null;
if (matcher.find() && (matcher.groupCount() == 2)) {
matchedVersion = matcher.group(1) + "." + matcher.group(2) + ".0";
}
Version portalVersion = new Version(matchedVersion != null ? matchedVersion : version);
if (CoreUtil.compareVersions(portalVersion, ILiferayConstants.V620) < 0) {
MavenUIProjectBuilder builder = new MavenUIProjectBuilder((FacetedMavenProject) liferayProject);
return adapterType.cast(builder);
}
}
}
}
return null;
}
Aggregations