use of org.jboss.tools.openshift.internal.common.ui.connection.ConnectionWizard in project jbosstools-openshift by jbosstools.
the class NewConnectionHandler method execute.
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
final ConnectionWizard connectionWizard = new ConnectionWizard((IConnection) null);
WizardUtils.openWizardDialog(connectionWizard, HandlerUtil.getActiveShell(event));
return Status.OK_STATUS;
}
use of org.jboss.tools.openshift.internal.common.ui.connection.ConnectionWizard in project jbosstools-openshift by jbosstools.
the class OpenShiftExplorerView method onExplanationClicked.
private SelectionAdapter onExplanationClicked(final Control connectionsPane, final Control explanationPane) {
return new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
ConnectionWizard wizard = new ConnectionWizard();
WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getModalDialogShellProvider().getShell(), wizard);
if (dialog.open() == Window.OK) {
showConnectionsOrExplanations(connectionsPane, explanationPane);
}
}
};
}
use of org.jboss.tools.openshift.internal.common.ui.connection.ConnectionWizard in project jbosstools-openshift by jbosstools.
the class ChooseOpenshiftConnectionComposite method createComposite.
public Composite createComposite(Composite main) {
main.setLayout(new GridLayout(5, true));
GridData gd = new GridData();
gd.grabExcessHorizontalSpace = true;
main.setLayoutData(gd);
Label connLabel = new Label(main, SWT.NONE);
connLabel.setText("Connection: ");
connectionCombo = new Combo(main, SWT.READ_ONLY);
GridDataFactory.fillDefaults().span(3, 1).applyTo(connectionCombo);
Composite btnWrapper = new Composite(main, SWT.NONE);
btnWrapper.setLayout(new FillLayout());
Button editConBtn = new Button(btnWrapper, SWT.PUSH);
editConBtn.setText("Edit...");
Button addConBtn = new Button(btnWrapper, SWT.PUSH);
addConBtn.setText("New...");
GridDataFactory.fillDefaults().applyTo(btnWrapper);
addConBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
final ConnectionWizard connectionWizard = new ConnectionWizard((IConnection) null);
int ret = WizardUtils.openWizardDialog(connectionWizard, addConBtn.getShell());
if (ret == Window.OK) {
refreshConnections();
IConnection c = connectionWizard.getConnection();
int ind = connections.indexOf(c);
if (ind != -1) {
connectionCombo.select(ind);
}
}
}
});
editConBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
final ConnectionWizard connectionWizard = new ConnectionWizard(selectedConnection, ConnectionWizard.EDIT_CONNECTION_TITLE);
WizardUtils.openWizardDialog(connectionWizard, editConBtn.getShell());
refreshConnections();
IConnection c = connectionWizard.getConnection();
int ind = connections.indexOf(c);
if (ind != -1) {
connectionCombo.select(ind);
setSelectedConnection(c);
}
}
});
Label serverLbl = new Label(main, SWT.NONE);
serverLbl.setText("Server: ");
serverValueLbl = new Label(main, SWT.NONE);
GridDataFactory.fillDefaults().span(4, 1).applyTo(serverValueLbl);
Group authGroup = new Group(main, SWT.NONE);
authGroup.setText("Authentication");
GridDataFactory.fillDefaults().span(5, 1).indent(0, 5).applyTo(authGroup);
authGroup.setLayout(new GridLayout(6, true));
Label protocolLbl = new Label(authGroup, SWT.NONE);
protocolLbl.setText("Protocol: ");
protocolValLbl = new Label(authGroup, SWT.NONE);
GridDataFactory.fillDefaults().span(5, 1).applyTo(protocolValLbl);
userLbl = new Label(authGroup, SWT.NONE);
userLbl.setText("Username: ");
usernameValLbl = new Label(authGroup, SWT.NONE);
GridDataFactory.fillDefaults().span(5, 1).applyTo(usernameValLbl);
Group advancedGroup = new Group(main, SWT.NONE);
advancedGroup.setText("Advanced");
GridDataFactory.fillDefaults().span(5, 1).indent(0, 5).applyTo(advancedGroup);
advancedGroup.setLayout(new GridLayout(6, true));
Label imageRegistryLbl = new Label(advancedGroup, SWT.NONE);
imageRegistryLbl.setText("Image Registry URL: ");
imageRegistryValLbl = new Label(advancedGroup, SWT.NONE);
GridDataFactory.fillDefaults().span(5, 1).applyTo(imageRegistryValLbl);
Label clusterNamespaceLbl = new Label(advancedGroup, SWT.NONE);
clusterNamespaceLbl.setText("Cluster namespace: ");
clusterNamespaceValLbl = new Label(advancedGroup, SWT.NONE);
GridDataFactory.fillDefaults().span(5, 1).applyTo(clusterNamespaceValLbl);
Label ocLocationLbl = new Label(advancedGroup, SWT.NONE);
ocLocationLbl.setText("OC Binary Location: ");
ocLocationValLbl = new Label(advancedGroup, SWT.NONE);
ocLocationDecorator = new ControlDecoration(ocLocationValLbl, SWT.TOP | SWT.LEFT);
GridDataFactory.fillDefaults().span(5, 1).applyTo(ocLocationValLbl);
// Load the model
refreshConnections();
connectionCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
int selIndex = connectionCombo.getSelectionIndex();
if (selIndex != -1 && selIndex < connections.size()) {
setSelectedConnection(connections.get(selIndex));
}
editConBtn.setEnabled(selIndex != -1);
}
});
if (connectionCombo.getItemCount() > 0) {
connectionCombo.select(0);
setSelectedConnection(connections.get(0));
}
int selIndex = connectionCombo.getSelectionIndex();
editConBtn.setEnabled(selIndex != -1);
return main;
}
use of org.jboss.tools.openshift.internal.common.ui.connection.ConnectionWizard in project jbosstools-openshift by jbosstools.
the class EditConnectionHandler method openConnectionWizard.
protected Object openConnectionWizard(IConnection connection, ExecutionEvent event) {
final IWizard connectToOpenShiftWizard = new ConnectionWizard(connection, ConnectionWizard.EDIT_CONNECTION_TITLE);
WizardUtils.openWizardDialog(connectToOpenShiftWizard, HandlerUtil.getActiveShell(event));
return Status.OK_STATUS;
}
Aggregations