Search in sources :

Example 1 with XSDTypeReferenceEditManager

use of org.eclipse.wst.xsd.ui.internal.editor.XSDTypeReferenceEditManager in project webtools.sourceediting by eclipse.

the class XSDAttributeDeclarationSection method fillTypesCombo.

private void fillTypesCombo() {
    IEditorPart editor = getActiveEditor();
    XSDTypeReferenceEditManager manager = (XSDTypeReferenceEditManager) editor.getAdapter(XSDTypeReferenceEditManager.class);
    if (manager != null) {
        ComponentSpecification[] items = manager.getQuickPicks();
        typeCombo.removeAll();
        typeCombo.add(Messages._UI_COMBO_BROWSE);
        typeCombo.add(Messages._UI_COMBO_NEW);
        for (int i = 0; i < items.length; i++) {
            typeCombo.add(items[i].getName());
        }
        XSDAttributeDeclaration namedComponent = ((XSDAttributeDeclaration) input).getResolvedAttributeDeclaration();
        XSDTypeDefinition namedComponentType = namedComponent.getType();
        if (namedComponentType != null) {
            // no
            String currentTypeName = namedComponentType.getQName(xsdSchema);
            // prefix
            ComponentSpecification ret = getComponentSpecFromQuickPickForValue(currentTypeName, manager);
            if (// not in quickPick
            ret == null)
                typeCombo.add(currentTypeName);
        }
    }
}
Also used : XSDTypeReferenceEditManager(org.eclipse.wst.xsd.ui.internal.editor.XSDTypeReferenceEditManager) ComponentSpecification(org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification) IEditorPart(org.eclipse.ui.IEditorPart) XSDAttributeDeclaration(org.eclipse.xsd.XSDAttributeDeclaration) XSDTypeDefinition(org.eclipse.xsd.XSDTypeDefinition)

Aggregations

IEditorPart (org.eclipse.ui.IEditorPart)1 ComponentSpecification (org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification)1 XSDTypeReferenceEditManager (org.eclipse.wst.xsd.ui.internal.editor.XSDTypeReferenceEditManager)1 XSDAttributeDeclaration (org.eclipse.xsd.XSDAttributeDeclaration)1 XSDTypeDefinition (org.eclipse.xsd.XSDTypeDefinition)1