Search in sources :

Example 1 with IComponentList

use of org.eclipse.wst.common.ui.internal.search.dialogs.IComponentList in project webtools.sourceediting by eclipse.

the class XSDAttributeSearchListProvider method populateComponentList.

public void populateComponentList(IComponentList list, SearchScope scope, IProgressMonitor pm) {
    // now we traverse the types already defined within the visible schemas
    // we do this in addition to the component search since this should execute
    // very quickly and there's a good chance the user wants to select a time that's
    // already imported/included
    // TODO (cs) ensure we don't add duplicates when we proceed to use the search list
    // 
    List visitedSchemas = new ArrayList();
    for (int i = 0; i < schemas.length; i++) {
        XSDSchema schema = schemas[i];
        ComponentCollectingXSDVisitor visitor = new ComponentCollectingXSDVisitor(list, IXSDSearchConstants.ATTRIBUTE_META_NAME);
        visitor.visitSchema(schema, true);
        visitedSchemas.addAll(visitor.getVisitedSchemas());
    }
    // finally we call the search API's to do a potentially slow search
    if (scope != null) {
        populateComponentListUsingSearch(list, scope, pm, createFileMap(visitedSchemas));
    }
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) IComponentList(org.eclipse.wst.common.ui.internal.search.dialogs.IComponentList) ArrayList(java.util.ArrayList) XSDSchema(org.eclipse.xsd.XSDSchema)

Example 2 with IComponentList

use of org.eclipse.wst.common.ui.internal.search.dialogs.IComponentList in project webtools.sourceediting by eclipse.

the class AddXSDRedefinedAttributeGroupAction method buildComponentsList.

protected void buildComponentsList(XSDRedefine xsdRedefine, Set redefinedComponentsNames, IComponentList componentList) {
    List attributeGroups = xsdRedefine.getIncorporatedSchema().getAttributeGroupDefinitions();
    Iterator iterator = attributeGroups.iterator();
    while (iterator.hasNext()) {
        XSDAttributeGroupDefinition attributeGroupDefinition = (XSDAttributeGroupDefinition) iterator.next();
        String attributeGroupDefinitionName = attributeGroupDefinition.getName();
        if (!redefinedComponentsNames.contains(attributeGroupDefinitionName)) {
            componentList.add(attributeGroupDefinition);
        }
    }
}
Also used : Iterator(java.util.Iterator) List(java.util.List) IComponentList(org.eclipse.wst.common.ui.internal.search.dialogs.IComponentList) XSDAttributeGroupDefinition(org.eclipse.xsd.XSDAttributeGroupDefinition)

Example 3 with IComponentList

use of org.eclipse.wst.common.ui.internal.search.dialogs.IComponentList in project webtools.sourceediting by eclipse.

the class XSDTypesSearchListProvider method populateComponentList.

public void populateComponentList(IComponentList list, SearchScope scope, IProgressMonitor pm) {
    // first we add the 'built in' types
    // 
    XSDSchema schemaForSchema = XSDSchemaImpl.getSchemaForSchema(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001);
    for (Iterator i = schemaForSchema.getSimpleTypeIdMap().values().iterator(); i.hasNext(); ) {
        XSDTypeDefinition td = (XSDTypeDefinition) i.next();
        if (builtInFilter == null || !builtInFilter.shouldFilterOut(td)) {
            list.add(td);
        }
    }
    // now we traverse the types already defined within the visible schemas
    // we do this in addition to the component search since this should execute
    // very quickly and there's a good chance the user wants to select a time
    // that's
    // already imported/included
    // TODO (cs) ensure we don't add duplicates when we proceed to use the
    // search list
    // 
    List visitedSchemas = new ArrayList();
    for (int i = 0; i < schemas.length; i++) {
        XSDSchema schema = schemas[i];
        QualifiedName kind = showComplexTypes ? IXSDSearchConstants.TYPE_META_NAME : IXSDSearchConstants.SIMPLE_TYPE_META_NAME;
        ComponentCollectingXSDVisitor visitor = new ComponentCollectingXSDVisitor(list, kind);
        visitor.visitSchema(schema, true);
        visitedSchemas.addAll(visitor.getVisitedSchemas());
    }
    // 
    if (scope != null) {
        populateComponentListUsingSearch(list, scope, pm, createFileMap(visitedSchemas));
    }
}
Also used : QualifiedName(org.eclipse.wst.common.core.search.pattern.QualifiedName) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) IComponentList(org.eclipse.wst.common.ui.internal.search.dialogs.IComponentList) XSDSchema(org.eclipse.xsd.XSDSchema) XSDTypeDefinition(org.eclipse.xsd.XSDTypeDefinition)

