Search in sources :

Example 26 with ComponentSpecification

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

the class XSDAttributeDeclarationSection method fillComponentNameCombo.

private void fillComponentNameCombo() {
    IEditorPart editor = getActiveEditor();
    ComponentReferenceEditManager manager = (ComponentReferenceEditManager) editor.getAdapter(XSDAttributeReferenceEditManager.class);
    componentNameCombo.removeAll();
    componentNameCombo.add(Messages._UI_ACTION_BROWSE);
    componentNameCombo.add(Messages._UI_ACTION_NEW);
    ComponentSpecification[] quickPicks = manager.getQuickPicks();
    if (quickPicks != null) {
        for (int i = 0; i < quickPicks.length; i++) {
            ComponentSpecification componentSpecification = quickPicks[i];
            componentNameCombo.add(componentSpecification.getName());
        }
    }
    ComponentSpecification[] history = manager.getHistory();
    if (history != null) {
        for (int i = 0; i < history.length; i++) {
            ComponentSpecification componentSpecification = history[i];
            componentNameCombo.add(componentSpecification.getName());
        }
    }
    XSDAttributeDeclaration namedComponent = (XSDAttributeDeclaration) input;
    Element element = namedComponent.getElement();
    if (element != null) {
        String attrValue = element.getAttribute(XSDConstants.REF_ATTRIBUTE);
        if (attrValue == null) {
            // $NON-NLS-1$
            attrValue = "";
        }
        ComponentSpecification ret = getComponentSpecFromQuickPickForValue(attrValue, manager);
        if (ret == null) {
            componentNameCombo.add(attrValue);
        }
        componentNameCombo.setText(attrValue);
        refName = attrValue;
    }
}
Also used : ComponentSpecification(org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification) XSDAttributeReferenceEditManager(org.eclipse.wst.xsd.ui.internal.editor.XSDAttributeReferenceEditManager) Element(org.w3c.dom.Element) ComponentReferenceEditManager(org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager) IEditorPart(org.eclipse.ui.IEditorPart) XSDAttributeDeclaration(org.eclipse.xsd.XSDAttributeDeclaration)

Example 27 with ComponentSpecification

use of org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification 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)

Example 28 with ComponentSpecification

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

the class XSDElementDeclarationAdvancedSection method fillSubstitutionGroupCombo.

private void fillSubstitutionGroupCombo() {
    IEditorPart editor = getActiveEditor();
    ComponentReferenceEditManager manager = (ComponentReferenceEditManager) editor.getAdapter(XSDSubstitutionGroupEditManager.class);
    if (manager != null) {
        ComponentSpecification[] items = manager.getQuickPicks();
        substGroupCombo.removeAll();
        substGroupCombo.add(Messages._UI_COMBO_BROWSE);
        substGroupCombo.add(Messages._UI_COMBO_NEW);
        for (int i = 0; i < items.length; i++) {
            substGroupCombo.add(items[i].getName());
        }
        // Add the current substitution group if needed
        XSDElementDeclaration namedComponent = ((XSDElementDeclaration) input).getSubstitutionGroupAffiliation();
        if (namedComponent != null) {
            ComponentSpecification ret = getComponentSpecFromQuickPickForValue(namedComponent.getName(), manager);
            if (ret == null) {
                substGroupCombo.add(namedComponent.getQName(xsdSchema));
            }
        }
    }
}
Also used : ComponentSpecification(org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification) XSDElementDeclaration(org.eclipse.xsd.XSDElementDeclaration) ComponentReferenceEditManager(org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager) IEditorPart(org.eclipse.ui.IEditorPart) XSDSubstitutionGroupEditManager(org.eclipse.wst.xsd.ui.internal.editor.XSDSubstitutionGroupEditManager)

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