Search in sources :

Example 1 with ConnectionWizard

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;
}
Also used : ConnectionWizard(org.jboss.tools.openshift.internal.common.ui.connection.ConnectionWizard)

Example 2 with ConnectionWizard

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);
            }
        }
    };
}
Also used : ConnectionWizard(org.jboss.tools.openshift.internal.common.ui.connection.ConnectionWizard) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 3 with ConnectionWizard

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;
}
Also used : Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) ConnectionWizard(org.jboss.tools.openshift.internal.common.ui.connection.ConnectionWizard) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) Combo(org.eclipse.swt.widgets.Combo) IConnection(org.jboss.tools.openshift.common.core.connection.IConnection) FillLayout(org.eclipse.swt.layout.FillLayout) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ControlDecoration(org.eclipse.jface.fieldassist.ControlDecoration)

Example 4 with ConnectionWizard

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;
}
Also used : ConnectionWizard(org.jboss.tools.openshift.internal.common.ui.connection.ConnectionWizard) IWizard(org.eclipse.jface.wizard.IWizard)

Aggregations

ConnectionWizard (org.jboss.tools.openshift.internal.common.ui.connection.ConnectionWizard)4 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 ControlDecoration (org.eclipse.jface.fieldassist.ControlDecoration)1 IWizard (org.eclipse.jface.wizard.IWizard)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 FillLayout (org.eclipse.swt.layout.FillLayout)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Button (org.eclipse.swt.widgets.Button)1 Combo (org.eclipse.swt.widgets.Combo)1 Composite (org.eclipse.swt.widgets.Composite)1 Group (org.eclipse.swt.widgets.Group)1 Label (org.eclipse.swt.widgets.Label)1 IConnection (org.jboss.tools.openshift.common.core.connection.IConnection)1