Search in sources :

Example 51 with INodeAdapter

use of org.eclipse.wst.sse.core.internal.provisional.INodeAdapter in project jbosstools-hibernate by jbosstools.

the class ObserverAdapterFactory method createAdapter.

protected INodeAdapter createAdapter(INodeNotifier target) {
    Node n = (Node) target;
    String nodeName = n.getNodeName();
    INodeAdapter result = null;
    Object key = DOMAdapter.class;
    if ("hibernate-reverse-engineering".equals(nodeName)) {
        // $NON-NLS-1$
        result = new UnknownNodeAdapter(key, revEngDefinition) {

            public void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {
                observer.hibernateMappingChanged();
            }
        };
    } else if ("table-filter".equals(nodeName)) {
        // $NON-NLS-1$
        result = new TableFilterAdapter((Node) target, revEngDefinition);
    } else if ("type-mapping".equals(nodeName)) {
        // $NON-NLS-1$
        result = new UnknownNodeAdapter(key, revEngDefinition) {

            public void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {
                observer.typeMappingChanged(notifier);
            }
        };
    } else if ("sql-type".equals(nodeName)) {
        // $NON-NLS-1$
        result = new TypeMappingAdapter((Node) target, revEngDefinition);
    } else if ("table".equals(nodeName)) {
        // $NON-NLS-1$
        result = new RevEngTableAdapter((Node) target, revEngDefinition);
    } else if ("column".equals(nodeName) || "key-column".equals(nodeName)) {
        // $NON-NLS-1$ //$NON-NLS-2$
        result = new RevEngColumnAdapter((Node) target, revEngDefinition);
    } else if ("primary-key".equals(nodeName)) {
        // $NON-NLS-1$
        result = new RevEngPrimaryKeyAdapter((Node) target, revEngDefinition);
    } else if ("generator".equals(nodeName)) {
        // $NON-NLS-1$
        result = new RevEngGeneratorAdapter((Node) target, revEngDefinition);
    } else if ("param".equals(nodeName)) {
        // $NON-NLS-1$
        result = new RevEngParamAdapter((Node) target, revEngDefinition);
    } else if (// $NON-NLS-1$
    "foreign-key".equals(nodeName) || // $NON-NLS-1$
    "column-ref".equals(nodeName)) {
        result = new UnknownNodeAdapter(key, revEngDefinition) {

            public void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {
                observer.tablesChanged(notifier);
            }
        };
    }
    if (result == null) {
        result = new UnknownNodeAdapter(key, revEngDefinition);
    }
    if (result != null) {
        adaptChildren((Node) target);
    }
    return result;
}
Also used : INodeAdapter(org.eclipse.wst.sse.core.internal.provisional.INodeAdapter) RevEngPrimaryKeyAdapter(org.hibernate.eclipse.mapper.model.RevEngPrimaryKeyAdapter) Node(org.w3c.dom.Node) TableFilterAdapter(org.hibernate.eclipse.mapper.model.TableFilterAdapter) TypeMappingAdapter(org.hibernate.eclipse.mapper.model.TypeMappingAdapter) RevEngParamAdapter(org.hibernate.eclipse.mapper.model.RevEngParamAdapter) DOMAdapter(org.hibernate.eclipse.mapper.model.DOMAdapter) RevEngTableAdapter(org.hibernate.eclipse.mapper.model.RevEngTableAdapter) RevEngColumnAdapter(org.hibernate.eclipse.mapper.model.RevEngColumnAdapter) RevEngGeneratorAdapter(org.hibernate.eclipse.mapper.model.RevEngGeneratorAdapter) INodeNotifier(org.eclipse.wst.sse.core.internal.provisional.INodeNotifier)

Aggregations

INodeAdapter (org.eclipse.wst.sse.core.internal.provisional.INodeAdapter)51 INodeNotifier (org.eclipse.wst.sse.core.internal.provisional.INodeNotifier)31 IDOMModel (org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel)25 Node (org.w3c.dom.Node)22 IStructuredDocument (org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument)20 Document (org.w3c.dom.Document)19 NullInputStream (org.eclipse.wst.sse.core.internal.encoding.util.NullInputStream)18 RegionChangedEvent (org.eclipse.wst.sse.core.internal.provisional.events.RegionChangedEvent)18 StructuredDocumentEvent (org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentEvent)18 Iterator (java.util.Iterator)10 Collection (java.util.Collection)7 IDOMNode (org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode)7 Element (org.w3c.dom.Element)5 List (java.util.List)4 ICSSStyleListener (org.eclipse.wst.css.core.internal.event.ICSSStyleListener)4 IStyleSheetAdapter (org.eclipse.wst.css.core.internal.provisional.adapters.IStyleSheetAdapter)4 IDOMDocument (org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument)4 EObject (org.eclipse.emf.ecore.EObject)3 Resource (org.eclipse.emf.ecore.resource.Resource)3 ISelection (org.eclipse.jface.viewers.ISelection)3