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;
}
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);
}
}
}
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);
}
}
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);
}
}
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;
}
Aggregations