use of org.eclipse.wst.sse.core.internal.provisional.INodeNotifier in project webtools.sourceediting by eclipse.
the class AbstractCSSModelAdapter method notifyStyleChanged.
/**
*/
protected void notifyStyleChanged(Element target) {
INodeNotifier notifier = (INodeNotifier) target;
if (notifier == null)
return;
Collection adapters = notifier.getAdapters();
if (adapters == null)
return;
Iterator it = adapters.iterator();
if (it == null)
return;
while (it.hasNext()) {
INodeAdapter adapter = (INodeAdapter) it.next();
if (adapter instanceof StyleListener) {
StyleListener listener = (StyleListener) adapter;
listener.styleChanged();
}
}
}
use of org.eclipse.wst.sse.core.internal.provisional.INodeNotifier in project webtools.sourceediting by eclipse.
the class HTMLDocumentAdapter method notifyStyleSheetsChanged.
/**
*/
private void notifyStyleSheetsChanged(Document target) {
INodeNotifier notifier = (INodeNotifier) target;
if (notifier == null)
return;
Collection adapters = notifier.getAdapters();
if (adapters == null)
return;
Iterator it = adapters.iterator();
if (it == null)
return;
while (it.hasNext()) {
INodeAdapter adapter = (INodeAdapter) it.next();
if (adapter instanceof StyleListener) {
StyleListener listener = (StyleListener) adapter;
listener.styleChanged();
}
}
}
use of org.eclipse.wst.sse.core.internal.provisional.INodeNotifier in project webtools.sourceediting by eclipse.
the class HTMLDocumentAdapter method addStyleSheet.
/**
*/
private void addStyleSheet(Element node) {
IDOMElement element = (IDOMElement) node;
String tagName = element.getTagName();
if (tagName == null)
return;
boolean isContainer = false;
if (tagName.equalsIgnoreCase(HTML40Namespace.ElementName.HTML) || tagName.equalsIgnoreCase(HTML40Namespace.ElementName.HEAD) || tagName.equalsIgnoreCase(HTML40Namespace.ElementName.NOSCRIPT) || tagName.equalsIgnoreCase(HTML40Namespace.ElementName.BASE) || tagName.equalsIgnoreCase(JSP11Namespace.ElementName.ROOT) || (!element.isGlobalTag() && element.isContainer())) {
isContainer = true;
} else if (element.isCommentTag()) {
Node parent = element.getParentNode();
if (parent == element.getOwnerDocument()) {
// This condition is too severe, actually do not work for JSF template.
// But above (! globalTag() && isContainer()) cover JSF template + tpl template
isContainer = true;
} else if (parent.getNodeType() == Node.ELEMENT_NODE) {
tagName = ((Element) parent).getTagName();
if (tagName != null && tagName.equalsIgnoreCase(HTML40Namespace.ElementName.HEAD)) {
isContainer = true;
}
}
} else {
String localName = element.getLocalName();
if (localName != null && localName.equalsIgnoreCase(HTML40Namespace.ElementName.HTML)) {
// taglib html tag
isContainer = true;
} else {
INodeNotifier notifier = element;
INodeAdapter adapter = notifier.getAdapterFor(IStyleSheetAdapter.class);
if (adapter != null && adapter instanceof IStyleSheetAdapter) {
this.styleAdapters.addElement(adapter);
}
}
}
if (isContainer) {
INodeNotifier notifier = element;
if (notifier.getExistingAdapter(IStyleSheetListAdapter.class) == null) {
notifier.addAdapter(this);
}
for (Node child = element.getFirstChild(); child != null; child = child.getNextSibling()) {
if (child.getNodeType() != Node.ELEMENT_NODE)
continue;
addStyleSheet((Element) child);
}
}
}
use of org.eclipse.wst.sse.core.internal.provisional.INodeNotifier in project webtools.sourceediting by eclipse.
the class HTMLDocumentLoader method preLoadAdapt.
protected void preLoadAdapt(IStructuredModel structuredModel) {
// DMW: just added this preload on 8/16/2002
// I noticed the ProagatingAdapterFactory was being added,
// that that the ProagatingAdapterAdapter was not being
// preload adapted -- I'm assuing it ALWAYS has to be.
IDOMModel domModel = (IDOMModel) structuredModel;
// if there is a model in the adapter, this will adapt it to
// first node. After that the PropagatingAdater spreads over the
// children being
// created. Each time that happends, a side effect is to
// also "spread" sprecific registered adapters,
// they two can propigate is needed.
((INodeNotifier) domModel.getDocument()).getAdapterFor(PropagatingAdapter.class);
}
use of org.eclipse.wst.sse.core.internal.provisional.INodeNotifier in project webtools.sourceediting by eclipse.
the class HTMLModelLoader method preLoadAdapt.
protected void preLoadAdapt(IStructuredModel structuredModel) {
super.preLoadAdapt(structuredModel);
// DMW: just added this preload on 8/16/2002
// I noticed the ProagatingAdapterFactory was being added,
// that that the ProagatingAdapterAdapter was not being
// preload adapted -- I'm assuing it ALWAYS has to be.
IDOMModel domModel = (IDOMModel) structuredModel;
// if there is a model in the adapter, this will adapt it to
// first node. After that the PropagatingAdater spreads over the
// children being
// created. Each time that happends, a side effect is to
// also "spread" sprecific registered adapters,
// they two can propigate is needed.
((INodeNotifier) domModel.getDocument()).getAdapterFor(PropagatingAdapter.class);
if (Debug.debugNotificationAndEvents) {
PropagatingAdapter propagatingAdapter = (PropagatingAdapter) ((INodeNotifier) domModel.getDocument()).getAdapterFor(PropagatingAdapter.class);
propagatingAdapter.addAdaptOnCreateFactory(new DebugAdapterFactory());
}
}
Aggregations