Search in sources :

Example 1 with IDOMDocument

use of org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument in project liferay-ide by liferay.

the class HookDescriptorHelper method setPortalProperties.

public IStatus setPortalProperties(final IDataModel model, final String propertiesFile) {
    final IFile descriptorFile = getDescriptorFile();
    DOMModelOperation operation = new DOMModelEditOperation(descriptorFile) {

        protected void createDefaultFile() {
            createDefaultDescriptor(_HOOK_DESCRIPTOR_TEMPLATE, getDescriptorVersion());
        }

        protected IStatus doExecute(IDOMDocument document) {
            return doSetPortalProperties(document, model, propertiesFile);
        }
    };
    IStatus status = operation.execute();
    if (!status.isOK()) {
        return status;
    }
    return status;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) IFile(org.eclipse.core.resources.IFile) IDOMDocument(org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument)

Example 2 with IDOMDocument

use of org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument in project liferay-ide by liferay.

the class HookDescriptorHelper method getCustomJSPFolder.

public String getCustomJSPFolder(final IDataModel model) {
    String[] retval = new String[1];
    IFile descriptorFile = getDescriptorFile();
    if (FileUtil.notExists(descriptorFile)) {
        return null;
    }
    DOMModelOperation operation = new DOMModelReadOperation(descriptorFile) {

        protected IStatus doExecute(IDOMDocument document) {
            retval[0] = readCustomJSPFolder(document, model);
            return Status.OK_STATUS;
        }
    };
    IStatus status = operation.execute();
    if (!status.isOK()) {
        return null;
    }
    return retval[0];
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) IFile(org.eclipse.core.resources.IFile) IDOMDocument(org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument)

Example 3 with IDOMDocument

use of org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument in project liferay-ide by liferay.

the class HookDescriptorHelper method createDefaultDescriptor.

public void createDefaultDescriptor() {
    IFile descriptorFile = getDescriptorFile();
    DOMModelEditOperation operation = new DOMModelEditOperation(descriptorFile) {

        @Override
        protected void createDefaultFile() {
            createDefaultDescriptor(_HOOK_DESCRIPTOR_TEMPLATE, getDescriptorVersion());
        }

        @Override
        protected IStatus doExecute(IDOMDocument document) {
            return Status.OK_STATUS;
        }
    };
    operation.execute();
}
Also used : IFile(org.eclipse.core.resources.IFile) IDOMDocument(org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument)

Example 4 with IDOMDocument

use of org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument in project liferay-ide by liferay.

the class HookDescriptorHelper method addLanguageProperties.

public IStatus addLanguageProperties(final List<String> languageProperties) {
    IFile descriptorFile = getDescriptorFile();
    DOMModelOperation operation = new DOMModelEditOperation(descriptorFile) {

        protected void createDefaultFile() {
            createDefaultDescriptor(_HOOK_DESCRIPTOR_TEMPLATE, getDescriptorVersion());
        }

        protected IStatus doExecute(IDOMDocument document) {
            return doAddLanguageProperties(document, languageProperties);
        }
    };
    IStatus status = operation.execute();
    if (!status.isOK()) {
        return status;
    }
    return status;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) IFile(org.eclipse.core.resources.IFile) IDOMDocument(org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument)

Example 5 with IDOMDocument

use of org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument in project liferay-ide by liferay.

the class HookDescriptorHelper method addActionItems.

public IStatus addActionItems(final List<String[]> actionItems) {
    IFile descriptorFile = getDescriptorFile();
    DOMModelOperation operation = new DOMModelEditOperation(descriptorFile) {

        protected void createDefaultFile() {
            createDefaultDescriptor(_HOOK_DESCRIPTOR_TEMPLATE, getDescriptorVersion());
        }

        protected IStatus doExecute(IDOMDocument document) {
            return doAddActionItems(document, actionItems);
        }
    };
    IStatus status = operation.execute();
    if (!status.isOK()) {
        return status;
    }
    return status;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) IFile(org.eclipse.core.resources.IFile) IDOMDocument(org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument)

Aggregations

IDOMDocument (org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument)176 IDOMModel (org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel)109 IFile (org.eclipse.core.resources.IFile)48 IStructuredModel (org.eclipse.wst.sse.core.internal.provisional.IStructuredModel)39 Element (org.w3c.dom.Element)39 IStructuredDocument (org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument)33 NodeList (org.w3c.dom.NodeList)27 IStatus (org.eclipse.core.runtime.IStatus)23 Node (org.w3c.dom.Node)21 CoreException (org.eclipse.core.runtime.CoreException)15 ArrayList (java.util.ArrayList)14 IJsTranslation (org.eclipse.wst.jsdt.web.core.javascript.IJsTranslation)14 JsTranslationAdapter (org.eclipse.wst.jsdt.web.core.javascript.JsTranslationAdapter)14 Document (org.w3c.dom.Document)14 IJSPTranslation (org.eclipse.jst.jsp.core.internal.java.IJSPTranslation)12 IDOMNode (org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode)12 IOException (java.io.IOException)11 CMDocument (org.eclipse.wst.xml.core.internal.contentmodel.CMDocument)11 JSPTranslationAdapter (org.eclipse.jst.jsp.core.internal.java.JSPTranslationAdapter)10 IModelManager (org.eclipse.wst.sse.core.internal.provisional.IModelManager)9