Example usage for org.springframework.ide.eclipse.beans.core.namespaces NamespaceUtils DEFAULT_NAMESPACE_URI

List of usage examples for org.springframework.ide.eclipse.beans.core.namespaces NamespaceUtils DEFAULT_NAMESPACE_URI

Introduction

In this page you can find the example usage for org.springframework.ide.eclipse.beans.core.namespaces NamespaceUtils DEFAULT_NAMESPACE_URI.

Prototype

String DEFAULT_NAMESPACE_URI

To view the source code for org.springframework.ide.eclipse.beans.core.namespaces NamespaceUtils DEFAULT_NAMESPACE_URI.

Click Source Link

Usage

From source file:org.eclipse.virgo.ide.runtime.internal.core.ServerPublishOperation.java

/**
 * Checks if the given <code>file</code> is a root node that is a known Spring namespace.
 *//*  w  w w  .java 2 s  .  c o m*/
private boolean checkIfSpringConfigurationFile(IFile file) {
    IStructuredModel model = null;
    try {
        model = StructuredModelManager.getModelManager().getExistingModelForRead(file);
        if (model == null) {
            model = StructuredModelManager.getModelManager().getModelForRead(file);
        }
        if (model != null) {
            IDOMDocument document = ((DOMModelImpl) model).getDocument();
            if (document != null && document.getDocumentElement() != null) {
                String namespaceUri = document.getDocumentElement().getNamespaceURI();
                if (NamespaceUtils.DEFAULT_NAMESPACE_URI.equals(namespaceUri)
                        || new DelegatingNamespaceHandlerResolver(
                                JdtUtils.getClassLoader(file.getProject(), null), null)
                                        .resolve(namespaceUri) != null) {
                    return false;
                }
            }
        }
    } catch (Exception e) {
    } finally {
        if (model != null) {
            model.releaseFromRead();
        }
        model = null;
    }
    return true;
}