use of org.jboss.tools.openshift.common.core.connection.IConnection in project jbosstools-openshift by jbosstools.
the class SelectRouteDialog method createMessage.
private String createMessage(List<IRoute> routes) {
StringBuilder message = new StringBuilder();
if (!routes.isEmpty()) {
IRoute route = routes.get(0);
IConnection connection = ConnectionsRegistryUtil.safeGetConnectionFor(route);
if (connection != null) {
message.append("Server: ").append(connection.getUsername()).append(" ").append(connection.getHost()).append(StringUtils.getLineSeparator());
}
message.append("Project: ").append(route.getNamespaceName()).append(StringUtils.getLineSeparator());
// Add more space between server/project info and instruction.
message.append(StringUtils.getLineSeparator());
}
message.append("Select the route to open in a browser.");
return message.toString();
}
use of org.jboss.tools.openshift.common.core.connection.IConnection in project jbosstools-openshift by jbosstools.
the class ChooseOpenshiftConnectionFragment method selectedConnectionChanged.
private void selectedConnectionChanged(IConnection newVal) {
IConnection oldCon = selectedConnection;
selectedConnection = newVal;
setComplete(selectedConnection != null);
handle.update();
if (externalConnectionListener != null) {
// re-fire event to external listener
PropertyChangeEvent event = new PropertyChangeEvent(this, ConnectionWizardPageModel.PROPERTY_SELECTED_CONNECTION, oldCon, selectedConnection);
externalConnectionListener.propertyChange(event);
}
}
use of org.jboss.tools.openshift.common.core.connection.IConnection in project jbosstools-openshift by jbosstools.
the class ConnectionRegistryTest method shouldSetRecentConnectionToLatestAddition.
@Test
public void shouldSetRecentConnectionToLatestAddition() {
// pre-conditions
IConnection recentConnection = registry.getRecentConnection();
// operations
registry.add(connection);
// verifications
assertTrue(recentConnection == null || !recentConnection.equals(connection));
assertEquals(connection, registry.getRecentConnection());
}
use of org.jboss.tools.openshift.common.core.connection.IConnection in project jbosstools-openshift by jbosstools.
the class ConnectionRegistryTest method shouldResetRecentConnectionOnRemoval.
@Test
public void shouldResetRecentConnectionOnRemoval() {
// pre-conditions
registry.add(connection);
// operations
registry.remove(connection);
// verifications
IConnection recentConnection = registry.getRecentConnection();
assertEquals(null, recentConnection);
}
use of org.jboss.tools.openshift.common.core.connection.IConnection in project jbosstools-openshift by jbosstools.
the class ConnectionRegistryTest method shouldGetConnectionByUrl.
@Test
public void shouldGetConnectionByUrl() throws UnsupportedEncodingException, MalformedURLException {
// pre-conditions
registry.add(connection);
// operations
ConnectionURL connectionUrl = ConnectionURL.forConnection(connection);
IConnection queriedConnection = registry.getByUrl(connectionUrl);
// verifications
assertEquals(connection, queriedConnection);
}
Aggregations