Search in sources :

Example 11 with ComponentSpecification

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

the class SelectBuiltInTypesForFilteringDialog method getTypesListInString.

/**
 *   Returns a String acting as list of built-in types selected by the user
 * in the filter dialog (white space acts as the item separator).
 *   Suggest using getSelectedBuiltInTypesFromString
 * to get a concrete array of selected types.
 *   We can only store String in the plugin preference's storage so we have
 * use this method for conversion
 */
public static String getTypesListInString(Object[] chosenTypes) {
    // $NON-NLS-1$
    String returningList = "";
    for (int i = 0; i < chosenTypes.length; i++) {
        if (chosenTypes[i] instanceof ComponentSpecification) {
            ComponentSpecification aType = (ComponentSpecification) chosenTypes[i];
            returningList += aType.getName() + CUSTOM_LIST_SEPARATOR;
        }
    /* else selectedBuiltInTypes[i] instanceof List, ie. a parentNode
			 * we ignore it. */
    }
    return returningList;
}
Also used : ComponentSpecification(org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification)

Example 12 with ComponentSpecification

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

the class SelectBuiltInTypesForFilteringDialog method getSelectedBuiltInTypesFromString.

/**
 * Filters out all built-In type not recorded in the 'listString' and
 * returns the result in a List
 * Warning: recursive method
 * @param listString
 * @param aContainer
 * 			Containing all types
 * @return a subset of what 'aContainer' has as specified by 'listString'
 */
public static List getSelectedBuiltInTypesFromString(String listString, List aContainer) {
    List selectedTypes = new ArrayList();
    // ignore the 'header' item in the container, starting from i = 1
    for (int i = 1; i < aContainer.size(); i++) {
        Object o = aContainer.get(i);
        if (o instanceof ComponentSpecification) {
            ComponentSpecification aType = (ComponentSpecification) o;
            String typeName = aType.getName();
            // if typeName's name appears in 'listString'
            if (listString.indexOf(typeName + CUSTOM_LIST_SEPARATOR) != -1)
                selectedTypes.add(o);
        } else if (o instanceof List) {
            selectedTypes.addAll(getSelectedBuiltInTypesFromString(listString, (List) o));
        }
    }
    return selectedTypes;
}
Also used : ComponentSpecification(org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList)

Example 13 with ComponentSpecification

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

the class XSDElementReferenceEditManager method getQuickPicks.

public ComponentSpecification[] getQuickPicks() {
    // TODO (cs) implement this properly - we should be providing a list of the
    // most 'common' built in schema types here
    // I believe Trung will be working on a perference page to give us this list
    // for now let's hard code some values
    // 
    List list = new ArrayList();
    ComponentSpecification[] result = new ComponentSpecification[list.size()];
    list.toArray(result);
    return result;
}
Also used : ComponentSpecification(org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Example 14 with ComponentSpecification

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

the class XSDElementReferenceEditManager method getHistory.

public ComponentSpecification[] getHistory() {
    // TODO (cs) implement this properly - should this history be global or local to each editor?
    // This is something we should play around with ourselves to see what feels right.
    // 
    List list = new ArrayList();
    ComponentSpecification[] result = new ComponentSpecification[list.size()];
    list.toArray(result);
    return result;
}
Also used : ComponentSpecification(org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Example 15 with ComponentSpecification

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

the class NewTypeDialog method getSelectedComponent.

public ComponentSpecification getSelectedComponent() {
    ComponentSpecification componentSpecification;
    if (anonymousType)
        componentSpecification = new ComponentSpecification(null, null, null);
    else
        componentSpecification = new ComponentSpecification(null, getName(), null);
    componentSpecification.setMetaName(typeKind == COMPLEX_TYPE ? IXSDSearchConstants.COMPLEX_TYPE_META_NAME : IXSDSearchConstants.SIMPLE_TYPE_META_NAME);
    componentSpecification.setNew(true);
    // componentSpecification.
    return componentSpecification;
}
Also used : ComponentSpecification(org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification)

Aggregations

ComponentSpecification (org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification)28 ComponentReferenceEditManager (org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager)15 IEditorPart (org.eclipse.ui.IEditorPart)12 ArrayList (java.util.ArrayList)7 List (java.util.List)7 IComponentDialog (org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog)6 XSDElementDeclaration (org.eclipse.xsd.XSDElementDeclaration)6 XSDTypeReferenceEditManager (org.eclipse.wst.xsd.ui.internal.editor.XSDTypeReferenceEditManager)5 XSDSearchListDialogDelegate (org.eclipse.wst.xsd.ui.internal.editor.search.XSDSearchListDialogDelegate)4 Element (org.w3c.dom.Element)4 XSDComplexTypeBaseTypeEditManager (org.eclipse.wst.xsd.ui.internal.editor.XSDComplexTypeBaseTypeEditManager)3 XSDAttributeDeclaration (org.eclipse.xsd.XSDAttributeDeclaration)3 XSDSimpleTypeDefinition (org.eclipse.xsd.XSDSimpleTypeDefinition)3 XSDTypeDefinition (org.eclipse.xsd.XSDTypeDefinition)3 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 XSDBaseAdapter (org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter)2 XSDComplexTypeDefinition (org.eclipse.xsd.XSDComplexTypeDefinition)2 Iterator (java.util.Iterator)1 IFile (org.eclipse.core.resources.IFile)1 Path (org.eclipse.core.runtime.Path)1