Search in sources :

Example 6 with OkCancelButtonWizardDialog

use of org.jboss.tools.openshift.internal.common.ui.wizard.OkCancelButtonWizardDialog in project jbosstools-openshift by jbosstools.

the class ResourceLabelsPage method onAdd.

private SelectionListener onAdd() {
    return new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            IKeyValueWizardModel<Label> dialogModel = new KeyValueWizardModelBuilder<Label>().windowTitle(RESOURCE_LABEL).title("Add Label").description("Add a resource label.").keyLabel(LABEL_KEY).keyDescription(LabelKeyValidator.keyDescription).valueDescription(NLS.bind(LabelValueValidator.valueDescription, LabelValueValidator.defaultType)).groupLabel(LABEL_GROUP).keyAfterConvertValidator(new LabelKeyValidator(model.getReadOnlyLabels(), getUsedKeys())).valueAfterConvertValidator(new LabelValueValidator()).build();
            OkCancelButtonWizardDialog dialog = new OkCancelButtonWizardDialog(getShell(), new KeyValueWizard<>(UIUtils.getFirstElement(viewer.getSelection(), Label.class), dialogModel));
            if (OkCancelButtonWizardDialog.OK == dialog.open()) {
                model.addLabel(dialogModel.getKey(), dialogModel.getValue());
            }
        }
    };
}
Also used : KeyValueWizardModelBuilder(org.jboss.tools.openshift.internal.common.ui.wizard.KeyValueWizardModelBuilder) LabelValueValidator(org.jboss.tools.openshift.internal.ui.validator.LabelValueValidator) LabelKeyValidator(org.jboss.tools.openshift.internal.ui.validator.LabelKeyValidator) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Label(org.jboss.tools.openshift.internal.ui.wizard.common.IResourceLabelsPageModel.Label) OkCancelButtonWizardDialog(org.jboss.tools.openshift.internal.common.ui.wizard.OkCancelButtonWizardDialog)

Example 7 with OkCancelButtonWizardDialog

use of org.jboss.tools.openshift.internal.common.ui.wizard.OkCancelButtonWizardDialog in project jbosstools-openshift by jbosstools.

the class ResourceLabelsPage method editLabel.

private void editLabel(Label label) {
    if (label == null || isReadOnly(label)) {
        return;
    }
    Set<String> usedKeys = getUsedKeys();
    usedKeys.remove(label.getKey());
    IKeyValueWizardModel<Label> dialogModel = new KeyValueWizardModelBuilder<>(label).windowTitle(RESOURCE_LABEL).title("Edit Label").description("Edit the resource label.").keyLabel(LABEL_KEY).keyDescription(LabelKeyValidator.keyDescription).valueDescription(NLS.bind(LabelValueValidator.valueDescription, LabelValueValidator.defaultType)).groupLabel(LABEL_GROUP).keyAfterConvertValidator(new LabelKeyValidator(model.getReadOnlyLabels(), usedKeys)).valueAfterConvertValidator(new LabelValueValidator()).build();
    OkCancelButtonWizardDialog dialog = new OkCancelButtonWizardDialog(getShell(), new KeyValueWizard<>(label, dialogModel));
    if (OkCancelButtonWizardDialog.OK == dialog.open()) {
        model.updateLabel(label, dialogModel.getKey(), dialogModel.getValue());
    }
}
Also used : KeyValueWizardModelBuilder(org.jboss.tools.openshift.internal.common.ui.wizard.KeyValueWizardModelBuilder) LabelValueValidator(org.jboss.tools.openshift.internal.ui.validator.LabelValueValidator) LabelKeyValidator(org.jboss.tools.openshift.internal.ui.validator.LabelKeyValidator) Label(org.jboss.tools.openshift.internal.ui.wizard.common.IResourceLabelsPageModel.Label) StyledString(org.eclipse.jface.viewers.StyledString) OkCancelButtonWizardDialog(org.jboss.tools.openshift.internal.common.ui.wizard.OkCancelButtonWizardDialog)

Example 8 with OkCancelButtonWizardDialog

use of org.jboss.tools.openshift.internal.common.ui.wizard.OkCancelButtonWizardDialog in project jbosstools-openshift by jbosstools.

the class EditResourceLimitsHandler method editResources.

protected void editResources(Shell shell, IReplicationController rc, String name) {
    EditResourceLimitsPageModel model = new EditResourceLimitsPageModel(rc);
    EditResourceLimitsWizard wizard = new EditResourceLimitsWizard(model, "Edit resource limits");
    new OkCancelButtonWizardDialog(shell, wizard).open();
}
Also used : OkCancelButtonWizardDialog(org.jboss.tools.openshift.internal.common.ui.wizard.OkCancelButtonWizardDialog)

Aggregations

OkCancelButtonWizardDialog (org.jboss.tools.openshift.internal.common.ui.wizard.OkCancelButtonWizardDialog)8 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)3 SelectionEvent (org.eclipse.swt.events.SelectionEvent)3 KeyValueWizardModelBuilder (org.jboss.tools.openshift.internal.common.ui.wizard.KeyValueWizardModelBuilder)3 ObservableListContentProvider (org.eclipse.jface.databinding.viewers.ObservableListContentProvider)2 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)2 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)2 TableViewer (org.eclipse.jface.viewers.TableViewer)2 Viewer (org.eclipse.jface.viewers.Viewer)2 Label (org.eclipse.swt.widgets.Label)2 Table (org.eclipse.swt.widgets.Table)2 LabelKeyValidator (org.jboss.tools.openshift.internal.ui.validator.LabelKeyValidator)2 LabelValueValidator (org.jboss.tools.openshift.internal.ui.validator.LabelValueValidator)2 Label (org.jboss.tools.openshift.internal.ui.wizard.common.IResourceLabelsPageModel.Label)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 List (java.util.List)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 DataBindingContext (org.eclipse.core.databinding.DataBindingContext)1 BeanProperties (org.eclipse.core.databinding.beans.BeanProperties)1