Search in sources :

Example 1 with SortFieldSelectionFilter

use of com.amalto.workbench.dialogs.filter.SortFieldSelectionFilter in project tmdm-studio-se by Talend.

the class ViewMainPage method addListener.

private void addListener() {
    combox_policy.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            boolean toSelectXPath = combox_policy.getText().equals(selectXPath);
            if (toSelectXPath) {
                String modelName = getDatamodelName();
                String entityName = concept;
                XpathSelectDialog dlg = getXPathSelectionDialog(Messages.ViewMainPage_titleSelectField, modelName, new SortFieldSelectionFilter());
                dlg.setConceptName(entityName);
                String xpath = null;
                if (dlg.open() == IDialogConstants.OK_ID) {
                    xpath = dlg.getXpath();
                }
                if (xpath != null) {
                    combox_policy.setItems(new String[] { SORT_FIELD[0], SORT_FIELD[1], xpath, selectXPath });
                    combox_policy.setText(xpath);
                    combox_sortdirection.setVisible(true);
                    combox_sortdirection.select(0);
                    markDirtyWithoutCommit();
                } else {
                    lastSortField = lastSortField == null ? SORT_FIELD[0] : lastSortField;
                    combox_policy.setText(lastSortField);
                }
            } else if (combox_policy.getSelectionIndex() != 0 && combox_policy.getSelectionIndex() != 1) {
                combox_sortdirection.setVisible(true);
                combox_sortdirection.select(0);
                lastSortField = combox_policy.getText();
                markDirtyWithoutCommit();
            } else {
                lastSortField = combox_policy.getText();
                combox_sortdirection.setVisible(false);
                markDirtyWithoutCommit();
            }
        }
    });
    combox_policy.addMouseTrackListener(new MouseTrackAdapter() {

        @Override
        public void mouseHover(MouseEvent e) {
            combox_policy.setToolTipText(combox_policy.getText());
        }
    });
    combox_sortdirection.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            markDirtyWithoutCommit();
        }
    });
}
Also used : MouseEvent(org.eclipse.swt.events.MouseEvent) SortFieldSelectionFilter(com.amalto.workbench.dialogs.filter.SortFieldSelectionFilter) XpathSelectDialog(com.amalto.workbench.dialogs.XpathSelectDialog) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) MouseTrackAdapter(org.eclipse.swt.events.MouseTrackAdapter)

Aggregations

XpathSelectDialog (com.amalto.workbench.dialogs.XpathSelectDialog)1 SortFieldSelectionFilter (com.amalto.workbench.dialogs.filter.SortFieldSelectionFilter)1 MouseEvent (org.eclipse.swt.events.MouseEvent)1 MouseTrackAdapter (org.eclipse.swt.events.MouseTrackAdapter)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1