use of org.eclipse.wst.xml.core.internal.provisional.format.FormatProcessorXML in project liferay-ide by liferay.
the class ThemeDescriptorHelper method createDefaultFile.
public void createDefaultFile(IContainer container, String version, String id, String name, String themeType) {
if ((container == null) || (id == null) || (name == null)) {
return;
}
try {
Path path = new Path(ILiferayConstants.LIFERAY_LOOK_AND_FEEL_XML_FILE);
IFile lookAndFeelFile = container.getFile(path);
String descriptorVersion = getDescriptorVersionFromPortalVersion(version);
CoreUtil.prepareFolder((IFolder) lookAndFeelFile.getParent());
String contents = MessageFormat.format(DEFUALT_FILE_TEMPLATE, descriptorVersion, descriptorVersion.replace('.', '_'));
contents = contents.replaceAll("__VERSION__", version + "+");
contents = contents.replaceAll("__ID__", id);
contents = contents.replaceAll("__NAME__", name);
lookAndFeelFile.create(new ByteArrayInputStream(contents.getBytes()), true, null);
if (!themeType.equals("vm")) {
setTemplateExtension(lookAndFeelFile, themeType);
}
FormatProcessorXML processor = new FormatProcessorXML();
try {
processor.formatFile(lookAndFeelFile);
} catch (IOException ioe) {
}
} catch (CoreException ce) {
ThemeCore.logError("Error creating default descriptor file", ce);
}
}
use of org.eclipse.wst.xml.core.internal.provisional.format.FormatProcessorXML in project liferay-ide by liferay.
the class ServiceBuilderDescriptorHelper method doAddDefaultColumns.
protected IStatus doAddDefaultColumns(IDOMDocument document, String entityName) {
Element entityElement = null;
NodeList nodes = document.getDocumentElement().getChildNodes();
if ((nodes != null) && (nodes.getLength() > 0)) {
for (int i = 0; i < nodes.getLength(); i++) {
Node node = nodes.item(i);
if (node.getNodeName().equals("entity") && (node instanceof Element)) {
if (entityName.equals(((Element) node).getAttribute("name"))) {
entityElement = (Element) node;
}
}
}
}
if (entityElement == null) {
return Status.CANCEL_STATUS;
}
// <!-- PK fields -->
_appendComment(entityElement, " PK fields ");
Element columnElem = NodeUtil.appendChildElement(entityElement, "column");
columnElem.setAttribute("name", _generateEntityId(entityName));
columnElem.setAttribute("primary", "true");
columnElem.setAttribute("type", "long");
// <!-- Group instance -->
_appendComment(entityElement, " Group instance ");
columnElem = NodeUtil.appendChildElement(entityElement, "column");
columnElem.setAttribute("name", "groupId");
columnElem.setAttribute("type", "long");
// <!-- Aduit fields -->
_appendComment(entityElement, " Audit fields ");
columnElem = NodeUtil.appendChildElement(entityElement, "column");
columnElem.setAttribute("name", "companyId");
columnElem.setAttribute("type", "long");
columnElem = NodeUtil.appendChildElement(entityElement, "column");
columnElem.setAttribute("name", "userId");
columnElem.setAttribute("type", "long");
columnElem = NodeUtil.appendChildElement(entityElement, "column");
columnElem.setAttribute("name", "userName");
columnElem.setAttribute("type", "String");
columnElem = NodeUtil.appendChildElement(entityElement, "column");
columnElem.setAttribute("name", "createDate");
columnElem.setAttribute("type", "Date");
columnElem = NodeUtil.appendChildElement(entityElement, "column");
columnElem.setAttribute("name", "modifiedDate");
columnElem.setAttribute("type", "Date");
entityElement.appendChild(document.createTextNode(_NEW_LINE));
new FormatProcessorXML().formatNode(entityElement);
return Status.OK_STATUS;
}
use of org.eclipse.wst.xml.core.internal.provisional.format.FormatProcessorXML in project webtools.sourceediting by eclipse.
the class XSDCommonUIUtils method formatChild.
public static void formatChild(Node child) {
if (child instanceof IDOMNode) {
IDOMModel model = ((IDOMNode) child).getModel();
try {
// tell the model that we are about to make a big model change
model.aboutToChangeModel();
IStructuredFormatProcessor formatProcessor = new FormatProcessorXML();
formatProcessor.formatNode(child);
} finally {
// tell the model that we are done with the big model change
model.changedModel();
}
}
}
use of org.eclipse.wst.xml.core.internal.provisional.format.FormatProcessorXML in project webtools.sourceediting by eclipse.
the class XSDDOMHelper method formatChild.
public static void formatChild(Node child) {
if (child instanceof IDOMNode) {
IDOMModel model = ((IDOMNode) child).getModel();
try {
// tell the model that we are about to make a big model change
model.aboutToChangeModel();
IStructuredFormatProcessor formatProcessor = new FormatProcessorXML();
formatProcessor.formatNode(child);
} finally {
// tell the model that we are done with the big model change
model.changedModel();
}
}
}
use of org.eclipse.wst.xml.core.internal.provisional.format.FormatProcessorXML in project webtools.sourceediting by eclipse.
the class XMLNodeActionManager method reformat.
@Override
public void reformat(Node newElement, boolean deep) {
try {
// tell the model that we are about to make a big model change
fModel.aboutToChangeModel();
// format selected node
IStructuredFormatProcessor formatProcessor = new FormatProcessorXML();
formatProcessor.formatNode(newElement);
} finally {
// tell the model that we are done with the big model change
fModel.changedModel();
}
}
Aggregations