use of com.liferay.ide.project.core.descriptor.UpdateDescriptorVersionOperation in project liferay-ide by liferay.
the class JSFLiferayPortletDescriptorHelper method addDescriptorOperations.
@Override
protected void addDescriptorOperations() {
super.addDescriptorOperations();
UpdateDescriptorVersionOperation operation = new UpdateDescriptorVersionOperation() {
@Override
public IStatus update(Version preVersion, Version postVersion) {
if ((CoreUtil.compareVersions(preVersion, ILiferayConstants.V620) >= 0) && (CoreUtil.compareVersions(postVersion, ILiferayConstants.V620) < 0)) {
IFile descriptorFile = getDescriptorFile();
IDOMModel domModel = null;
try {
domModel = (IDOMModel) StructuredModelManager.getModelManager().getModelForEdit(descriptorFile);
IDOMDocument document = domModel.getDocument();
IStatus status = _downgradeJSFLiferayPortletXMLTo61(document);
if (!status.isOK()) {
return status;
}
domModel.save();
} catch (Exception e) {
PortletCore.logError("Error editing liferay-portlet.xml", e);
} finally {
if (domModel != null) {
domModel.releaseFromEdit();
}
}
}
return Status.OK_STATUS;
}
};
addDescriptorOperation(operation);
}
Aggregations