Source:
IObservableValue<IRegistry> createRegistrySelectionControls( Composite parent) { final Label accountLabel = new Label(parent, SWT.NULL); accountLabel.setText(WizardMessages .getString("ImagePullPushPage.registry.account.label")); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER) .grab(false, false).applyTo(accountLabel); final Combo registryAccountCombo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY); registryAccountCombo.setToolTipText(WizardMessages .getString("ImagePullPushPage.registry.account.desc")); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER) .grab(true, false).applyTo(registryAccountCombo); final ComboViewer registryAccountComboViewer = new ComboViewer( registryAccountCombo); registryAccountComboViewer .setContentProvider(ArrayContentProvider.getInstance()); registryAccountComboViewer .setLabelProvider(new RegistryAccountLabelProvider()); final List<IRegistry> allRegistryAccounts = getRegistryAccounts(); final IPreferenceStore store = Activator.getDefault() .getPreferenceStore(); IRegistry defaultRegistry = null; String lastRegistry = store .getString(PreferenceConstants.LAST_REGISTRY_ACCOUNT); if (!allRegistryAccounts.isEmpty()) { defaultRegistry = allRegistryAccounts.get(0); } IRegistry selectedRegistry = allRegistryAccounts.stream() .filter(x -> x.toString().equals(lastRegistry)).findFirst() .orElse(defaultRegistry); registryAccountComboViewer.setInput(allRegistryAccounts); if (!allRegistryAccounts.isEmpty()) { getModel().setSelectedRegistry(selectedRegistry); } final IObservableValue<IRegistry> registryAccountObservable = BeanProperties .value(ImagePushPageModel.class, ImagePullPushPageModel.SELECTED_REGISTRY) .observe(model); dbc.bindValue(ViewerProperties.singleSelection().observe( registryAccountComboViewer), registryAccountObservable); final Link addRegistryLink = new Link(parent, SWT.NONE); addRegistryLink.setText( WizardMessages.getString("ImagePullPushPage.add.link")); GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER) .grab(false, false).applyTo(addRegistryLink); addRegistryLink.addSelectionListener( onAddRegistry(registryAccountComboViewer)); return registryAccountObservable; }

Target:
IObservableValue<IRegistry> createRegistrySelectionControls( Composite parent) { final Label accountLabel = new Label(parent, SWT.NULL); accountLabel.setText(WizardMessages .getString("ImagePullPushPage.registry.account.label")); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER) .grab(false, false).applyTo(accountLabel); final Combo registryAccountCombo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY); registryAccountCombo.setToolTipText(WizardMessages .getString("ImagePullPushPage.registry.account.desc")); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER) .grab(true, false).applyTo(registryAccountCombo); final ComboViewer registryAccountComboViewer = new ComboViewer( registryAccountCombo); registryAccountComboViewer .setContentProvider(ArrayContentProvider.getInstance()); registryAccountComboViewer .setLabelProvider(new RegistryAccountLabelProvider()); final List<IRegistry> allRegistryAccounts = getRegistryAccounts(); final IPreferenceStore store = Activator.getDefault() .getPreferenceStore(); IRegistry defaultRegistry = null; String lastRegistry = store .getString(PreferenceConstants.LAST_REGISTRY_ACCOUNT); if (!allRegistryAccounts.isEmpty()) { defaultRegistry = allRegistryAccounts.get(0); } IRegistry selectedRegistry = allRegistryAccounts.stream() .filter(x -> x.toString().equals(lastRegistry)).findFirst() .orElse(defaultRegistry); registryAccountComboViewer.setInput(allRegistryAccounts); if (selectedRegistry != null) { getModel().setSelectedRegistry(selectedRegistry); } final IObservableValue<IRegistry> registryAccountObservable = BeanProperties .value(ImagePushPageModel.class, ImagePullPushPageModel.SELECTED_REGISTRY) .observe(model); dbc.bindValue(ViewerProperties.singleSelection().observe( registryAccountComboViewer), registryAccountObservable); final Link addRegistryLink = new Link(parent, SWT.NONE); addRegistryLink.setText( WizardMessages.getString("ImagePullPushPage.add.link")); GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER) .grab(false, false).applyTo(addRegistryLink); addRegistryLink.addSelectionListener( onAddRegistry(registryAccountComboViewer)); return registryAccountObservable; }