Search in sources :

Example 1 with ProblemsAnalyser

use of org.talend.designer.xmlmap.util.problem.ProblemsAnalyser in project tdi-studio-se by Talend.

the class FooterComposite method createComponents.

/**
     * DOC amaumont Comment method "createComponents".
     */
private void createComponents() {
    FormLayout formLayout = new FormLayout();
    formLayout.spacing = 15;
    this.setLayout(formLayout);
    Button applyButton = new Button(this, SWT.NONE);
    applyButton.setEnabled(!mapperUi.getMapperComponent().isReadOnly());
    //$NON-NLS-1$
    applyButton.setText("Apply");
    FormData applyFormData = new FormData();
    applyFormData.width = 100;
    applyButton.setLayoutData(applyFormData);
    applyButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            mapperUi.closeMapperDialog(SWT.APPLICATION_MODAL);
        }
    });
    statusBar = new StatusBar(this, SWT.NONE);
    final ProblemsAnalyser problemsAnalyser = mapperUi.getMapperManager().getProblemsAnalyser();
    if (!problemsAnalyser.getProblems().isEmpty()) {
        statusBar.setValues(STATUS.ERROR, problemsAnalyser.getErrorMessage());
    }
    Button okButton = new Button(this, SWT.NONE);
    okButton.setEnabled(!mapperUi.getMapperComponent().isReadOnly());
    //$NON-NLS-1$
    okButton.setText("OK");
    FormData okFormData = new FormData();
    okFormData.width = 100;
    okButton.setLayoutData(okFormData);
    okButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            mapperUi.closeMapperDialog(SWT.OK);
        }
    });
    Button cancelButton = new Button(this, SWT.NONE);
    //$NON-NLS-1$
    cancelButton.setText("Cancel");
    cancelButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            mapperUi.closeMapperDialog(SWT.CANCEL);
        }
    });
    FormData cancelFormData = new FormData();
    cancelFormData.width = 100;
    cancelButton.setLayoutData(cancelFormData);
    cancelFormData.right = new FormAttachment(100, -5);
    okFormData.right = new FormAttachment(cancelButton, -5);
    applyFormData.right = new FormAttachment(okButton, -5);
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ProblemsAnalyser(org.talend.designer.xmlmap.util.problem.ProblemsAnalyser) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) SelectionListener(org.eclipse.swt.events.SelectionListener)

Aggregations

SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 SelectionListener (org.eclipse.swt.events.SelectionListener)1 FormAttachment (org.eclipse.swt.layout.FormAttachment)1 FormData (org.eclipse.swt.layout.FormData)1 FormLayout (org.eclipse.swt.layout.FormLayout)1 Button (org.eclipse.swt.widgets.Button)1 ProblemsAnalyser (org.talend.designer.xmlmap.util.problem.ProblemsAnalyser)1