Search in sources :

Example 36 with TabItem

use of org.eclipse.swt.widgets.TabItem in project dbeaver by serge-rider.

the class ConnectionPageSettings method createProviderPage.

private void createProviderPage(Composite parent) {
    if (this.connectionEditor != null && this.connectionEditor.getControl() != null) {
        return;
    }
    if (getControl() != null) {
        getControl().dispose();
    }
    try {
        if (this.connectionEditor == null) {
            this.connectionEditor = viewDescriptor.createView(IDataSourceConnectionEditor.class);
            this.connectionEditor.setSite(this);
        }
        // init sub pages (if any)
        getSubPages();
        if (wizard.isNew() && !ArrayUtils.isEmpty(subPages)) {
            // Create tab folder
            List<IDialogPage> allPages = new ArrayList<>();
            allPages.add(connectionEditor);
            Collections.addAll(allPages, subPages);
            tabFolder = new TabFolder(parent, SWT.TOP);
            tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
            setControl(tabFolder);
            for (IDialogPage page : allPages) {
                TabItem item = new TabItem(tabFolder, SWT.NONE);
                page.createControl(tabFolder);
                item.setData(page);
                Control pageControl = page.getControl();
                item.setControl(pageControl);
                item.setText(CommonUtils.isEmpty(page.getTitle()) ? "General" : page.getTitle());
                item.setToolTipText(page.getDescription());
            }
            tabFolder.setSelection(0);
            tabFolder.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    activateCurrentItem();
                }
            });
        } else {
            // Create single editor control
            this.connectionEditor.createControl(parent);
            setControl(this.connectionEditor.getControl());
        }
        UIUtils.setHelp(getControl(), IHelpContextIds.CTX_CON_WIZARD_SETTINGS);
    } catch (Exception ex) {
        log.warn(ex);
        setErrorMessage("Can't create settings dialog: " + ex.getMessage());
    }
    parent.layout();
}
Also used : TabItem(org.eclipse.swt.widgets.TabItem) Control(org.eclipse.swt.widgets.Control) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) IDialogPage(org.eclipse.jface.dialogs.IDialogPage) TabFolder(org.eclipse.swt.widgets.TabFolder) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Example 37 with TabItem

use of org.eclipse.swt.widgets.TabItem in project cubrid-manager by CUBRID.

the class ShardParameterPanel method build.

/**
	 * build panel
	 * 
	 * @param parent
	 *            the parent composite
	 */
public void build(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    composite.setLayout(layout);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.heightHint = 470;
    gridData.widthHint = 650;
    composite.setLayoutData(gridData);
    TabFolder tabFolder = new TabFolder(composite, SWT.NONE);
    tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
    tabFolder.setLayout(new GridLayout());
    TabItem item = new TabItem(tabFolder, SWT.NONE);
    item.setText(Messages.shardBroker);
    item.setControl(createBrokerComp(tabFolder));
    item = new TabItem(tabFolder, SWT.NONE);
    item.setText(Messages.shardConnection);
    item.setControl(createConnectionComp(tabFolder));
    item = new TabItem(tabFolder, SWT.NONE);
    item.setText(Messages.shardKey);
    item.setControl(createKeyComp(tabFolder));
    shardKeysPanel.reloadShardIdList();
    load();
    initial();
}
Also used : TabItem(org.eclipse.swt.widgets.TabItem) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) TabFolder(org.eclipse.swt.widgets.TabFolder)

Example 38 with TabItem

use of org.eclipse.swt.widgets.TabItem in project cubrid-manager by CUBRID.

the class DatabaseConfigPropertyPage method createContents.

protected Control createContents(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    TabFolder tabFolder = new TabFolder(composite, SWT.NONE);
    tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
    layout = new GridLayout();
    tabFolder.setLayout(layout);
    TabItem item = new TabItem(tabFolder, SWT.NONE);
    item.setText(Messages.tabItemGeneral);
    item.setControl(createGeneralComp(tabFolder));
    item = new TabItem(tabFolder, SWT.NONE);
    item.setText(Messages.tabItemAdvanceOptions);
    item.setControl(createAdvancedComp(tabFolder));
    initial();
    return composite;
}
Also used : TabItem(org.eclipse.swt.widgets.TabItem) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) TabFolder(org.eclipse.swt.widgets.TabFolder)

Example 39 with TabItem

use of org.eclipse.swt.widgets.TabItem in project azure-tools-for-java by Microsoft.

the class AzureViewDockerDialog method createDialogArea.

