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