use of com.liferay.ide.core.ILiferayPortal in project liferay-ide by liferay.
the class FacetedMavenProject method adapt.
@Override
public <T> T adapt(Class<T> adapterType) {
T adapter = super.adapt(adapterType);
if (adapter != null) {
return adapter;
}
IMavenProjectFacade facade = MavenUtil.getProjectFacade(getProject(), new NullProgressMonitor());
if (facade != null) {
if (ILiferayPortal.class.equals(adapterType)) {
ILiferayPortal portal = new LiferayPortalMaven(this);
return adapterType.cast(portal);
}
}
return null;
}
use of com.liferay.ide.core.ILiferayPortal 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