Search in sources :

Example 1 with FacetsListInputDialog

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);
    }
}
Also used : XSDEnumerationFacet(org.eclipse.xsd.XSDEnumerationFacet) FacetsListInputDialog(com.amalto.workbench.dialogs.FacetsListInputDialog) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ArrayList(java.util.ArrayList) List(java.util.List) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 2 with FacetsListInputDialog

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);
    }
}
Also used : XSDPatternFacet(org.eclipse.xsd.XSDPatternFacet) FacetsListInputDialog(com.amalto.workbench.dialogs.FacetsListInputDialog) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ArrayList(java.util.ArrayList) List(java.util.List) SelectionListener(org.eclipse.swt.events.SelectionListener)

Aggregations

FacetsListInputDialog (com.amalto.workbench.dialogs.FacetsListInputDialog)2 ArrayList (java.util.ArrayList)2 Iterator (java.util.Iterator)2 List (java.util.List)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 SelectionListener (org.eclipse.swt.events.SelectionListener)2 XSDEnumerationFacet (org.eclipse.xsd.XSDEnumerationFacet)1 XSDPatternFacet (org.eclipse.xsd.XSDPatternFacet)1