use of com.liferay.ide.core.ILiferayProject in project liferay-ide by liferay.
the class ProjectUtil method is7xServerDeployableProject.
public static boolean is7xServerDeployableProject(IProject project) {
ILiferayProject liferayProject = LiferayCore.create(project);
if (liferayProject instanceof IBundleProject) {
if (liferayProject instanceof PluginsSDKBundleProject) {
PluginsSDKBundleProject sdkProject = (PluginsSDKBundleProject) liferayProject;
SDK sdk = sdkProject.getSDK();
if (sdk != null) {
IPath location = sdkProject.getProject().getLocation();
String projectType = getLiferayPluginType(location.toPortableString());
Version version = new Version(sdk.getVersion());
Version sdk70 = ILiferayConstants.V700;
if ((CoreUtil.compareVersions(version, sdk70) >= 0) && !ISDKConstants.EXT_PLUGIN_PROJECT_FOLDER.equals(projectType)) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return true;
}
} else {
return false;
}
}
use of com.liferay.ide.core.ILiferayProject in project liferay-ide by liferay.
the class ThemeCSSBuilder method applyDiffsDeltaToDocroot.
protected void applyDiffsDeltaToDocroot(IResourceDelta delta, IContainer docroot, IProgressMonitor monitor) {
int deltaKind = delta.getKind();
switch(deltaKind) {
case IResourceDelta.REMOVED_PHANTOM:
break;
}
IPath path = CoreUtil.getResourceLocation(docroot);
ILiferayProject liferayProject = LiferayCore.create(getProject());
String themeParent = liferayProject.getProperty("theme.parent", "_styled");
ILiferayPortal portal = liferayProject.adapt(ILiferayPortal.class);
if (portal != null) {
IPath themesPath = portal.getAppServerPortalDir().append("html/themes");
List<IPath> restorePaths = new ArrayList<>();
for (int i = 0; i < IPluginProjectDataModelProperties.THEME_PARENTS.length; i++) {
if (IPluginProjectDataModelProperties.THEME_PARENTS[i].equals(themeParent)) {
restorePaths.add(themesPath.append(IPluginProjectDataModelProperties.THEME_PARENTS[i]));
} else {
if (ListUtil.isNotEmpty(restorePaths)) {
restorePaths.add(themesPath.append(IPluginProjectDataModelProperties.THEME_PARENTS[i]));
}
}
}
new Job("publish theme delta") {
@Override
protected IStatus run(IProgressMonitor monitor) {
_buildHelper.publishDelta(delta, path, restorePaths.toArray(new IPath[0]), monitor);
try {
docroot.refreshLocal(IResource.DEPTH_INFINITE, monitor);
} catch (Exception e) {
ThemeCore.logError(e);
}
return Status.OK_STATUS;
}
}.schedule();
}
}
use of com.liferay.ide.core.ILiferayProject in project liferay-ide by liferay.
the class ThemeCSSBuilder method ensureLookAndFeelFileExists.
public static void ensureLookAndFeelFileExists(IProject project) throws CoreException {
// IDE-110 IDE-648
IWebProject lrProject = LiferayCore.create(IWebProject.class, project);
if (lrProject == null) {
return;
}
IFile lookAndFeelFile = null;
IResource res = lrProject.findDocrootResource(new Path("WEB-INF/" + ILiferayConstants.LIFERAY_LOOK_AND_FEEL_XML_FILE));
if (res instanceof IFile && res.exists()) {
lookAndFeelFile = (IFile) res;
}
if (lookAndFeelFile == null) {
// need to generate a new lnf file in deafult docroot
String id = project.getName().replaceAll(ISDKConstants.THEME_PLUGIN_PROJECT_SUFFIX, StringPool.EMPTY);
IResource propertiesFileRes = lrProject.findDocrootResource(new Path("WEB-INF/" + ILiferayConstants.LIFERAY_PLUGIN_PACKAGE_PROPERTIES_FILE));
String name = id;
if (propertiesFileRes instanceof IFile && propertiesFileRes.exists()) {
Properties props = new Properties();
try {
IFile propsFile = (IFile) propertiesFileRes;
InputStream contents = propsFile.getContents();
props.load(contents);
contents.close();
String nameValue = props.getProperty("name");
if (!CoreUtil.isNullOrEmpty(nameValue)) {
name = nameValue;
}
ThemeDescriptorHelper themeDescriptorHelper = new ThemeDescriptorHelper(project);
ILiferayProject lProject = lrProject;
ILiferayPortal portal = lProject.adapt(ILiferayPortal.class);
String version = "6.2.0";
if (portal != null) {
version = portal.getVersion();
}
String themeType = lProject.getProperty("theme.type", "vm");
themeDescriptorHelper.createDefaultFile(lrProject.getDefaultDocrootFolder().getFolder("WEB-INF"), version, id, name, themeType);
} catch (IOException ioe) {
ThemeCore.logError("Unable to load plugin package properties.", ioe);
}
}
}
}
use of com.liferay.ide.core.ILiferayProject in project liferay-ide by liferay.
the class AddServiceBuilderOperation method createDefaultServiceBuilderFile.
public void createDefaultServiceBuilderFile(IFile serviceBuilderFile, IProgressMonitor monitor) throws CoreException {
String descriptorVersion = null;
try {
ILiferayProject liferayProject = LiferayCore.create(serviceBuilderFile.getProject());
ILiferayPortal portal = liferayProject.adapt(ILiferayPortal.class);
Version portalVersion = new Version(portal.getVersion());
descriptorVersion = portalVersion.getMajor() + "." + portalVersion.getMinor() + ".0";
} catch (Exception e) {
ProjectCore.logError("Could not determine liferay runtime version", e);
descriptorVersion = "6.0.0";
}
WizardUtil.createDefaultServiceBuilderFile(serviceBuilderFile, descriptorVersion, getDataModel().getBooleanProperty(USE_SAMPLE_TEMPLATE), getDataModel().getStringProperty(PACKAGE_PATH), getDataModel().getStringProperty(NAMESPACE), getDataModel().getStringProperty(AUTHOR), monitor);
getDataModel().setProperty(CREATED_SERVICE_FILE, serviceBuilderFile);
}
use of com.liferay.ide.core.ILiferayProject in project liferay-ide by liferay.
the class BuildServiceJob method getProjectBuilder.
protected IProjectBuilder getProjectBuilder() throws CoreException {
ILiferayProject liferayProject = LiferayCore.create(getProject());
if (liferayProject == null) {
throw new CoreException(ServiceCore.createErrorStatus(NLS.bind(Msgs.couldNotCreateLiferayProject, getProject())));
}
IProjectBuilder builder = liferayProject.adapt(IProjectBuilder.class);
if (builder == null) {
throw new CoreException(ServiceCore.createErrorStatus(NLS.bind(Msgs.couldNotCreateProjectBuilder, getProject())));
}
return builder;
}
Aggregations