use of org.jboss.tools.openshift.common.core.connection.IConnection in project jbosstools-openshift by jbosstools.
the class AdvancedConnectionEditor method discoverRegistryPressed.
private void discoverRegistryPressed(Shell shell) {
IConnection tmp = pageModel.createConnection();
IStatus ret = RegistryProviderModel.getDefault().getRegistryURL(tmp);
String oldVal = (String) registryURLObservable.getValue();
String newVal = ret.getMessage();
if (ret != null && ret.isOK()) {
// If they're equal, do nothing
if (!eq(oldVal, newVal)) {
// Verify with user
String title = "Overwrite registry URL?";
String msg = "Are you sure you want to change the registry URL from " + oldVal + " to " + newVal + "?";
MessageDialog dialog = new MessageDialog(shell, title, null, msg, MessageDialog.CONFIRM, new String[] { "OK", "Cancel" }, 0);
String old = registryURLObservable.getValue().toString().trim();
if (old.isEmpty() || dialog.open() == IDialogConstants.OK_ID) {
registryURLObservable.setValue(ret.getMessage());
}
}
} else {
String title = "Registry URL not found";
String msg = "No registry provider found for the given connection. If your Openshift connection is backed by a CDK or minishift installation, please ensure the CDK is running.";
ErrorDialog ed = new ErrorDialog(shell, title, msg, ret, IStatus.ERROR | IStatus.WARNING | IStatus.INFO | IStatus.CANCEL);
ed.open();
}
}
use of org.jboss.tools.openshift.common.core.connection.IConnection in project jbosstools-openshift by jbosstools.
the class OAuthDetailView method setSelectedConnection.
@Override
public void setSelectedConnection(IConnection selectedConnection) {
if (selectedConnection instanceof Connection) {
Connection connection = (Connection) selectedConnection;
tokenObservable.setValue(connection.getToken());
rememberTokenObservable.setValue(connection.isRememberToken());
} else if (selectedConnection instanceof NewConnectionMarker) {
tokenObservable.setValue(null);
rememberTokenObservable.setValue(Boolean.FALSE);
}
}
use of org.jboss.tools.openshift.common.core.connection.IConnection in project jbosstools-openshift by jbosstools.
the class DeployImagePage method createOpenShiftConnectionControl.
private void createOpenShiftConnectionControl(Composite parent, DataBindingContext dbc) {
Label lblConnection = new Label(parent, SWT.NONE);
lblConnection.setText("OpenShift Connection: ");
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(lblConnection);
final Text connectionText = new Text(parent, SWT.READ_ONLY | SWT.NO_FOCUS);
connectionText.setBackground(lblConnection.getBackground());
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(NUM_COLUMS - 1, 1).grab(true, false).applyTo(connectionText);
final IObservableValue<String> connnectionTextObservable = WidgetProperties.text(SWT.None).observe(connectionText);
final IObservableValue<IConnection> connnectionObservable = BeanProperties.value(IDeployImagePageModel.PROPERTY_CONNECTION).observe(model);
ValueBindingBuilder.bind(connnectionTextObservable).notUpdatingParticipant().to(connnectionObservable).converting(new ObjectToStringConverter(Connection.class) {
ConnectionColumLabelProvider labelProvider = new ConnectionColumLabelProvider();
@Override
public Object convert(Object source) {
return source == null ? "" : labelProvider.getText(source);
}
}).in(dbc);
}
use of org.jboss.tools.openshift.common.core.connection.IConnection in project jbosstools-openshift by jbosstools.
the class ServerResourceViewModelWithReplicationControllerTest method shouldReturnConnection.
@Test
public void shouldReturnConnection() {
// given
// when
IConnection connection = model.getConnection();
// then
assertThat(connection).isEqualTo(this.connection);
}
use of org.jboss.tools.openshift.common.core.connection.IConnection in project jbosstools-openshift by jbosstools.
the class ServerResourceViewModelWithServiceTest method shouldReturnConnection.
@Test
public void shouldReturnConnection() {
// given
// when
IConnection connection = model.getConnection();
// then
assertThat(connection).isEqualTo(this.connection);
}
Aggregations