use of org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification in project webtools.sourceediting by eclipse.
the class XSDTypeReferenceEditManager 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 XSDTypeReferenceEditManager method getQuickPicks.
public ComponentSpecification[] getQuickPicks() {
if (result != null)
return result;
// 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();
// $NON-NLS-1$
list.add(new ComponentSpecification(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "boolean", null));
// $NON-NLS-1$
list.add(new ComponentSpecification(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "date", null));
// $NON-NLS-1$
list.add(new ComponentSpecification(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "dateTime", null));
// $NON-NLS-1$
list.add(new ComponentSpecification(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "double", null));
// $NON-NLS-1$
list.add(new ComponentSpecification(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "float", null));
// $NON-NLS-1$
list.add(new ComponentSpecification(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "hexBinary", null));
// $NON-NLS-1$
list.add(new ComponentSpecification(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "int", null));
// $NON-NLS-1$
list.add(new ComponentSpecification(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "string", null));
// $NON-NLS-1$
list.add(new ComponentSpecification(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "time", null));
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 AddXSDRedefinableContentAction method run.
public void run() {
Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
if (selection instanceof XSDBaseAdapter) {
selection = ((XSDBaseAdapter) selection).getTarget();
}
if (selection instanceof XSDRedefine) {
ComponentSearchListDialogConfiguration configuration = new ComponentSearchListDialogConfiguration();
configuration.setDescriptionProvider(new RedefineDescriptor());
configuration.setSearchListProvider(new RedefineSearchListProvider((XSDRedefine) selection, this));
ComponentSearchListDialog dialog = new ComponentSearchListDialog(Display.getDefault().getActiveShell(), Messages._UI_LABEL_REDEFINE_COMPONENT, configuration) {
protected Control createDialogArea(Composite parent) {
// Adjust the dialog's initial size.
Composite mainComposite = (Composite) super.createDialogArea(parent);
GridData gridData = (GridData) mainComposite.getLayoutData();
gridData.heightHint = 500;
gridData.widthHint = 350;
return mainComposite;
}
};
dialog.create();
dialog.setBlockOnOpen(true);
int result = dialog.open();
if (result == Window.OK) {
ComponentSpecification selectedComponent = dialog.getSelectedComponent();
buildRedefine((XSDRedefine) selection, selectedComponent);
}
}
}
use of org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification in project webtools.sourceediting by eclipse.
the class SetBaseTypeAction method run.
public void run() {
Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
if (selection instanceof XSDBaseAdapter) {
selection = ((XSDBaseAdapter) selection).getTarget();
boolean complexType = selection instanceof XSDComplexTypeDefinition;
boolean simpleType = selection instanceof XSDSimpleTypeDefinition;
if (complexType || simpleType) {
if (getWorkbenchPart() instanceof IEditorPart) {
IEditorPart editor = (IEditorPart) getWorkbenchPart();
ComponentReferenceEditManager manager = (ComponentReferenceEditManager) editor.getAdapter(XSDComplexTypeBaseTypeEditManager.class);
ComponentSpecification newValue;
IComponentDialog dialog = null;
dialog = manager.getBrowseDialog();
if (dialog != null) {
if (simpleType) {
((XSDSearchListDialogDelegate) dialog).showComplexTypes(false);
}
if (dialog.createAndOpen() == Window.OK) {
newValue = dialog.getSelectedComponent();
manager.modifyComponentReference(selection, newValue);
}
}
}
}
}
}
use of org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification in project webtools.sourceediting by eclipse.
the class XSDElementDeclarationSection method fillTypesCombo.
private void fillTypesCombo() {
IEditorPart editor = getActiveEditor();
ComponentReferenceEditManager manager = (ComponentReferenceEditManager) 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());
}
// Add the current Type of this element if needed
XSDElementDeclaration namedComponent = ((XSDElementDeclaration) input).getResolvedElementDeclaration();
XSDTypeDefinition td = namedComponent.getType();
if (td != null) {
String currentTypeName = td.getQName(xsdSchema);
if (// anonymous type
currentTypeName == null)
currentTypeName = "**Anonymous**";
ComponentSpecification ret = getComponentSpecFromQuickPickForValue(currentTypeName, manager);
if (// not in quickPick
ret == null && currentTypeName != null) {
typeCombo.add(currentTypeName);
}
}
}
}
Aggregations