protected Control createDialogArea()

in PluginsAndFeatures/azure-toolkit-for-eclipse/com.microsoft.azuretools.azureexplorer/src/com/microsoft/azuretools/azureexplorer/forms/AddNewClusterForm.java [93:234]


    protected Control createDialogArea(Composite parent) {
        setTitle("Link New HDInsight Cluster");
        setMessage("Please enter HDInsight Cluster details");

        Composite container = new Composite(parent, SWT.NONE);
        GridLayout gridLayout = new GridLayout();
        gridLayout.numColumns = 2;
        container.setLayout(gridLayout);
        GridData gridData = new GridData();
        gridData.widthHint = 350;
        gridData.horizontalAlignment = SWT.FILL;
        gridData.grabExcessHorizontalSpace = true;
        container.setLayoutData(gridData);

        clusterNameLabel = new Label(container, SWT.LEFT);
        clusterNameLabel.setText("Cluster Name:");
        gridData = new GridData();
        gridData.horizontalIndent = 30;
        gridData.horizontalAlignment = SWT.RIGHT;
        clusterNameLabel.setLayoutData(gridData);
        clusterNameField = new Text(container, SWT.BORDER);
        gridData = new GridData();
        gridData.horizontalAlignment = SWT.FILL;
        gridData.grabExcessHorizontalSpace = true;
        clusterNameField.setLayoutData(gridData);
        clusterNameField.setToolTipText("The HDInsight cluster name, such as 'mycluster' of cluster URL 'mycluster.azurehdinsight.net'.\n\n Press the F1 key or click the '?'(Help) button to get more details.");

        Group clusterAccountGroup = new Group(container, SWT.NONE);
        clusterAccountGroup.setText("The Cluster Account");
        gridLayout = new GridLayout();
        gridLayout.numColumns = 2;
        clusterAccountGroup.setLayout(gridLayout);
        gridData = new GridData();
        gridData.horizontalSpan = 2;
        gridData.widthHint = 350;
        gridData.horizontalAlignment = SWT.FILL;
        gridData.grabExcessHorizontalSpace = true;
        clusterAccountGroup.setLayoutData(gridData);

        userNameLabel = new Label(clusterAccountGroup, SWT.LEFT);
        userNameLabel.setText("User Name:");
        gridData = new GridData();
        gridData.horizontalIndent = 38;
        gridData.horizontalAlignment = SWT.RIGHT;
        userNameLabel.setLayoutData(gridData);
        userNameField = new Text(clusterAccountGroup, SWT.BORDER);
        gridData = new GridData();
        gridData.horizontalAlignment = SWT.FILL;
        gridData.grabExcessHorizontalSpace = true;
        userNameField.setLayoutData(gridData);
        userNameField.setToolTipText("The user name of the HDInsight cluster.\n\n Press the F1 key or click the '?'(Help) button to get more details.");

        passwordLabel = new Label(clusterAccountGroup, SWT.LEFT);
        passwordLabel.setText("Password:");
        gridData = new GridData();
        gridData.horizontalIndent = 38;
        gridData.horizontalAlignment = SWT.RIGHT;
        passwordLabel.setLayoutData(gridData);
        passwordField = new Text(clusterAccountGroup, SWT.PASSWORD | SWT.BORDER);
        gridData = new GridData();
        gridData.horizontalAlignment = SWT.FILL;
        gridData.grabExcessHorizontalSpace = true;
        passwordField.setLayoutData(gridData);
        passwordField.setToolTipText("The password of the HDInsight cluster user provided.\n\n Press the F1 key or click the '?'(Help) button to get more details.");

        Group clusterStorageGroup = new Group(container, SWT.NONE);
        clusterStorageGroup.setText("The Cluster Storage Information (Optional)");
        clusterStorageGroup.setToolTipText("The Cluster Storage Information provided can enable the Storage Explorer support in the left tree view.");
        gridLayout = new GridLayout();
        gridLayout.numColumns = 2;
        clusterStorageGroup.setLayout(gridLayout);
        gridData = new GridData();
        gridData.horizontalSpan = 2;
        gridData.widthHint = 350;
        gridData.horizontalAlignment = SWT.FILL;
        gridData.grabExcessHorizontalSpace = true;
        clusterStorageGroup.setLayoutData(gridData);

        Label storageNameLabel = new Label(clusterStorageGroup, SWT.LEFT);
        storageNameLabel.setText("Storage Account:");
        gridData = new GridData();
        gridData.horizontalAlignment = SWT.RIGHT;
        storageNameLabel.setLayoutData(gridData);
        storageNameField = new Text(clusterStorageGroup, SWT.BORDER);
        gridData = new GridData();
        gridData.horizontalAlignment = SWT.FILL;
        gridData.grabExcessHorizontalSpace = true;
        storageNameField.setLayoutData(gridData);
        storageNameField.setToolTipText("The default storage account of the HDInsight cluster, which can be found from HDInsight cluster properties of Azure portal.\n\n Press the F1 key or click the '?'(Help) button to get more details");

        Label storageKeyLabel = new Label(clusterStorageGroup, SWT.LEFT);
        storageKeyLabel.setText("Storage Key:");
        gridData = new GridData();
        gridData.horizontalAlignment = SWT.RIGHT;
        storageKeyLabel.setLayoutData(gridData);
        storageKeyField = new Text(clusterStorageGroup, SWT.BORDER | SWT.WRAP);
        gridData = new GridData();
        gridData.horizontalAlignment = SWT.FILL;
        gridData.grabExcessHorizontalSpace = true;
        gridData.heightHint = 4 * storageKeyField.getLineHeight();
        storageKeyField.setLayoutData(gridData);
        storageKeyField.setToolTipText("The storage key of the default storage account, which can be found from HDInsight cluster storage accounts of Azure portal.\n\n Press the F1 key or click the '?'(Help) button to get more details.");

        storageNameField.addFocusListener(new FocusAdapter() {
            @Override
            public void focusLost(FocusEvent e) {
                refreshContainers();
            }
        });

        storageKeyField.addFocusListener(new FocusAdapter() {
            @Override
            public void focusLost(FocusEvent e) {
                refreshContainers();
            }
        });

        Label storageContainerLabel = new Label(clusterStorageGroup, SWT.LEFT);
        storageContainerLabel.setText("Storage Container:");
        gridData = new GridData();
        gridData.horizontalAlignment = SWT.RIGHT;
        storageContainerLabel.setLayoutData(gridData);
        containersComboBox = new Combo(clusterStorageGroup, SWT.DROP_DOWN | SWT.BORDER);
        gridData = new GridData();
        gridData.horizontalAlignment = SWT.FILL;
        gridData.grabExcessHorizontalSpace = true;
        containersComboBox.setLayoutData(gridData);

        container.addHelpListener(new HelpListener() {
            @Override public void helpRequested(HelpEvent e) {
                try {
                    IWebBrowser webBrowser = PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser();
                    if (webBrowser != null)
                        webBrowser.openURL(new URL("https://go.microsoft.com/fwlink/?linkid=866472"));
                } catch (Exception ignored) {
                }
            }
        });

        customizeUI();
        return container;
    }