Example 4 with IComponentList

use of org.eclipse.wst.common.ui.internal.search.dialogs.IComponentList in project webtools.sourceediting by eclipse.

the class XSDElementsSearchListProvider method populateComponentList.

public void populateComponentList(IComponentList list, SearchScope scope, IProgressMonitor pm) {
    // now we traverse the types already defined within the visible schemas
    // we do this in addition to the component search since this should execute
    // very quickly and there's a good chance the user wants to select a time that's
    // already imported/included
    // TODO (cs) ensure we don't add duplicates when we proceed to use the search list
    // 
    List visitedSchemas = new ArrayList();
    for (int i = 0; i < schemas.length; i++) {
        XSDSchema schema = schemas[i];
        ComponentCollectingXSDVisitor visitor = new ComponentCollectingXSDVisitor(list, IXSDSearchConstants.ELEMENT_META_NAME);
        visitor.visitSchema(schema, true);
        visitedSchemas.addAll(visitor.getVisitedSchemas());
    }
    // finally we call the search API's to do a potentially slow search
    if (scope != null) {
        populateComponentListUsingSearch(list, scope, pm, createFileMap(visitedSchemas));
    }
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) IComponentList(org.eclipse.wst.common.ui.internal.search.dialogs.IComponentList) ArrayList(java.util.ArrayList) XSDSchema(org.eclipse.xsd.XSDSchema)

Example 5 with IComponentList

use of org.eclipse.wst.common.ui.internal.search.dialogs.IComponentList in project webtools.sourceediting by eclipse.

the class AddXSDRedefinedModelGroupAction method buildComponentsList.

protected void buildComponentsList(XSDRedefine xsdRedefine, Set redefinedComponentsNames, IComponentList componentList) {
    List modelGroupList = xsdRedefine.getIncorporatedSchema().getModelGroupDefinitions();
    Iterator iterator = modelGroupList.iterator();
    while (iterator.hasNext()) {
        XSDModelGroupDefinition modelGroupDefinition = (XSDModelGroupDefinition) iterator.next();
        String modelGroupDefinitionName = modelGroupDefinition.getName();
        if (!redefinedComponentsNames.contains(modelGroupDefinitionName)) {
            componentList.add(modelGroupDefinition);
        }
    }
}
Also used : Iterator(java.util.Iterator) List(java.util.List) IComponentList(org.eclipse.wst.common.ui.internal.search.dialogs.IComponentList) XSDModelGroupDefinition(org.eclipse.xsd.XSDModelGroupDefinition)

Aggregations

List (java.util.List)7 IComponentList (org.eclipse.wst.common.ui.internal.search.dialogs.IComponentList)7 Iterator (java.util.Iterator)5 ArrayList (java.util.ArrayList)3 XSDSchema (org.eclipse.xsd.XSDSchema)3 XSDTypeDefinition (org.eclipse.xsd.XSDTypeDefinition)3 QualifiedName (org.eclipse.wst.common.core.search.pattern.QualifiedName)1 XSDAttributeGroupDefinition (org.eclipse.xsd.XSDAttributeGroupDefinition)1 XSDComplexTypeDefinition (org.eclipse.xsd.XSDComplexTypeDefinition)1 XSDModelGroupDefinition (org.eclipse.xsd.XSDModelGroupDefinition)1 XSDSimpleTypeDefinition (org.eclipse.xsd.XSDSimpleTypeDefinition)1