Search in sources :

Example 1 with INodeAdapterFactory

use of org.eclipse.wst.sse.core.internal.provisional.INodeAdapterFactory in project webtools.sourceediting by eclipse.

the class HTMLValidator method validate.

private HTMLValidationResult validate(IReporter reporter, IFile file, IDOMModel model) {
    if (file == null || model == null)
        // error
        return null;
    IDOMDocument document = model.getDocument();
    if (document == null)
        // error
        return null;
    if (!hasHTMLFeature(document))
        // ignore
        return null;
    INodeAdapterFactory factory = HTMLValidationAdapterFactory.getInstance();
    ValidationAdapter adapter = (ValidationAdapter) factory.adapt(document);
    if (adapter == null)
        // error
        return null;
    HTMLValidationReporter rep = getReporter(reporter, file, model);
    rep.clear();
    adapter.setReporter(rep);
    adapter.validate(document);
    return rep.getResult();
}
Also used : ValidationAdapter(org.eclipse.wst.sse.core.internal.validate.ValidationAdapter) IDOMDocument(org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument) INodeAdapterFactory(org.eclipse.wst.sse.core.internal.provisional.INodeAdapterFactory)

Example 2 with INodeAdapterFactory

use of org.eclipse.wst.sse.core.internal.provisional.INodeAdapterFactory in project webtools.sourceediting by eclipse.

the class AdapterFactoryProviderForHTML method addContentBasedFactories.

protected void addContentBasedFactories(IStructuredModel structuredModel) {
    FactoryRegistry factoryRegistry = structuredModel.getFactoryRegistry();
    // $NON-NLS-1$
    Assert.isNotNull(factoryRegistry, "Program Error: client caller must ensure model has factory registry");
    INodeAdapterFactory factory = null;
    factory = factoryRegistry.getFactoryFor(IJFaceNodeAdapter.class);
    if (factory == null) {
        factory = new JFaceNodeAdapterFactoryForHTML();
        factoryRegistry.addFactory(factory);
    }
}
Also used : JFaceNodeAdapterFactoryForHTML(org.eclipse.wst.html.ui.internal.contentoutline.JFaceNodeAdapterFactoryForHTML) FactoryRegistry(org.eclipse.wst.sse.core.internal.model.FactoryRegistry) IJFaceNodeAdapter(org.eclipse.wst.sse.ui.internal.contentoutline.IJFaceNodeAdapter) INodeAdapterFactory(org.eclipse.wst.sse.core.internal.provisional.INodeAdapterFactory)

Example 3 with INodeAdapterFactory

use of org.eclipse.wst.sse.core.internal.provisional.INodeAdapterFactory in project webtools.sourceediting by eclipse.

the class PageDirectiveAdapterImpl method release.

public void release() {
    if (embeddedTypeHandler != null) {
        if (embeddedFactoryRegistry != null) {
            Iterator iterator = embeddedFactoryRegistry.iterator();
            INodeAdapterFactory factory = null;
            while (iterator.hasNext()) {
                factory = (INodeAdapterFactory) iterator.next();
                factory.release();
            }
        }
        // pa_TODO: possibly need to release here...
        // or "uninitializeFactoryRegistry"
        // initializeFactoryRegistry was called from JSPModelLoader
        embeddedTypeHandler = null;
    }
}
Also used : Iterator(java.util.Iterator) INodeAdapterFactory(org.eclipse.wst.sse.core.internal.provisional.INodeAdapterFactory)

Example 4 with INodeAdapterFactory

use of org.eclipse.wst.sse.core.internal.provisional.INodeAdapterFactory in project webtools.sourceediting by eclipse.

the class ModelManagerImpl method addFactories.

private void addFactories(IStructuredModel model, List factoryList) {
    // $NON-NLS-1$
    Assert.isNotNull(model, "model can not be null");
    FactoryRegistry registry = model.getFactoryRegistry();
    // $NON-NLS-1$
    Assert.isNotNull(registry, "model's Factory Registry can not be null");
    // already exists. May need to reconsider this.
    if (factoryList != null) {
        Iterator iterator = factoryList.iterator();
        while (iterator.hasNext()) {
            INodeAdapterFactory factory = (INodeAdapterFactory) iterator.next();
            registry.addFactory(factory);
        }
    }
}
Also used : Iterator(java.util.Iterator) INodeAdapterFactory(org.eclipse.wst.sse.core.internal.provisional.INodeAdapterFactory)

Example 5 with INodeAdapterFactory

use of org.eclipse.wst.sse.core.internal.provisional.INodeAdapterFactory in project webtools.sourceediting by eclipse.

the class PluginContributedFactoryReader method loadRegistry.

protected List loadRegistry(Object contentType) {
    // new Vector();
    List factoryList = null;
    IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
    IExtensionPoint point = extensionRegistry.getExtensionPoint(SSECorePlugin.ID, EXTENSION_POINT_ID);
    if (point != null) {
        IConfigurationElement[] elements = point.getConfigurationElements();
        if (elements.length > 0) {
            // this is called a lot, so don't create vector unless really
            // needed
            // TODO: could eventually cache in a hashtable, or something,
            // to avoid repeat processing
            factoryList = new Vector();
            for (int i = 0; i < elements.length; i++) {
                INodeAdapterFactory factory = loadFactoryFromConfigurationElement(elements[i], contentType);
                if (factory != null)
                    factoryList.add(factory);
            }
        }
    }
    return factoryList;
}
Also used : IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) List(java.util.List) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) Vector(java.util.Vector) IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) IExtensionRegistry(org.eclipse.core.runtime.IExtensionRegistry) INodeAdapterFactory(org.eclipse.wst.sse.core.internal.provisional.INodeAdapterFactory)

Aggregations

INodeAdapterFactory (org.eclipse.wst.sse.core.internal.provisional.INodeAdapterFactory)35 List (java.util.List)9 Iterator (java.util.Iterator)8 ArrayList (java.util.ArrayList)7 FactoryRegistry (org.eclipse.wst.sse.core.internal.model.FactoryRegistry)7 IJFaceNodeAdapter (org.eclipse.wst.sse.ui.internal.contentoutline.IJFaceNodeAdapter)7 ValidationAdapter (org.eclipse.wst.sse.core.internal.validate.ValidationAdapter)4 PropagatingAdapterFactoryImpl (org.eclipse.wst.xml.core.internal.propagate.PropagatingAdapterFactoryImpl)4 IDOMDocument (org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument)4 IExtensionPoint (org.eclipse.core.runtime.IExtensionPoint)3 Vector (java.util.Vector)2 ITextFileBuffer (org.eclipse.core.filebuffers.ITextFileBuffer)2 IFile (org.eclipse.core.resources.IFile)2 CoreException (org.eclipse.core.runtime.CoreException)2 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)2 IExtensionRegistry (org.eclipse.core.runtime.IExtensionRegistry)2 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)2 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)2 IStyleSelectorAdapter (org.eclipse.wst.css.core.internal.provisional.adapters.IStyleSelectorAdapter)2 IStyleSheetAdapter (org.eclipse.wst.css.core.internal.provisional.adapters.IStyleSheetAdapter)2