Search in sources :

Example 1 with IPreferenceForm

use of org.talend.core.ui.services.IPreferenceForm in project tbd-studio-se by Talend.

the class HadoopUiService method createDynamicDistributionPrefForm.

/* (non-Javadoc)
     * @see org.talend.core.ui.services.IHadoopUiService#createDynamicDistributionPrefForm(org.eclipse.swt.widgets.Composite)
     */
@Override
public IPreferenceForm createDynamicDistributionPrefForm(Composite parent, PreferencePage prefPage) {
    IDynamicMonitor monitor = new DummyDynamicMonitor();
    DynamicDistributionPreferenceForm existingConfigForm = new DynamicDistributionPreferenceForm(parent, SWT.NONE, monitor, ITalendCorePrefConstants.ARTIFACT_PROXY_SETTING);
    AbstractDynamicDistributionForm.ICheckListener checkListener = new ICheckListener() {

        @Override
        public String getMessage() {
            return prefPage.getMessage();
        }

        @Override
        public void showMessage(String message, int level) {
            prefPage.setMessage(message, level);
        }

        @Override
        public void updateButtons() {
            boolean isValid = existingConfigForm.isComplete();
            prefPage.setValid(isValid);
        }

        @Override
        public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws Exception {
            // $NON-NLS-1$
            throw new Exception("Please implement it if needed");
        }
    };
    existingConfigForm.setCheckListener(checkListener);
    return new IPreferenceForm() {

        @Override
        public void setLayoutData(Object layoutData) {
            existingConfigForm.setLayoutData(layoutData);
        }

        @Override
        public boolean performApply() {
            return existingConfigForm.performApply();
        }

        @Override
        public boolean performDefaults() {
            return existingConfigForm.performDefaults();
        }

        @Override
        public boolean isComplete() {
            return existingConfigForm.isComplete();
        }
    };
}
Also used : ICheckListener(org.talend.repository.hadoopcluster.ui.dynamic.form.AbstractDynamicDistributionForm.ICheckListener) ICheckListener(org.talend.repository.hadoopcluster.ui.dynamic.form.AbstractDynamicDistributionForm.ICheckListener) DummyDynamicMonitor(org.talend.designer.maven.aether.DummyDynamicMonitor) AbstractDynamicDistributionForm(org.talend.repository.hadoopcluster.ui.dynamic.form.AbstractDynamicDistributionForm) DynamicDistributionPreferenceForm(org.talend.repository.hadoopcluster.ui.dynamic.form.DynamicDistributionPreferenceForm) IDynamicMonitor(org.talend.designer.maven.aether.IDynamicMonitor) IPreferenceForm(org.talend.core.ui.services.IPreferenceForm) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Aggregations

IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)1 IPreferenceForm (org.talend.core.ui.services.IPreferenceForm)1 DummyDynamicMonitor (org.talend.designer.maven.aether.DummyDynamicMonitor)1 IDynamicMonitor (org.talend.designer.maven.aether.IDynamicMonitor)1 AbstractDynamicDistributionForm (org.talend.repository.hadoopcluster.ui.dynamic.form.AbstractDynamicDistributionForm)1 ICheckListener (org.talend.repository.hadoopcluster.ui.dynamic.form.AbstractDynamicDistributionForm.ICheckListener)1 DynamicDistributionPreferenceForm (org.talend.repository.hadoopcluster.ui.dynamic.form.DynamicDistributionPreferenceForm)1