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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations