Search in sources :

Example 31 with INodeAdapterFactory

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

the class PageDirectiveAdapterImpl method adapt.

/**
 * @see PageDirectiveAdapter#adapt(INodeNotifier, Object)
 */
public INodeAdapter adapt(INodeNotifier notifier, Object type) {
    INodeAdapter result = null;
    // then we can not adapt it.
    if (embeddedTypeHandler != null) {
        if (embeddedFactoryRegistry != null) {
            Iterator iterator = embeddedFactoryRegistry.iterator();
            INodeAdapterFactory factory = null;
            while (iterator.hasNext()) {
                factory = (INodeAdapterFactory) iterator.next();
                if (factory.isFactoryForType(type)) {
                    result = factory.adapt(notifier);
                    break;
                }
            }
        }
    }
    return result;
}
Also used : INodeAdapter(org.eclipse.wst.sse.core.internal.provisional.INodeAdapter) Iterator(java.util.Iterator) INodeAdapterFactory(org.eclipse.wst.sse.core.internal.provisional.INodeAdapterFactory)

Example 32 with INodeAdapterFactory

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

the class PageDirectiveAdapterImpl method setEmbeddedType.

public void setEmbeddedType(EmbeddedTypeHandler handler) {
    // if really the same handler, no need for further processing
    if (embeddedTypeHandler == handler) {
        return;
    }
    // release and remove current factories
    if (embeddedTypeHandler != null) {
        Iterator list = embeddedFactoryRegistry.iterator();
        while (list.hasNext()) {
            INodeAdapterFactory factory = (INodeAdapterFactory) list.next();
            factory.release();
        }
        embeddedFactoryRegistry.clear();
    }
    embeddedTypeHandler = handler;
    // "editor side".
    if (embeddedTypeHandler != null) {
        Iterator iterator = embeddedTypeHandler.getAdapterFactories().iterator();
        while (iterator.hasNext()) {
            INodeAdapterFactory factory = (INodeAdapterFactory) iterator.next();
            embeddedFactoryRegistry.add(factory);
        }
    }
}
Also used : Iterator(java.util.Iterator) INodeAdapterFactory(org.eclipse.wst.sse.core.internal.provisional.INodeAdapterFactory)

Example 33 with INodeAdapterFactory

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

the class EmbeddedHTML method initializeFactoryRegistry.

public void initializeFactoryRegistry(FactoryRegistry registry) {
    Assert.isNotNull(registry);
    INodeAdapterFactory factory = null;
    if (!registry.contains(DocumentTypeAdapter.class)) {
        factory = HTMLDocumentTypeAdapterFactory.getInstance();
        registry.addFactory(factory);
    }
    if (!registry.contains(ModelParserAdapter.class)) {
        factory = HTMLModelParserAdapterFactory.getInstance();
        registry.addFactory(factory);
    }
    if (!registry.contains(IStyleSelectorAdapter.class)) {
        factory = HTMLStyleSelectorAdapterFactory.getInstance();
        registry.addFactory(factory);
    }
    if (!registry.contains(IStyleSheetAdapter.class)) {
        factory = StyleAdapterFactory.getInstance();
        registry.addFactory(factory);
    }
}
Also used : ModelParserAdapter(org.eclipse.wst.xml.core.internal.document.ModelParserAdapter) IStyleSelectorAdapter(org.eclipse.wst.css.core.internal.provisional.adapters.IStyleSelectorAdapter) IStyleSheetAdapter(org.eclipse.wst.css.core.internal.provisional.adapters.IStyleSheetAdapter) DocumentTypeAdapter(org.eclipse.wst.xml.core.internal.document.DocumentTypeAdapter) INodeAdapterFactory(org.eclipse.wst.sse.core.internal.provisional.INodeAdapterFactory)

Example 34 with INodeAdapterFactory

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

the class EmbeddedHTML method uninitializeFactoryRegistry.

public void uninitializeFactoryRegistry(FactoryRegistry registry) {
    Assert.isNotNull(registry);
    // ISSUE: should these factories be released? Or just
    // removed from this registry, because we are getting ready to
    // re-add them?
    INodeAdapterFactory factory = null;
    if (!registry.contains(DocumentTypeAdapter.class)) {
        factory = registry.getFactoryFor(DocumentTypeAdapter.class);
        factory.release();
        registry.removeFactory(factory);
    }
    if (!registry.contains(ModelParserAdapter.class)) {
        factory = registry.getFactoryFor(ModelParserAdapter.class);
        factory.release();
        registry.removeFactory(factory);
    }
    if (!registry.contains(IStyleSelectorAdapter.class)) {
        factory = registry.getFactoryFor(IStyleSelectorAdapter.class);
        factory.release();
        registry.removeFactory(factory);
    }
    if (!registry.contains(IStyleSheetAdapter.class)) {
        factory = registry.getFactoryFor(IStyleSheetAdapter.class);
        factory.release();
        registry.removeFactory(factory);
    }
}
Also used : ModelParserAdapter(org.eclipse.wst.xml.core.internal.document.ModelParserAdapter) IStyleSelectorAdapter(org.eclipse.wst.css.core.internal.provisional.adapters.IStyleSelectorAdapter) IStyleSheetAdapter(org.eclipse.wst.css.core.internal.provisional.adapters.IStyleSheetAdapter) DocumentTypeAdapter(org.eclipse.wst.xml.core.internal.document.DocumentTypeAdapter) INodeAdapterFactory(org.eclipse.wst.sse.core.internal.provisional.INodeAdapterFactory)

Example 35 with INodeAdapterFactory

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

the class HTMLDocumentLoader method getAdapterFactories.

/**
 * This method must return those factories which must be attached to the
 * structuredModel before content is applied.
 */
public List getAdapterFactories() {
    List result = new ArrayList();
    INodeAdapterFactory factory = null;
    factory = StyleAdapterFactory.getInstance();
    result.add(factory);
    factory = HTMLStyleSelectorAdapterFactory.getInstance();
    result.add(factory);
    factory = HTMLDocumentTypeAdapterFactory.getInstance();
    result.add(factory);
    factory = HTMLModelParserAdapterFactory.getInstance();
    result.add(factory);
    // 
    factory = new ModelQueryAdapterFactoryForHTML();
    result.add(factory);
    factory = new PropagatingAdapterFactoryImpl();
    result.add(factory);
    return result;
}
Also used : PropagatingAdapterFactoryImpl(org.eclipse.wst.xml.core.internal.propagate.PropagatingAdapterFactoryImpl) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) ModelQueryAdapterFactoryForHTML(org.eclipse.wst.html.core.internal.modelquery.ModelQueryAdapterFactoryForHTML) 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