Search in sources :

Example 11 with IADTObject

use of org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject in project webtools.sourceediting by eclipse.

the class ADTContentOutlineProvider method dispose.

/* (non-Javadoc)
   * @see org.eclipse.jface.viewers.IContentProvider#dispose()
   */
public void dispose() {
    Object input = viewer.getInput();
    if (input instanceof IADTObject) {
        removeListener((IADTObject) input);
    }
    if (refreshJob != null) {
        refreshJob.cancel();
        refreshJob = null;
    }
}
Also used : IADTObject(org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject) IADTObject(org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject)

Example 12 with IADTObject

use of org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject in project webtools.sourceediting by eclipse.

the class XSDBaseAdapter method getGlobalXSDContainer.

protected IADTObject getGlobalXSDContainer(XSDConcreteComponent component) {
    XSDConcreteComponent c = component.getContainer();
    // We want the top most structural component
    while (c != null && !(c.getContainer() instanceof XSDSchema) && !(c instanceof XSDComplexTypeDefinition) && !(c instanceof XSDSimpleTypeDefinition) && !(c instanceof XSDModelGroupDefinition) && !(c instanceof XSDAttributeGroupDefinition)) {
        c = c.getContainer();
    }
    Adapter adapter = XSDAdapterFactory.getInstance().adapt(c);
    if (adapter instanceof IADTObject)
        return (IADTObject) adapter;
    return null;
}
Also used : XSDConcreteComponent(org.eclipse.xsd.XSDConcreteComponent) IADTObject(org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject) XSDSimpleTypeDefinition(org.eclipse.xsd.XSDSimpleTypeDefinition) Adapter(org.eclipse.emf.common.notify.Adapter) XSDModelGroupDefinition(org.eclipse.xsd.XSDModelGroupDefinition) XSDComplexTypeDefinition(org.eclipse.xsd.XSDComplexTypeDefinition) XSDSchema(org.eclipse.xsd.XSDSchema) XSDAttributeGroupDefinition(org.eclipse.xsd.XSDAttributeGroupDefinition)

Example 13 with IADTObject

use of org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject in project webtools.sourceediting by eclipse.

the class XSDModelGroupDefinitionAdapter method getFields.

public List getFields() {
    List fields = new ArrayList();
    otherThingsToListenTo = new ArrayList();
    XSDVisitorForFields visitor = new XSDVisitorForGroupFieldsWithSpaceFillers();
    visitor.visitModelGroupDefinition(getXSDModelGroupDefinition());
    populateAdapterList(visitor.concreteComponentList, fields);
    // TODO (cs) common a base class for a structure thingee
    // 
    populateAdapterList(visitor.thingsWeNeedToListenTo, otherThingsToListenTo);
    for (Iterator i = otherThingsToListenTo.iterator(); i.hasNext(); ) {
        Adapter adapter = (Adapter) i.next();
        if (adapter instanceof IADTObject) {
            IADTObject adtObject = (IADTObject) adapter;
            adtObject.registerListener(this);
        }
    }
    return fields;
}
Also used : IADTObject(org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) Adapter(org.eclipse.emf.common.notify.Adapter)

Example 14 with IADTObject

use of org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject in project webtools.sourceediting by eclipse.

the class XSDModelGroupDefinitionAdapter method clearFields.

// TODO Common this up with XSDComplexType's.  See also getFields
protected void clearFields() {
    if (otherThingsToListenTo != null) {
        for (Iterator i = otherThingsToListenTo.iterator(); i.hasNext(); ) {
            Adapter adapter = (Adapter) i.next();
            if (adapter instanceof IADTObject) {
                IADTObject adtObject = (IADTObject) adapter;
                adtObject.unregisterListener(this);
            }
        }
    }
    fields = null;
    otherThingsToListenTo = null;
}
Also used : IADTObject(org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject) Iterator(java.util.Iterator) Adapter(org.eclipse.emf.common.notify.Adapter)

Example 15 with IADTObject

use of org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject in project webtools.sourceediting by eclipse.

the class XSDAttributeGroupDefinitionAdapter method getFields.

public List getFields() {
    if (fields == null) {
        fields = new ArrayList();
        otherThingsToListenTo = new ArrayList();
        XSDVisitorForFields visitor = new XSDVisitorForFields();
        visitor.visitAttributeGroupDefinition(getXSDAttributeGroupDefinition());
        populateAdapterList(visitor.concreteComponentList, fields);
        populateAdapterList(visitor.thingsWeNeedToListenTo, otherThingsToListenTo);
        for (Iterator i = otherThingsToListenTo.iterator(); i.hasNext(); ) {
            Adapter adapter = (Adapter) i.next();
            if (adapter instanceof IADTObject) {
                IADTObject adtObject = (IADTObject) adapter;
                adtObject.registerListener(this);
            }
        }
    }
    return fields;
}
Also used : IADTObject(org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) Adapter(org.eclipse.emf.common.notify.Adapter)

Aggregations

IADTObject (org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject)23 Adapter (org.eclipse.emf.common.notify.Adapter)9 Iterator (java.util.Iterator)7 ArrayList (java.util.ArrayList)5 DesignViewGraphicalViewer (org.eclipse.wst.xsd.ui.internal.adt.design.DesignViewGraphicalViewer)4 IModel (org.eclipse.wst.xsd.ui.internal.adt.facade.IModel)4 IGraphElement (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement)3 XSDConcreteComponent (org.eclipse.xsd.XSDConcreteComponent)3 List (java.util.List)2 EditPart (org.eclipse.gef.EditPart)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)2 IWorkbench (org.eclipse.ui.IWorkbench)2 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)2 RootContentEditPart (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootContentEditPart)2 RootHolder (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.RootHolder)2 IField (org.eclipse.wst.xsd.ui.internal.adt.facade.IField)2 IStructure (org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure)2 ADTContentOutlinePage (org.eclipse.wst.xsd.ui.internal.adt.outline.ADTContentOutlinePage)2 XSDComplexTypeDefinition (org.eclipse.xsd.XSDComplexTypeDefinition)2