use of com.liferay.ide.project.core.descriptor.RemoveSampleElementsOperation in project liferay-ide by liferay.
the class LiferayDisplayDescriptorHelper method addDescriptorOperations.
@Override
protected void addDescriptorOperations() {
AddNewPortletOperation anpOperation = new AddNewPortletOperation() {
@Override
public IStatus addNewPortlet(IDataModel model) {
IStatus status = Status.OK_STATUS;
IFile descriptorFile = getDescriptorFile();
if (descriptorFile != null) {
DOMModelEditOperation domModelOperation = new DOMModelEditOperation(descriptorFile) {
protected void createDefaultFile() {
createDefaultDescriptor(_DESCRIPTOR_TEMPLATE, getDescriptorVersion());
}
protected IStatus doExecute(IDOMDocument document) {
return doAddNewPortlet(document, model);
}
};
status = domModelOperation.execute();
}
return status;
}
};
addDescriptorOperation(anpOperation);
RemoveAllPortletsOperation rapOperation = new RemoveAllPortletsOperation() {
@Override
public IStatus removeAllPortlets() {
return removeAllPortlets();
}
};
addDescriptorOperation(rapOperation);
RemoveSampleElementsOperation rseOperation = new RemoveSampleElementsOperation() {
@Override
public IStatus removeSampleElements() {
return removeAllPortlets();
}
};
addDescriptorOperation(rseOperation);
}
use of com.liferay.ide.project.core.descriptor.RemoveSampleElementsOperation in project liferay-ide by liferay.
the class LiferayPortletDescriptorHelper method addDescriptorOperations.
@Override
protected void addDescriptorOperations() {
AddNewPortletOperation apOperation = new AddNewPortletOperation() {
@Override
public IStatus addNewPortlet(IDataModel model) {
IStatus status = Status.OK_STATUS;
if (canAddNewPortlet(model)) {
IFile descriptorFile = getDescriptorFile();
if (descriptorFile != null) {
DOMModelEditOperation domModelOperation = new DOMModelEditOperation(descriptorFile) {
protected void createDefaultFile() {
createDefaultDescriptor(_DESCRIPTOR_TEMPLATE, getDescriptorVersion());
}
protected IStatus doExecute(IDOMDocument document) {
return doAddNewPortlet(document, model);
}
};
status = domModelOperation.execute();
}
}
return status;
}
};
addDescriptorOperation(apOperation);
RemoveAllPortletsOperation rapOperation = new RemoveAllPortletsOperation() {
@Override
public IStatus removeAllPortlets() {
return doRemoveAllPortlets();
}
};
addDescriptorOperation(rapOperation);
RemoveSampleElementsOperation rseOperation = new RemoveSampleElementsOperation() {
@Override
public IStatus removeSampleElements() {
return doRemoveAllPortlets();
}
};
addDescriptorOperation(rseOperation);
}
use of com.liferay.ide.project.core.descriptor.RemoveSampleElementsOperation in project liferay-ide by liferay.
the class PortletDescriptorHelper method addDescriptorOperations.
protected void addDescriptorOperations() {
RemoveSampleElementsOperation rseOperation = new RemoveSampleElementsOperation() {
@Override
public IStatus removeSampleElements() {
return doRemoveAllPortlets();
}
};
addDescriptorOperation(rseOperation);
AddNewPortletOperation apOperation = new AddNewPortletOperation() {
@Override
public IStatus addNewPortlet(IDataModel model) {
IStatus status = Status.OK_STATUS;
if (canAddNewPortlet(model)) {
IFile descriptorFile = getDescriptorFile();
if (descriptorFile != null) {
DOMModelOperation domModelOperation = new DOMModelEditOperation(descriptorFile) {
protected void createDefaultFile() {
createDefaultDescriptor(_DESCRIPTOR_TEMPLATE, "");
}
protected IStatus doExecute(IDOMDocument document) {
return doAddNewPortlet(document, model);
}
};
status = domModelOperation.execute();
}
}
return status;
}
};
addDescriptorOperation(apOperation);
RemoveAllPortletsOperation rapOperation = new RemoveAllPortletsOperation() {
@Override
public IStatus removeAllPortlets() {
return doRemoveAllPortlets();
}
};
addDescriptorOperation(rapOperation);
}
Aggregations