protected Control createDialogArea()

in plugin/src/software/aws/toolkits/eclipse/amazonq/views/CustomizationDialog.java [226:301]


    protected Control createDialogArea(final Composite parent) {
        container = (Composite) super.createDialogArea(parent);

        GridLayout mainLayout = new GridLayout(1, false);
        mainLayout.marginWidth = 15;
        mainLayout.marginHeight = 15;
        mainLayout.verticalSpacing = 10;
        container.setLayout(mainLayout);

        titleFont = createFont(14, SWT.BOLD);

        Label titleLabel = new Label(container, SWT.NONE);
        titleLabel.setText("Select an Amazon Q Customization");
        titleLabel.setFont(titleFont);
        titleLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

        Label separator = new Label(container, SWT.HORIZONTAL | SWT.SEPARATOR);
        separator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

        Boolean isDefaultAmazonQFoundationSelected = this.responseSelection
                .equals(ResponseSelection.AMAZON_Q_FOUNDATION_DEFAULT);

        RadioButtonWithDescriptor defaultAmazonQFoundationButton = createRadioButton(container,
                "Amazon Q foundation (Default)", "Receive suggestions from Amazon Q base model.", SWT.NONE,
                isDefaultAmazonQFoundationSelected);
        RadioButtonWithDescriptor customizationButton = createRadioButton(container, "Customization",
                "Receive Amazon Q suggestions based on your company's codebase.", SWT.NONE,
                !isDefaultAmazonQFoundationSelected);

        defaultAmazonQFoundationButton.addSelectionListener(() -> {
            customizationButton.setSelection(false);
            defaultAmazonQFoundationButton.setSelection(true);
            responseSelection = ResponseSelection.AMAZON_Q_FOUNDATION_DEFAULT;
            setSelectedCustomization(null);
            combo.setEnabled(false);
        });
        customizationButton.addSelectionListener(() -> {
            defaultAmazonQFoundationButton.setSelection(false);
            customizationButton.setSelection(true);
            responseSelection = ResponseSelection.CUSTOMIZATION;
            combo.setEnabled(true);
        });

        Composite comboComposite = new Composite(container, SWT.NONE);
        GridLayout comboLayout = new GridLayout(1, false);
        comboLayout.marginWidth = 0;
        comboLayout.marginHeight = 0;
        comboLayout.marginLeft = 20;
        comboLayout.verticalSpacing = 0;
        comboComposite.setLayout(comboLayout);

        GridData comboCompositeData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
        comboCompositeData.verticalIndent = 0;
        comboComposite.setLayoutData(comboCompositeData);

        combo = new Combo(comboComposite, SWT.READ_ONLY | SWT.DROP_DOWN);

        GridData comboData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
        comboData.verticalIndent = 0;
        comboData.grabExcessHorizontalSpace = true;
        comboData.horizontalSpan = 2;
        combo.setLayoutData(comboData);

        GridData containerData = new GridData(GridData.FILL_HORIZONTAL);
        containerData.heightHint = SWT.DEFAULT; // Let the height be determined by contents
        container.setLayoutData(containerData);

        combo.setItems(new String[]{"Loading..."});
        combo.select(0);
        combo.setEnabled(false);

        CompletableFuture.supplyAsync(() -> getCustomizations()).thenAcceptAsync(
                customizations -> updateComboOnUIThread(customizations), Display.getDefault()::asyncExec);

        return container;
    }