use of org.eclipse.linuxtools.internal.docker.core.RegistryInfo in project linuxtools by eclipse.
the class RunImageMainTab method onSearchImage.
private SelectionListener onSearchImage() {
return SelectionListener.widgetSelectedAdapter(e -> {
final ImageSearch imageSearchWizard = new ImageSearch(RunImageMainTab.this.model.getSelectedConnection(), RunImageMainTab.this.model.getSelectedImageName(), new RegistryInfo(AbstractRegistry.DOCKERHUB_REGISTRY, true));
final boolean completed = CommandUtils.openWizard(imageSearchWizard, getShell());
if (completed) {
model.setSelectedImageName(imageSearchWizard.getSelectedImage());
}
});
}
use of org.eclipse.linuxtools.internal.docker.core.RegistryInfo in project linuxtools by eclipse.
the class ImagePullPushPage method getRegistryAccounts.
/**
* @return all existing {@link IRegistryAccount} plus an entry at the first
* position for the registry configured in the selected Docker
* daemon.
*/
protected List<IRegistry> getRegistryAccounts() {
// get a local copy an insert an entry at the first position for Docker
// Hub with no credentials
final List<IRegistry> accounts = new ArrayList<>(RegistryAccountManager.getInstance().getAccounts());
accounts.add(0, new RegistryInfo(DOCKER_DAEMON_DEFAULT, true));
return accounts;
}
use of org.eclipse.linuxtools.internal.docker.core.RegistryInfo in project linuxtools by eclipse.
the class ImagePullPushPage method createRegistrySelectionControls.
@SuppressWarnings("unchecked")
IObservableValue<IRegistry> createRegistrySelectionControls(Composite parent) {
// registry selection
final Label accountLabel = new Label(parent, SWT.NULL);
accountLabel.setText(WizardMessages.getString(// $NON-NLS-1$
"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(// $NON-NLS-1$
"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();
// Calculate selected registry account to be the last one used
// or else default to the first in the list
IRegistry defaultRegistry = null;
String lastRegistry = store.getString(PreferenceConstants.LAST_REGISTRY_ACCOUNT);
if (!allRegistryAccounts.isEmpty()) {
defaultRegistry = allRegistryAccounts.get(0);
}
IRegistry selectedRegistry = allRegistryAccounts.stream().filter(x -> ((RegistryInfo) x).getRegistryId().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);
// link to add registries and accounts
final Link addRegistryLink = new Link(parent, SWT.NONE);
addRegistryLink.setText(// $NON-NLS-1$
WizardMessages.getString("ImagePullPushPage.add.link"));
GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).grab(false, false).applyTo(addRegistryLink);
addRegistryLink.addSelectionListener(onAddRegistry(registryAccountComboViewer));
return registryAccountObservable;
}
use of org.eclipse.linuxtools.internal.docker.core.RegistryInfo in project linuxtools by eclipse.
the class ImageRunSelectionPage method onSearchImage.
private SelectionListener onSearchImage() {
return SelectionListener.widgetSelectedAdapter(e -> {
final ImageSearch imageSearchWizard = new ImageSearch(ImageRunSelectionPage.this.model.getSelectedConnection(), ImageRunSelectionPage.this.model.getSelectedImageName(), new RegistryInfo(AbstractRegistry.DOCKERHUB_REGISTRY, true));
final boolean completed = CommandUtils.openWizard(imageSearchWizard, getShell());
if (completed) {
model.setSelectedImageName(imageSearchWizard.getSelectedImage());
}
});
}
Aggregations