use of com.amalto.workbench.dialogs.FacetsListInputDialog in project tmdm-studio-se by Talend.
the class XSDEditFacetAction method editEnumeration.
// editPattern
private void editEnumeration() {
List currentValues = std.getEnumerationFacets();
ArrayList stringValues = new ArrayList();
for (Iterator iter = currentValues.iterator(); iter.hasNext(); ) {
XSDEnumerationFacet facet = (XSDEnumerationFacet) iter.next();
stringValues.add(facet.getLexicalValue());
}
dialog = new FacetsListInputDialog(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
newValues = ((FacetsListInputDialog) dialog).getItems();
dialog.close();
}
}, page.getSite().getShell(), Messages.XSDEditFacetAction_DialogTitle2, stringValues);
dialog.setBlockOnOpen(true);
int ret = dialog.open();
if (ret == Dialog.CANCEL) {
return;
}
std.getFacetContents().removeAll(currentValues);
for (Iterator iter = newValues.iterator(); iter.hasNext(); ) {
String element = (String) iter.next();
XSDEnumerationFacet f = XSDSchemaBuildingTools.getXSDFactory().createXSDEnumerationFacet();
f.setLexicalValue(element);
std.getFacetContents().add(f);
}
}
use of com.amalto.workbench.dialogs.FacetsListInputDialog in project tmdm-studio-se by Talend.
the class XSDEditFacetAction method editPattern.
private void editPattern() {
List currentValues = std.getPatternFacets();
ArrayList stringValues = new ArrayList();
for (Iterator iter = currentValues.iterator(); iter.hasNext(); ) {
XSDPatternFacet facet = (XSDPatternFacet) iter.next();
stringValues.add(facet.getLexicalValue());
}
dialog = new FacetsListInputDialog(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
newValues = ((FacetsListInputDialog) dialog).getItems();
dialog.close();
}
}, page.getSite().getShell(), Messages.XSDEditFacetAction_DialogTitle1, stringValues);
dialog.setBlockOnOpen(true);
int ret = dialog.open();
if (ret == Dialog.CANCEL) {
return;
}
std.getFacetContents().removeAll(currentValues);
for (Iterator iter = newValues.iterator(); iter.hasNext(); ) {
String element = (String) iter.next();
XSDPatternFacet f = XSDSchemaBuildingTools.getXSDFactory().createXSDPatternFacet();
f.setLexicalValue(element);
std.getFacetContents().add(f);
}
}
Aggregations