/**
	 * Create contents of the dialog.
	 * @param parent
	 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite mainContainer = (Composite) super.createDialogArea(parent);
    mainContainer.setLayout(new GridLayout(2, false));
    Label lblNewLabel = new Label(mainContainer, SWT.NONE);
    GridData gd_lblNewLabel = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblNewLabel.verticalIndent = 5;
    gd_lblNewLabel.horizontalIndent = 5;
    lblNewLabel.setLayoutData(gd_lblNewLabel);
    lblNewLabel.setText("Host name:");
    dockerHostNameTextField = new Text(mainContainer, SWT.READ_ONLY);
    GridData gd_dockerHostNameTextField = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
    gd_dockerHostNameTextField.verticalIndent = 5;
    dockerHostNameTextField.setLayoutData(gd_dockerHostNameTextField);
    dockerHostNameTextField.setBackground(mainContainer.getBackground());
    Label lblUrl = new Label(mainContainer, SWT.NONE);
    GridData gd_lblUrl = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblUrl.horizontalIndent = 5;
    lblUrl.setLayoutData(gd_lblUrl);
    lblUrl.setText("URL:");
    dockerHostUrlTextField = new Text(mainContainer, SWT.READ_ONLY);
    dockerHostUrlTextField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    dockerHostUrlTextField.setBackground(mainContainer.getBackground());
    Label lblSubscription = new Label(mainContainer, SWT.NONE);
    GridData gd_lblSubscription = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblSubscription.horizontalIndent = 5;
    lblSubscription.setLayoutData(gd_lblSubscription);
    lblSubscription.setText("Subscription:");
    dockerHostSidTextField = new Text(mainContainer, SWT.READ_ONLY);
    dockerHostSidTextField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    dockerHostSidTextField.setBackground(mainContainer.getBackground());
    Label lblLocation = new Label(mainContainer, SWT.NONE);
    GridData gd_lblLocation = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblLocation.horizontalIndent = 5;
    lblLocation.setLayoutData(gd_lblLocation);
    lblLocation.setText("Location:");
    dockerHostLocationTextField = new Text(mainContainer, SWT.READ_ONLY);
    dockerHostLocationTextField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    dockerHostLocationTextField.setBackground(mainContainer.getBackground());
    Label lblStatus = new Label(mainContainer, SWT.NONE);
    GridData gd_lblStatus = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblStatus.horizontalIndent = 5;
    lblStatus.setLayoutData(gd_lblStatus);
    lblStatus.setText("Status:");
    dockerHostStatusTextField = new Text(mainContainer, SWT.READ_ONLY);
    dockerHostStatusTextField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    dockerHostStatusTextField.setBackground(mainContainer.getBackground());
    TabFolder tabFolder = new TabFolder(mainContainer, SWT.NONE);
    GridData gd_tabFolder = new GridData(SWT.LEFT, SWT.CENTER, true, true, 2, 1);
    gd_tabFolder.heightHint = 320;
    gd_tabFolder.widthHint = 575;
    tabFolder.setLayoutData(gd_tabFolder);
    TabItem tbtmVmSettings = new TabItem(tabFolder, SWT.NONE);
    tbtmVmSettings.setText("Login Settings");
    Composite loginSetsComposite = new Composite(tabFolder, SWT.NONE);
    tbtmVmSettings.setControl(loginSetsComposite);
    loginSetsComposite.setLayout(new GridLayout(4, false));
    Label lblAuthentication = new Label(loginSetsComposite, SWT.NONE);
    GridData gd_lblAuthentication = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblAuthentication.verticalIndent = 5;
    gd_lblAuthentication.horizontalIndent = 3;
    lblAuthentication.setLayoutData(gd_lblAuthentication);
    lblAuthentication.setText("Authentication");
    new Label(loginSetsComposite, SWT.NONE);
    new Label(loginSetsComposite, SWT.NONE);
    Link dockerHostAuthUpdateHyperlink = new Link(loginSetsComposite, SWT.NONE);
    dockerHostAuthUpdateHyperlink.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            exitCode = UPDATE_EXIT_CODE;
            okPressed();
        }
    });
    dockerHostAuthUpdateHyperlink.setText("<a>Update...</a>");
    Label lblUsername = new Label(loginSetsComposite, SWT.NONE);
    GridData gd_lblUsername = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblUsername.horizontalIndent = 20;
    lblUsername.setLayoutData(gd_lblUsername);
    lblUsername.setText("Username:");
    dockerHostUsernameTextField = new Text(loginSetsComposite, SWT.READ_ONLY);
    dockerHostUsernameTextField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    new Label(loginSetsComposite, SWT.NONE);
    new Label(loginSetsComposite, SWT.NONE);
    Label lblLogInUsing = new Label(loginSetsComposite, SWT.NONE);
    GridData gd_lblLogInUsing = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblLogInUsing.horizontalIndent = 20;
    lblLogInUsing.setLayoutData(gd_lblLogInUsing);
    lblLogInUsing.setText("Log in using a password:");
    dockerHostPwdLoginTextField = new Text(loginSetsComposite, SWT.READ_ONLY);
    dockerHostPwdLoginTextField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    new Label(loginSetsComposite, SWT.NONE);
    new Label(loginSetsComposite, SWT.NONE);
    Label lblLogInUsing_1 = new Label(loginSetsComposite, SWT.NONE);
    GridData gd_lblLogInUsing_1 = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblLogInUsing_1.horizontalIndent = 20;
    lblLogInUsing_1.setLayoutData(gd_lblLogInUsing_1);
    lblLogInUsing_1.setText("Log in using SSH keys:");
    dockerHostSshLoginTextField = new Text(loginSetsComposite, SWT.READ_ONLY);
    dockerHostSshLoginTextField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    new Label(loginSetsComposite, SWT.NONE);
    Link dockerHostSshExportHyperlink = new Link(loginSetsComposite, SWT.NONE);
    dockerHostSshExportHyperlink.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            if (dockerHost.hasSSHLogIn && dockerHost.certVault != null) {
                Display display = Display.getDefault();
                Shell dialogShell = new Shell(display, SWT.APPLICATION_MODAL);
                dialogShell = mainContainer.getShell();
                AzureExportDockerSshKeysDialog exportDockerSshKeysDialog = new AzureExportDockerSshKeysDialog(dialogShell, project);
                if (exportDockerSshKeysDialog.open() == Window.OK) {
                    try {
                        AzureDockerCertVaultOps.saveSshKeysToLocalFiles(exportDockerSshKeysDialog.getPath(), dockerHost.certVault);
                    } catch (Exception ex) {
                        String msg = "An error occurred while attempting to export the SSh keys.\n" + ex.getMessage();
                        PluginUtil.displayErrorDialogAndLog(mainContainer.getShell(), "Error", msg, ex);
                    }
                }
            }
        }
    });
    dockerHostSshExportHyperlink.setText("<a>Export SSH keys...</a>");
    new Label(loginSetsComposite, SWT.NONE);
    new Label(loginSetsComposite, SWT.NONE);
    new Label(loginSetsComposite, SWT.NONE);
    new Label(loginSetsComposite, SWT.NONE);
    Label lblDockerDaemon = new Label(loginSetsComposite, SWT.NONE);
    GridData gd_lblDockerDaemon = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblDockerDaemon.horizontalIndent = 3;
    lblDockerDaemon.setLayoutData(gd_lblDockerDaemon);
    lblDockerDaemon.setText("Docker Daemon");
    new Label(loginSetsComposite, SWT.NONE);
    new Label(loginSetsComposite, SWT.NONE);
    new Label(loginSetsComposite, SWT.NONE);
    Label lblAuthentication_1 = new Label(loginSetsComposite, SWT.NONE);
    GridData gd_lblAuthentication_1 = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblAuthentication_1.horizontalIndent = 20;
    lblAuthentication_1.setLayoutData(gd_lblAuthentication_1);
    lblAuthentication_1.setText("Authentication:");
    dockerHostTlsAuthTextField = new Text(loginSetsComposite, SWT.READ_ONLY);
    dockerHostTlsAuthTextField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    new Label(loginSetsComposite, SWT.NONE);
    Link dockerHostTlsExportHyperlink = new Link(loginSetsComposite, SWT.NONE);
    dockerHostTlsExportHyperlink.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            if (dockerHost.isTLSSecured && dockerHost.certVault != null) {
                AzureExportDockerTlsKeysDialog exportDockerTlsKeysDialog = new AzureExportDockerTlsKeysDialog(mainContainer.getShell(), project);
                if (exportDockerTlsKeysDialog.open() == Window.OK) {
                    try {
                        AzureDockerCertVaultOps.saveTlsCertsToLocalFiles(exportDockerTlsKeysDialog.getPath(), dockerHost.certVault);
                    } catch (Exception ex) {
                        String msg = "An error occurred while attempting to export the TLS keys.\n" + ex.getMessage();
                        PluginUtil.displayErrorDialogAndLog(mainContainer.getShell(), "Error", msg, ex);
                    }
                }
            }
        }
    });
    dockerHostTlsExportHyperlink.setText("<a>Export TLS certs...</a>");
    Label lblPortSettings = new Label(loginSetsComposite, SWT.NONE);
    GridData gd_lblPortSettings = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblPortSettings.horizontalIndent = 20;
    lblPortSettings.setLayoutData(gd_lblPortSettings);
    lblPortSettings.setText("Port settings:");
    dockerHostPortTextField = new Text(loginSetsComposite, SWT.NONE);
    dockerHostPortTextField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    new Label(loginSetsComposite, SWT.NONE);
    new Label(loginSetsComposite, SWT.NONE);
    new Label(loginSetsComposite, SWT.NONE);
    new Label(loginSetsComposite, SWT.NONE);
    new Label(loginSetsComposite, SWT.NONE);
    new Label(loginSetsComposite, SWT.NONE);
    Label lblKeyVaultSettings = new Label(loginSetsComposite, SWT.NONE);
    GridData gd_lblKeyVaultSettings = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblKeyVaultSettings.horizontalIndent = 3;
    lblKeyVaultSettings.setLayoutData(gd_lblKeyVaultSettings);
    lblKeyVaultSettings.setText("Key Vault Settings");
    new Label(loginSetsComposite, SWT.NONE);
    new Label(loginSetsComposite, SWT.NONE);
    new Label(loginSetsComposite, SWT.NONE);
    Label lblKeyVaultUrl = new Label(loginSetsComposite, SWT.NONE);
    GridData gd_lblKeyVaultUrl = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblKeyVaultUrl.horizontalIndent = 20;
    lblKeyVaultUrl.setLayoutData(gd_lblKeyVaultUrl);
    lblKeyVaultUrl.setText("Key Vault Url:");
    dockerHostKeyvaultTextField = new Text(loginSetsComposite, SWT.READ_ONLY);
    dockerHostKeyvaultTextField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));
    new Label(loginSetsComposite, SWT.NONE);
    Label dockerHostKeyvaultLabel1 = new Label(loginSetsComposite, SWT.WRAP);
    dockerHostKeyvaultLabel1.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
    dockerHostKeyvaultLabel1.setText("Go to Azure Portal and change the Key Vault permissons in order to");
    new Label(loginSetsComposite, SWT.NONE);
    Label dockerHostKeyvaultLabel2 = new Label(loginSetsComposite, SWT.NONE);
    dockerHostKeyvaultLabel2.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
    dockerHostKeyvaultLabel2.setText(" access it from your current sign-in credentials!");
    TabItem tbtmLoginSettings = new TabItem(tabFolder, SWT.NONE);
    tbtmLoginSettings.setText("VM Settings");
    Composite vmSetsComposite = new Composite(tabFolder, SWT.NONE);
    tbtmLoginSettings.setControl(vmSetsComposite);
    vmSetsComposite.setLayout(new GridLayout(2, false));
    Label lblHostOsType = new Label(vmSetsComposite, SWT.NONE);
    GridData gd_lblHostOsType = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblHostOsType.verticalIndent = 5;
    gd_lblHostOsType.horizontalIndent = 3;
    lblHostOsType.setLayoutData(gd_lblHostOsType);
    lblHostOsType.setText("Host OS type:");
    dockerHostOSTypeTextField = new Text(vmSetsComposite, SWT.READ_ONLY);
    GridData gd_dockerHostOSTypeTextField = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
    gd_dockerHostOSTypeTextField.verticalIndent = 5;
    dockerHostOSTypeTextField.setLayoutData(gd_dockerHostOSTypeTextField);
    Label lblVmSize = new Label(vmSetsComposite, SWT.NONE);
    GridData gd_lblVmSize = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblVmSize.horizontalIndent = 3;
    lblVmSize.setLayoutData(gd_lblVmSize);
    lblVmSize.setText("VM size:");
    dockerHostVMSizeTextField = new Text(vmSetsComposite, SWT.READ_ONLY);
    dockerHostVMSizeTextField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    Label lblResourceGroup = new Label(vmSetsComposite, SWT.NONE);
    GridData gd_lblResourceGroup = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblResourceGroup.horizontalIndent = 3;
    lblResourceGroup.setLayoutData(gd_lblResourceGroup);
    lblResourceGroup.setText("Resource group:");
    dockerHostRGNameTextField = new Text(vmSetsComposite, SWT.READ_ONLY);
    dockerHostRGNameTextField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    Label lblNetwork = new Label(vmSetsComposite, SWT.NONE);
    GridData gd_lblNetwork = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblNetwork.horizontalIndent = 3;
    lblNetwork.setLayoutData(gd_lblNetwork);
    lblNetwork.setText("Network:");
    dockerHostVnetNameAddrTextField = new Text(vmSetsComposite, SWT.READ_ONLY);
    dockerHostVnetNameAddrTextField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    Label lblSubnet = new Label(vmSetsComposite, SWT.NONE);
    GridData gd_lblSubnet = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblSubnet.horizontalIndent = 3;
    lblSubnet.setLayoutData(gd_lblSubnet);
    lblSubnet.setText("Subnet:");
    dockerHostSubnetNameAddrTextField = new Text(vmSetsComposite, SWT.READ_ONLY);
    dockerHostSubnetNameAddrTextField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    Label lblPublicIp = new Label(vmSetsComposite, SWT.NONE);
    GridData gd_lblPublicIp = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblPublicIp.horizontalIndent = 3;
    lblPublicIp.setLayoutData(gd_lblPublicIp);
    lblPublicIp.setText("Public IP:");
    dockerHostPublicIpTextField = new Text(vmSetsComposite, SWT.READ_ONLY);
    dockerHostPublicIpTextField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    Label lblPrivateIp = new Label(vmSetsComposite, SWT.NONE);
    GridData gd_lblPrivateIp = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblPrivateIp.horizontalIndent = 3;
    lblPrivateIp.setLayoutData(gd_lblPrivateIp);
    lblPrivateIp.setText("Private IP:");
    dockerHostPrivateIpTextField = new Text(vmSetsComposite, SWT.READ_ONLY);
    dockerHostPrivateIpTextField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    Label lblStorageAccount = new Label(vmSetsComposite, SWT.NONE);
    GridData gd_lblStorageAccount = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblStorageAccount.horizontalIndent = 3;
    lblStorageAccount.setLayoutData(gd_lblStorageAccount);
    lblStorageAccount.setText("Storage account:");
    dockerHostStorageNameTypeTextField = new Text(vmSetsComposite, SWT.READ_ONLY);
    dockerHostStorageNameTypeTextField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    //new Color(null,  mainContainer.getBackground().getRed(),  mainContainer.getBackground().getGreen(),  mainContainer.getBackground().getBlue(), 255);
    Color backgroundColor = mainContainer.getBackground();
    loginSetsComposite.setBackgroundMode(SWT.INHERIT_FORCE);
    loginSetsComposite.setBackground(backgroundColor);
    vmSetsComposite.setBackgroundMode(SWT.INHERIT_FORCE);
    vmSetsComposite.setBackground(backgroundColor);
    String updating = dockerHost.isUpdating ? " (updating...)" : null;
    setTextField(dockerHostNameTextField, dockerHost.name);
    dockerHostUsernameTextField.setBackground(tabFolder.getBackground());
    setTextField(dockerHostUrlTextField, dockerHost.apiUrl);
    setTextField(dockerHostSidTextField, dockerHost.sid);
    setTextField(dockerHostLocationTextField, dockerHost.hostVM.region);
    setTextField(dockerHostStatusTextField, (updating != null) ? dockerHost.state.toString() + updating : dockerHost.state.toString());
    // Docker VM settings
    setTextField(dockerHostOSTypeTextField, dockerHost.hostOSType.toString());
    // TODO: enable resizing of the current VM -> see
    // VirtualMachine::availableSizes() and update.withSize();
    setTextField(dockerHostVMSizeTextField, (updating != null) ? dockerHost.hostVM.vmSize + updating : dockerHost.hostVM.vmSize);
    setTextField(dockerHostRGNameTextField, dockerHost.hostVM.resourceGroupName);
    setTextField(dockerHostVnetNameAddrTextField, String.format("%s (%s)", dockerHost.hostVM.vnetName, dockerHost.hostVM.vnetAddressSpace));
    setTextField(dockerHostSubnetNameAddrTextField, String.format("%s (%s)", dockerHost.hostVM.subnetName, dockerHost.hostVM.subnetAddressRange));
    setTextField(dockerHostPublicIpTextField, String.format("%s (%s)", dockerHost.hostVM.publicIp, dockerHost.hostVM.publicIpName));
    setTextField(dockerHostPrivateIpTextField, dockerHost.hostVM.privateIp);
    setTextField(dockerHostStorageNameTypeTextField, String.format("%s (%s)", dockerHost.hostVM.storageAccountName, dockerHost.hostVM.storageAccountType));
    // Docker VM log in settings
    dockerHostAuthUpdateHyperlink.setEnabled(!dockerHost.isUpdating);
    String username = (dockerHost.certVault != null && dockerHost.certVault.vmUsername != null) ? dockerHost.certVault.vmUsername : "-unknown-";
    setTextField(dockerHostUsernameTextField, (updating != null) ? username + updating : username);
    setTextField(dockerHostPwdLoginTextField, (updating != null) ? (dockerHost.hasPwdLogIn ? "Yes" : (dockerHost.certVault == null) ? "-unknown- " : "No") + updating : (dockerHost.hasPwdLogIn ? "Yes" : (dockerHost.certVault == null) ? "-unknown- " : "No"));
    setTextField(dockerHostSshLoginTextField, (updating != null) ? (dockerHost.hasSSHLogIn ? "Yes" : (dockerHost.certVault == null) ? "-unknown- " : "No") + updating : (dockerHost.hasSSHLogIn ? "Yes" : (dockerHost.certVault == null) ? "-unknown- " : "No"));
    dockerHostSshExportHyperlink.setEnabled(!dockerHost.isUpdating && dockerHost.hasSSHLogIn);
    // Docker Daemon settings
    setTextField(dockerHostTlsAuthTextField, (updating != null) ? (dockerHost.isTLSSecured ? "Using TLS certificates" : (dockerHost.certVault == null) ? "-unknown- " : "Open/unsecured access") + updating : (dockerHost.isTLSSecured ? "Using TLS certificates" : (dockerHost.certVault == null) ? "-unknown- " : "Open/unsecured access"));
    dockerHostTlsExportHyperlink.setEnabled(!dockerHost.isUpdating && dockerHost.isTLSSecured && !dockerHost.state.equals(DockerHostVMState.TO_BE_CREATED));
    setTextField(dockerHostPortTextField, (updating != null) ? dockerHost.port + updating : dockerHost.port);
    // Docker Key Vault settings
    if (dockerHost.certVault != null && dockerHost.certVault.uri != null && !dockerHost.certVault.uri.isEmpty()) {
        setTextField(dockerHostKeyvaultTextField, (updating != null) ? dockerHost.certVault.uri + updating : dockerHost.certVault.uri);
        dockerHostKeyvaultLabel1.setVisible(false);
        dockerHostKeyvaultLabel2.setVisible(false);
    } else if (dockerHost.hostVM.vaultName != null && !dockerHost.hostVM.vaultName.isEmpty()) {
        setTextField(dockerHostKeyvaultTextField, String.format("Error reading http://%s.vault.azure.net", dockerHost.hostVM.vaultName));
        dockerHostKeyvaultLabel1.setVisible(true);
        dockerHostKeyvaultLabel2.setVisible(true);
    } else {
        setTextField(dockerHostKeyvaultTextField, "Not using Key Vault");
        dockerHostKeyvaultLabel1.setVisible(false);
        dockerHostKeyvaultLabel2.setVisible(false);
    }
    exitCode = CLOSE_EXIT_CODE;
    return mainContainer;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Color(org.eclipse.swt.graphics.Color) Label(org.eclipse.swt.widgets.Label) TabFolder(org.eclipse.swt.widgets.TabFolder) Text(org.eclipse.swt.widgets.Text) TabItem(org.eclipse.swt.widgets.TabItem) GridLayout(org.eclipse.swt.layout.GridLayout) Shell(org.eclipse.swt.widgets.Shell) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Link(org.eclipse.swt.widgets.Link) Display(org.eclipse.swt.widgets.Display)

Example 40 with TabItem

use of org.eclipse.swt.widgets.TabItem in project azure-tools-for-java by Microsoft.

the class AzureNewDockerConfigPage method createControl.

/**
	 * Create contents of the wizard.
	 * @param parent
	 */
