Search in sources :

Example 6 with IModel

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

the class RootContentEditPart method getModelChildren.

protected List getModelChildren() {
    collections = new ArrayList();
    if (getModel() != null) {
        Object obj = getModel();
        IADTObject focusObject = null;
        if (obj instanceof IStructure) {
            if (obj instanceof IGraphElement) {
                if (((IGraphElement) obj).isFocusAllowed())
                    focusObject = (IStructure) obj;
            }
        } else if (obj instanceof IField) {
            focusObject = (IField) obj;
        } else if (obj instanceof IModel) {
            focusObject = (IModel) obj;
            collections.add(focusObject);
            return collections;
        } else if (obj instanceof IType) {
            if (obj instanceof IGraphElement) {
                if (((IGraphElement) obj).isFocusAllowed()) {
                    focusObject = (IType) obj;
                }
            }
        } else if (obj instanceof IGraphElement) {
            if (((IGraphElement) obj).isFocusAllowed()) {
                focusObject = (IADTObject) obj;
                collections.add(focusObject);
                return collections;
            }
        }
        if (focusObject != null) {
            RootHolder holder = new RootHolder(focusObject);
            collections.add(holder);
            return collections;
        }
    }
    return collections;
}
Also used : IModel(org.eclipse.wst.xsd.ui.internal.adt.facade.IModel) IGraphElement(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement) IADTObject(org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject) ArrayList(java.util.ArrayList) IADTObject(org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject) IStructure(org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure) IField(org.eclipse.wst.xsd.ui.internal.adt.facade.IField) RootHolder(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.RootHolder) IType(org.eclipse.wst.xsd.ui.internal.adt.facade.IType)

Example 7 with IModel

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

the class RootContentEditPart method getSelectedComplexType.

public IComplexType getSelectedComplexType() {
    IComplexType result = null;
    IModel model = (IModel) getModel();
    List types = model.getTypes();
    if (types.size() > 0) {
        if (types.get(0) instanceof IComplexType)
            result = (IComplexType) types.get(0);
    }
    return result;
}
Also used : IModel(org.eclipse.wst.xsd.ui.internal.adt.facade.IModel) ArrayList(java.util.ArrayList) List(java.util.List) IComplexType(org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType)

Aggregations

IModel (org.eclipse.wst.xsd.ui.internal.adt.facade.IModel)7 IADTObject (org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject)4 IGraphElement (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement)3 ArrayList (java.util.ArrayList)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)2 DesignViewGraphicalViewer (org.eclipse.wst.xsd.ui.internal.adt.design.DesignViewGraphicalViewer)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 Iterator (java.util.Iterator)1 List (java.util.List)1 Adapter (org.eclipse.emf.common.notify.Adapter)1 EditPart (org.eclipse.gef.EditPart)1 EditPartFactory (org.eclipse.gef.EditPartFactory)1 Command (org.eclipse.gef.commands.Command)1 IDocument (org.eclipse.jface.text.IDocument)1 IContentProvider (org.eclipse.jface.viewers.IContentProvider)1 ISelection (org.eclipse.jface.viewers.ISelection)1 TreeViewer (org.eclipse.jface.viewers.TreeViewer)1