Ejemplo n.º 1
0
 @SuppressWarnings("unchecked")
 private IObservableValue<String> createImageSelectionControls(final Composite container) {
   final Label nameLabel = new Label(container, SWT.NULL);
   nameLabel.setText(WizardMessages.getString("ImagePullPushPage.name.label")); // $NON-NLS-1$
   GridDataFactory.fillDefaults()
       .align(SWT.FILL, SWT.CENTER)
       .grab(false, false)
       .applyTo(nameLabel);
   final Combo imageNameCombo = new Combo(container, SWT.DROP_DOWN);
   imageNameCombo.setToolTipText(WizardMessages.getString("ImagePushName.toolTip")); // $NON-NLS-1$
   GridDataFactory.fillDefaults()
       .align(SWT.FILL, SWT.CENTER)
       .grab(true, false)
       .applyTo(imageNameCombo);
   final ComboViewer imageNameComboViewer = new ComboViewer(imageNameCombo);
   imageNameComboViewer.setContentProvider(new ArrayContentProvider());
   imageNameComboViewer.setInput(getModel().getImage().repoTags());
   // binding must take place after the input is set, so that default
   // repo/name can be selected.
   final IObservableValue<String> imageNameObservable =
       BeanProperties.value(ImagePushPageModel.class, ImagePullPushPageModel.SELECTED_IMAGE_NAME)
           .observe(getModel());
   dbc.bindValue(WidgetProperties.selection().observe(imageNameCombo), imageNameObservable);
   // filler for the last column
   GridDataFactory.fillDefaults()
       .align(SWT.FILL, SWT.CENTER)
       .grab(false, false)
       .applyTo(new Label(container, SWT.NONE));
   return imageNameObservable;
 }
Ejemplo n.º 2
0
  @SuppressWarnings("unchecked")
  @Override
  public void createControl(final Composite parent) {
    parent.setLayout(new GridLayout());
    final Composite container = new Composite(parent, SWT.NONE);
    GridLayoutFactory.fillDefaults().numColumns(3).margins(6, 6).applyTo(container);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(container);

    // registry selection
    final IObservableValue<IRegistry> registryAccountObservable =
        super.createRegistrySelectionControls(container);
    // image selection
    final IObservableValue<String> imageNameObservable = createImageSelectionControls(container);

    // force tagging
    final Button forceTaggingButton = new Button(container, SWT.CHECK);
    forceTaggingButton.setText(
        WizardMessages.getString("ImagePushPage.forcetagging.label")); // $NON-NLS-1$ );
    GridDataFactory.fillDefaults()
        .align(SWT.FILL, SWT.CENTER)
        .grab(true, false)
        .span(2, 1)
        .applyTo(forceTaggingButton);
    dbc.bindValue(
        WidgetProperties.selection().observe(forceTaggingButton),
        BeanProperties.value(ImagePushPageModel.class, ImagePushPageModel.FORCE_TAGGING)
            .observe(getModel()));

    // keep tagged image upon completion
    final Button keepTaggedImageButton = new Button(container, SWT.CHECK);
    keepTaggedImageButton.setText(
        WizardMessages.getString("ImagePushPage.keeptaggedimage.label")); // $NON-NLS-1$ );
    GridDataFactory.fillDefaults()
        .align(SWT.FILL, SWT.CENTER)
        .grab(true, false)
        .span(2, 1)
        .applyTo(keepTaggedImageButton);
    dbc.bindValue(
        WidgetProperties.selection().observe(keepTaggedImageButton),
        BeanProperties.value(ImagePushPageModel.class, ImagePushPageModel.KEEP_TAGGED_IMAGE)
            .observe(getModel()));

    // setup validation support
    WizardPageSupport.create(this, dbc);
    dbc.addValidationStatusProvider(
        getModel().new ImagePushValidator(imageNameObservable, registryAccountObservable));
    setControl(container);
  }
Ejemplo n.º 3
0
 /**
  * Constructor
  *
  * @param image the {@link IDockerImage} to push.
  * @param selectedImageName the default image name/tag
  */
 public ImagePushPage(final IDockerImage image, final String selectedImageName) {
   super(
       WizardMessages.getString("ImagePush.name"), // $NON-NLS-1$
       WizardMessages.getString("ImagePush.title"), // $NON-NLS-1$
       new ImagePushPageModel(image, selectedImageName));
 }