public void createControl(Composite parent) {
    Composite mainContainer = new Composite(parent, SWT.NONE);
    setControl(mainContainer);
    mainContainer.setLayout(new GridLayout(3, false));
    Label lblName = new Label(mainContainer, SWT.NONE);
    GridData gd_lblName = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblName.horizontalIndent = 5;
    lblName.setLayoutData(gd_lblName);
    lblName.setText("Name:");
    dockerHostNameTextField = new Text(mainContainer, SWT.BORDER);
    GridData gd_dockerHostNameTextField = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
    gd_dockerHostNameTextField.horizontalIndent = 3;
    gd_dockerHostNameTextField.widthHint = 200;
    dockerHostNameTextField.setLayoutData(gd_dockerHostNameTextField);
    Label lblNewLabel = new Label(mainContainer, SWT.NONE);
    GridData gd_lblNewLabel = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblNewLabel.horizontalIndent = 5;
    lblNewLabel.setLayoutData(gd_lblNewLabel);
    lblNewLabel.setText("Subscription:");
    dockerSubscriptionComboViewer = new ComboViewer(mainContainer, SWT.READ_ONLY);
    dockerSubscriptionCombo = dockerSubscriptionComboViewer.getCombo();
    dockerSubscriptionCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    new Label(mainContainer, SWT.NONE);
    Label lblId = new Label(mainContainer, SWT.NONE);
    GridData gd_lblId = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblId.horizontalIndent = 5;
    lblId.setLayoutData(gd_lblId);
    lblId.setText("Id:");
    dockerSubscriptionIdTextField = new Text(mainContainer, SWT.NONE);
    GridData gd_dockerSubscriptionIdTextField = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_dockerSubscriptionIdTextField.horizontalIndent = 3;
    gd_dockerSubscriptionIdTextField.widthHint = 300;
    dockerSubscriptionIdTextField.setLayoutData(gd_dockerSubscriptionIdTextField);
    dockerSubscriptionIdTextField.setEditable(false);
    dockerSubscriptionIdTextField.setBackground(mainContainer.getBackground());
    new Label(mainContainer, SWT.NONE);
    Label lblRegion = new Label(mainContainer, SWT.NONE);
    GridData gd_lblRegion = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblRegion.horizontalIndent = 5;
    lblRegion.setLayoutData(gd_lblRegion);
    lblRegion.setText("Region:");
    dockerLocationComboBox = new Combo(mainContainer, SWT.READ_ONLY);
    GridData gd_dockerLocationComboBox = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_dockerLocationComboBox.widthHint = 200;
    dockerLocationComboBox.setLayoutData(gd_dockerLocationComboBox);
    new Label(mainContainer, SWT.NONE);
    hostDetailsTabFolder = new TabFolder(mainContainer, SWT.NONE);
    GridData gd_hostDetailsTabFolder = new GridData(SWT.FILL, SWT.TOP, true, false, 3, 1);
    gd_hostDetailsTabFolder.heightHint = 128;
    hostDetailsTabFolder.setLayoutData(gd_hostDetailsTabFolder);
    vmKindTableItem = new TabItem(hostDetailsTabFolder, SWT.NONE);
    vmKindTableItem.setText("OS and Size");
    vmKindComposite = new Composite(hostDetailsTabFolder, SWT.NONE);
    vmKindTableItem.setControl(vmKindComposite);
    vmKindComposite.setLayout(new GridLayout(3, false));
    Label lblNewLabel_1 = new Label(vmKindComposite, SWT.NONE);
    lblNewLabel_1.setText("Host OS:");
    dockerHostOSTypeComboBox = new Combo(vmKindComposite, SWT.READ_ONLY);
    GridData gd_dockerHostOSTypeComboBox = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_dockerHostOSTypeComboBox.widthHint = 200;
    dockerHostOSTypeComboBox.setLayoutData(gd_dockerHostOSTypeComboBox);
    new Label(vmKindComposite, SWT.NONE);
    Label lblSize = new Label(vmKindComposite, SWT.NONE);
    lblSize.setText("Size:");
    dockerHostVMSizeComboBox = new Combo(vmKindComposite, SWT.READ_ONLY);
    GridData gd_dockerHostVMSizeComboBox = new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1);
    gd_dockerHostVMSizeComboBox.widthHint = 200;
    dockerHostVMSizeComboBox.setLayoutData(gd_dockerHostVMSizeComboBox);
    Link dockerPricingHyperlink = new Link(vmKindComposite, SWT.NONE);
    dockerPricingHyperlink.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            try {
                PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(new URL("https://azure.microsoft.com/en-us/pricing/details/virtual-machines/linux/"));
            } catch (Exception ex) {
                DefaultLoader.getUIHelper().logError(ex.getMessage(), ex);
            }
        }
    });
    dockerPricingHyperlink.setText("<a>Pricing</a>");
    GridData gd_dockerPricingHyperlink = new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 2);
    dockerPricingHyperlink.setLayoutData(gd_dockerPricingHyperlink);
    dockerHostVMPreferredSizesCheckBox = new Button(vmKindComposite, SWT.CHECK);
    dockerHostVMPreferredSizesCheckBox.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
    dockerHostVMPreferredSizesCheckBox.setText("Show preferred sizes only");
    rgTableItem = new TabItem(hostDetailsTabFolder, SWT.NONE);
    rgTableItem.setText("Resource Group");
    Composite rgComposite = new Composite(hostDetailsTabFolder, SWT.NONE);
    rgTableItem.setControl(rgComposite);
    rgComposite.setLayout(new GridLayout(2, false));
    dockerHostNewRGRadioButton = new Button(rgComposite, SWT.RADIO);
    dockerHostNewRGRadioButton.setText("New resource group:");
    dockerHostRGTextField = new Text(rgComposite, SWT.BORDER);
    GridData gd_dockerHostRGTextField = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_dockerHostRGTextField.horizontalIndent = 3;
    gd_dockerHostRGTextField.widthHint = 200;
    dockerHostRGTextField.setLayoutData(gd_dockerHostRGTextField);
    dockerHostSelectRGRadioButton = new Button(rgComposite, SWT.RADIO);
    dockerHostSelectRGRadioButton.setText("Existing resource group:");
    dockerHostSelectRGComboBox = new Combo(rgComposite, SWT.READ_ONLY);
    GridData gd_dockerHostSelectRGComboBox = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_dockerHostSelectRGComboBox.widthHint = 220;
    dockerHostSelectRGComboBox.setLayoutData(gd_dockerHostSelectRGComboBox);
    networkTableItem = new TabItem(hostDetailsTabFolder, SWT.NONE);
    networkTableItem.setText("Network");
    Composite networkComposite = new Composite(hostDetailsTabFolder, SWT.NONE);
    networkTableItem.setControl(networkComposite);
    networkComposite.setLayout(new GridLayout(2, false));
    dockerHostNewVNetRadioButton = new Button(networkComposite, SWT.RADIO);
    dockerHostNewVNetRadioButton.setText("New virtual network");
    dockerHostNewVNetNameTextField = new Text(networkComposite, SWT.BORDER);
    GridData gd_dockerHostNewVNetNameTextField = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_dockerHostNewVNetNameTextField.horizontalIndent = 3;
    gd_dockerHostNewVNetNameTextField.widthHint = 200;
    dockerHostNewVNetNameTextField.setLayoutData(gd_dockerHostNewVNetNameTextField);
    Label lblAddressSpacecdir = new Label(networkComposite, SWT.NONE);
    GridData gd_lblAddressSpacecdir = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblAddressSpacecdir.horizontalIndent = 18;
    lblAddressSpacecdir.setLayoutData(gd_lblAddressSpacecdir);
    lblAddressSpacecdir.setText("Address space (CDIR):");
    dockerHostNewVNetAddrSpaceTextField = new Text(networkComposite, SWT.BORDER);
    GridData gd_dockerHostNewVNetAddrSpaceTextField = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_dockerHostNewVNetAddrSpaceTextField.horizontalIndent = 3;
    gd_dockerHostNewVNetAddrSpaceTextField.widthHint = 200;
    dockerHostNewVNetAddrSpaceTextField.setLayoutData(gd_dockerHostNewVNetAddrSpaceTextField);
    dockerHostSelectVNetRadioButton = new Button(networkComposite, SWT.RADIO);
    dockerHostSelectVNetRadioButton.setText("Existing virtual network:");
    dockerHostSelectVnetComboBox = new Combo(networkComposite, SWT.READ_ONLY);
    GridData gd_dockerHostSelectVnetComboBox = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_dockerHostSelectVnetComboBox.widthHint = 220;
    dockerHostSelectVnetComboBox.setLayoutData(gd_dockerHostSelectVnetComboBox);
    Label lblSubnet = new Label(networkComposite, SWT.NONE);
    GridData gd_lblSubnet = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblSubnet.horizontalIndent = 18;
    lblSubnet.setLayoutData(gd_lblSubnet);
    lblSubnet.setText("Subnet:");
    dockerHostSelectSubnetComboBox = new Combo(networkComposite, SWT.READ_ONLY);
    GridData gd_dockerHostSelectSubnetComboBox = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_dockerHostSelectSubnetComboBox.widthHint = 220;
    dockerHostSelectSubnetComboBox.setLayoutData(gd_dockerHostSelectSubnetComboBox);
    storageTableItem = new TabItem(hostDetailsTabFolder, SWT.NONE);
    storageTableItem.setText("Storage");
    Composite storageComposite = new Composite(hostDetailsTabFolder, SWT.NONE);
    storageTableItem.setControl(storageComposite);
    storageComposite.setLayout(new GridLayout(2, false));
    dockerHostNewStorageRadioButton = new Button(storageComposite, SWT.RADIO);
    dockerHostNewStorageRadioButton.setText("New storage account:");
    dockerNewStorageTextField = new Text(storageComposite, SWT.BORDER);
    GridData gd_dockerNewStorageTextField = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_dockerNewStorageTextField.horizontalIndent = 3;
    gd_dockerNewStorageTextField.widthHint = 200;
    dockerNewStorageTextField.setLayoutData(gd_dockerNewStorageTextField);
    dockerHostSelectStorageRadioButton = new Button(storageComposite, SWT.RADIO);
    dockerHostSelectStorageRadioButton.setText("Existing storage account:");
    dockerSelectStorageComboBox = new Combo(storageComposite, SWT.READ_ONLY);
    GridData gd_dockerSelectStorageComboBox = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_dockerSelectStorageComboBox.widthHint = 220;
    dockerSelectStorageComboBox.setLayoutData(gd_dockerSelectStorageComboBox);
    FormToolkit toolkit = new FormToolkit(mainContainer.getDisplay());
    toolkit.getHyperlinkGroup().setHyperlinkUnderlineMode(HyperlinkSettings.UNDERLINE_HOVER);
    managedForm = new ManagedForm(mainContainer);
    errMsgForm = managedForm.getForm();
    errMsgForm.setVisible(false);
    //		errMsgForm.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true, 2, 1));
    //		errMsgForm.setBackground(mainContainer.getBackground());
    errDispatcher = managedForm.getMessageManager();
    initUIMainContainer(mainContainer);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) TabFolder(org.eclipse.swt.widgets.TabFolder) Text(org.eclipse.swt.widgets.Text) Combo(org.eclipse.swt.widgets.Combo) URL(java.net.URL) TabItem(org.eclipse.swt.widgets.TabItem) GridLayout(org.eclipse.swt.layout.GridLayout) ComboViewer(org.eclipse.jface.viewers.ComboViewer) Button(org.eclipse.swt.widgets.Button) ManagedForm(org.eclipse.ui.forms.ManagedForm) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Link(org.eclipse.swt.widgets.Link)

Aggregations

TabItem (org.eclipse.swt.widgets.TabItem)54 Composite (org.eclipse.swt.widgets.Composite)35 GridData (org.eclipse.swt.layout.GridData)33 GridLayout (org.eclipse.swt.layout.GridLayout)33 TabFolder (org.eclipse.swt.widgets.TabFolder)33 SelectionEvent (org.eclipse.swt.events.SelectionEvent)19 Button (org.eclipse.swt.widgets.Button)17 Label (org.eclipse.swt.widgets.Label)17 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)16 Text (org.eclipse.swt.widgets.Text)15 Combo (org.eclipse.swt.widgets.Combo)8 Group (org.eclipse.swt.widgets.Group)7 Test (org.junit.Test)7 FillLayout (org.eclipse.swt.layout.FillLayout)6 TableColumn (org.eclipse.swt.widgets.TableColumn)6 ArrayList (java.util.ArrayList)5 StyledText (org.eclipse.swt.custom.StyledText)5 TableItem (org.eclipse.swt.widgets.TableItem)5 TableViewer (org.eclipse.jface.viewers.TableViewer)4 SelectionListener (org.eclipse.swt.events.SelectionListener)4