use of org.jboss.tools.openshift.internal.ui.validator.OpenShiftIdentifierValidator in project jbosstools-openshift by jbosstools.
the class ServerSettingsWizardPage method createEnableDebuggingControls.
@SuppressWarnings("unchecked")
private void createEnableDebuggingControls(Composite parent, ServerSettingsWizardPageModel model, DataBindingContext dbc) {
Label enableDevmodeLabel = new Label(parent, SWT.None);
enableDevmodeLabel.setText("Enable debugging:");
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(enableDevmodeLabel);
Button useImageDevmodeKey = new Button(parent, SWT.CHECK);
useImageDevmodeKey.setText("use image provided key");
GridDataFactory.fillDefaults().span(4, 1).align(SWT.FILL, SWT.CENTER).applyTo(useImageDevmodeKey);
IObservableValue<Boolean> useImageDevmodeKeyObservable = BeanProperties.value(OpenShiftServerEditorModel.PROPERTY_USE_IMAGE_DEVMODE_KEY).observe(model);
ValueBindingBuilder.bind(WidgetProperties.selection().observe(useImageDevmodeKey)).to(useImageDevmodeKeyObservable).in(dbc);
// filler
new Label(parent, SWT.NONE);
Label keyLabel = new Label(parent, SWT.NONE);
keyLabel.setText("Key:");
GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).applyTo(keyLabel);
Text devmodeKeyText = new Text(parent, SWT.BORDER);
GridDataFactory.fillDefaults().span(3, 1).align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(devmodeKeyText);
IObservableValue<String> devmodeKeyObservable = WidgetProperties.text(SWT.Modify).observe(devmodeKeyText);
ValueBindingBuilder.bind(devmodeKeyObservable).to(BeanProperties.value(OpenShiftServerEditorModel.PROPERTY_DEVMODE_KEY).observe(model)).in(dbc);
ValueBindingBuilder.bind(WidgetProperties.enabled().observe(devmodeKeyText)).notUpdating(useImageDevmodeKeyObservable).converting(new InvertingBooleanConverter()).in(dbc);
ValidationStatusProvider devmodeKeyValidator = new DisableableMultiValitdator<String>(useImageDevmodeKeyObservable, devmodeKeyObservable, new OpenShiftIdentifierValidator());
dbc.addValidationStatusProvider(devmodeKeyValidator);
ControlDecorationSupport.create(devmodeKeyValidator, SWT.LEFT | SWT.TOP, null, new RequiredControlDecorationUpdater(true));
}
use of org.jboss.tools.openshift.internal.ui.validator.OpenShiftIdentifierValidator in project jbosstools-openshift by jbosstools.
the class OpenShiftServerEditorSection method createDebuggingPortControls.
@SuppressWarnings("unchecked")
private void createDebuggingPortControls(FormToolkit toolkit, Composite container, DataBindingContext dbc) {
Label debugPortLabel = new Label(container, SWT.None);
debugPortLabel.setText("Debugging Port:");
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(debugPortLabel);
// use image key & value checkbox
useImageDebugPortKeyButton = new Button(container, SWT.CHECK);
useImageDebugPortKeyButton.setText("use image provided key and value");
GridDataFactory.fillDefaults().span(4, 1).align(SWT.FILL, SWT.CENTER).applyTo(useImageDebugPortKeyButton);
// port key field
// filler
new Label(container, SWT.NONE);
Label keyLabel = new Label(container, SWT.NONE);
keyLabel.setText("Key:");
GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).applyTo(keyLabel);
debugPortKeyText = new Text(container, SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(debugPortKeyText);
debugPortKeyListener = new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
execute(new ServerWorkingCopyPropertyTextCommand(input.getServer(), "SetDebugPortKey", debugPortKeyText, debugPortKeyText.getText(), OpenShiftServerUtils.ATTR_DEBUG_PORT_KEY, (ModifyListener) this));
}
};
ModifyListener debugPortKeyDecoration = new TextboxDecoratorSupport(debugPortKeyText, value -> {
if (!useImageDebugPortKeyButton.getSelection()) {
return new OpenShiftIdentifierValidator().validate(debugPortKeyText.getText());
}
return Status.OK_STATUS;
});
debugPortKeyText.addModifyListener(debugPortKeyDecoration);
// port value field
Label portLabel = new Label(container, SWT.NONE);
portLabel.setText("Port:");
GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).applyTo(portLabel);
debugPortText = new Text(container, SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(debugPortText);
debugPortValListener = new ModifyListener() {
public void modifyText(ModifyEvent e) {
execute(new ServerWorkingCopyPropertyTextCommand(input.getServer(), "SetDebugPortValue", debugPortText, debugPortText.getText(), OpenShiftServerUtils.ATTR_DEBUG_PORT_VALUE, this));
}
};
ModifyListener debugPortValDecoration = new TextboxDecoratorSupport(debugPortText, value -> {
if (!useImageDebugPortKeyButton.getSelection()) {
return new NumericValidator("integer", Integer::parseInt, true).validate(debugPortText.getText());
}
return Status.OK_STATUS;
});
debugPortText.addModifyListener(debugPortValDecoration);
debugPortKeyValSelectionListener = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
execute(new ToggleDebugKeyValueCommand(server, useImageDebugPortKeyButton, this, debugPortKeyText, debugPortKeyListener, debugPortText, debugPortValListener));
}
};
}
use of org.jboss.tools.openshift.internal.ui.validator.OpenShiftIdentifierValidator in project jbosstools-openshift by jbosstools.
the class OpenShiftServerEditorSection method createEnableDebuggingControls.
@SuppressWarnings("unchecked")
private void createEnableDebuggingControls(FormToolkit toolkit, Composite container, DataBindingContext dbc) {
Label enableDevmodeLabel = new Label(container, SWT.None);
enableDevmodeLabel.setText("Enable debugging:");
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(enableDevmodeLabel);
useImageDevmodeKeyButton = toolkit.createButton(container, "use image provided key", SWT.CHECK);
GridDataFactory.fillDefaults().span(4, 1).align(SWT.FILL, SWT.CENTER).applyTo(useImageDevmodeKeyButton);
// filler
new Label(container, SWT.NONE);
Label keyLabel = new Label(container, SWT.NONE);
keyLabel.setText("Key:");
GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).applyTo(keyLabel);
devmodeKeyText = new Text(container, SWT.BORDER);
GridDataFactory.fillDefaults().span(3, 1).align(SWT.FILL, SWT.CENTER).applyTo(devmodeKeyText);
devmodeKeyModifyListener = new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
execute(new ServerWorkingCopyPropertyTextCommand(input.getServer(), "SetDevmodeKey", devmodeKeyText, devmodeKeyText.getText(), OpenShiftServerUtils.ATTR_DEVMODE_KEY, (ModifyListener) this));
}
};
ModifyListener devmodeKeyModifyDecoration = new TextboxDecoratorSupport(devmodeKeyText, value -> {
if (!useImageDevmodeKeyButton.getSelection()) {
return new OpenShiftIdentifierValidator().validate(devmodeKeyText.getText());
}
return Status.OK_STATUS;
});
devmodeKeyText.addModifyListener(devmodeKeyModifyDecoration);
useImageDevmodeKeyListener = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
execute(new ToggleDebuggingCommand(input.getServer(), useImageDevmodeKeyButton, devmodeKeyText, this, devmodeKeyModifyListener));
}
};
}
use of org.jboss.tools.openshift.internal.ui.validator.OpenShiftIdentifierValidator in project jbosstools-openshift by jbosstools.
the class ServerSettingsWizardPage method createDebuggingPortControls.
@SuppressWarnings("unchecked")
private void createDebuggingPortControls(Composite parent, ServerSettingsWizardPageModel model, DataBindingContext dbc) {
Label debugPortLabel = new Label(parent, SWT.None);
debugPortLabel.setText("Debugging Port:");
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(debugPortLabel);
// use image key & value checkbox
Button useImageDebugPortKeyButton = new Button(parent, SWT.CHECK);
useImageDebugPortKeyButton.setText("use image provided key and value");
GridDataFactory.fillDefaults().span(3, 1).align(SWT.FILL, SWT.CENTER).applyTo(useImageDebugPortKeyButton);
IObservableValue<Boolean> useImageDebugPortKey = BeanProperties.value(OpenShiftServerEditorModel.PROPERTY_USE_IMAGE_DEBUG_PORT_KEY).observe(model);
ValueBindingBuilder.bind(WidgetProperties.selection().observe(useImageDebugPortKeyButton)).to(useImageDebugPortKey).in(dbc);
// filler
new Label(parent, SWT.NONE);
// key text field
// filler
new Label(parent, SWT.NONE);
Label keyLabel = new Label(parent, SWT.NONE);
keyLabel.setText("Key:");
GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).applyTo(keyLabel);
Text debugPortKeyText = new Text(parent, SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(debugPortKeyText);
IObservableValue<String> debugPortKeyTextObservable = WidgetProperties.text(SWT.Modify).observe(debugPortKeyText);
ValueBindingBuilder.bind(debugPortKeyTextObservable).to(BeanProperties.value(OpenShiftServerEditorModel.PROPERTY_DEBUG_PORT_KEY).observe(model)).in(dbc);
ValueBindingBuilder.bind(WidgetProperties.enabled().observe(debugPortKeyText)).notUpdating(useImageDebugPortKey).converting(new InvertingBooleanConverter()).in(dbc);
ValidationStatusProvider debugPortKeyValidator = new DisableableMultiValitdator<String>(useImageDebugPortKey, debugPortKeyTextObservable, new OpenShiftIdentifierValidator());
dbc.addValidationStatusProvider(debugPortKeyValidator);
ControlDecorationSupport.create(debugPortKeyValidator, SWT.LEFT | SWT.TOP, parent, new RequiredControlDecorationUpdater(true));
// port text field
IObservableValue<Boolean> useImageDebugPortValue = BeanProperties.value(OpenShiftServerEditorModel.PROPERTY_USE_IMAGE_DEBUG_PORT_VALUE).observe(model);
ValueBindingBuilder.bind(WidgetProperties.selection().observe(useImageDebugPortKeyButton)).to(useImageDebugPortValue).in(dbc);
Label portLabel = new Label(parent, SWT.NONE);
portLabel.setText("Port:");
GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).applyTo(portLabel);
Text debugPortText = new Text(parent, SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(debugPortText);
IObservableValue<String> debugPortValueObservable = WidgetProperties.text(SWT.Modify).observe(debugPortText);
ValueBindingBuilder.bind(debugPortValueObservable).to(BeanProperties.value(OpenShiftServerEditorModel.PROPERTY_DEBUG_PORT_VALUE).observe(model)).in(dbc);
ValueBindingBuilder.bind(WidgetProperties.enabled().observe(debugPortText)).notUpdating(useImageDebugPortValue).converting(new InvertingBooleanConverter()).in(dbc);
ValidationStatusProvider debugPortValueValidator = new DisableableMultiValitdator<String>(useImageDebugPortValue, debugPortValueObservable, new NumericValidator("integer", Integer::parseInt, true));
dbc.addValidationStatusProvider(debugPortValueValidator);
ControlDecorationSupport.create(debugPortValueValidator, SWT.LEFT | SWT.TOP, parent, new RequiredControlDecorationUpdater(true));
}
Aggregations