public void createSection()

in plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServerEditorTestEnvSection.java [67:188]


    public void createSection(Composite parent) {
        super.createSection(parent);

        Trace.tracePoint("ENTRY", Activator.traceSections, "ServerEditorTestEnvSection.createSection", parent);

        toolkit = getFormToolkit(parent.getDisplay());

        Section section = toolkit.createSection(parent, ExpandableComposite.TWISTIE
                                                | ExpandableComposite.EXPANDED
                                                | ExpandableComposite.TITLE_BAR
                                                | Section.DESCRIPTION | ExpandableComposite.FOCUS_TITLE);

        section.setText(Messages.editorSectionTestEnvTitle);
        section.setDescription(Messages.editorSectionTestEnvDescription);
        section.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));

        composite = toolkit.createComposite(section);
        GridLayout layout = new GridLayout();
        layout.numColumns = 1;
        layout.marginHeight = 5;
        layout.marginWidth = 10;
        layout.verticalSpacing = 5;
        layout.horizontalSpacing = 15;
        composite.setLayout(layout);
        composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
        section.setClient(composite);

        //
        // inPlaceSharedLib Button
        //
        inPlaceSharedLib = toolkit.createButton(composite, Messages.editorSectionSharedLibrariesInPlace, SWT.CHECK);
        inPlaceSharedLib.setSelection(gs.isInPlaceSharedLib());
        inPlaceSharedLib.addSelectionListener(new SelectionListener() {

            public void widgetSelected(SelectionEvent e) {
                execute(new SetInPlaceSharedLibCommand(server, inPlaceSharedLib.getSelection()));
            }

            public void widgetDefaultSelected(SelectionEvent e) {
            }

        });

        //
        // runFromWorkspace Button
        //
        runFromWorkspace = toolkit.createButton(composite, Messages.editorSectionRunFromWorkspace, SWT.CHECK);
        runFromWorkspace.setSelection(gs.isRunFromWorkspace());
        runFromWorkspace.setEnabled(false); //FIXME disable support until supported
        runFromWorkspace.addSelectionListener(new SelectionListener() {

            public void widgetSelected(SelectionEvent e) {
                execute(new SetRunFromWorkspaceCommand(server, runFromWorkspace.getSelection()));
            }

            public void widgetDefaultSelected(SelectionEvent e) {
            }

        });

        //
        // selectClasspathContainers Button
        //
        selectClasspathContainers = toolkit.createButton(composite, Messages.editorSectionSelectClasspathContainers, SWT.CHECK); 
        selectClasspathContainers.setSelection(gs.isSelectClasspathContainers()); 
        selectClasspathContainers.addSelectionListener(new SelectionListener() { 

            public void widgetSelected(SelectionEvent e) { 
                execute(new SetSelectClasspathContainersCommand(server, selectClasspathContainers.getSelection())); 

                createCheckbox();

                //
                // For any selection change the checkbox will be populated from the workspace. 
                // Changes to individual elements in the checkbox will be handled with the 
                // CheckStateListener below.
                //
                List<String> containers = ClasspathContainersHelper.queryWorkspace();
                checkbox.setInput( containers );
                checkbox.setAllChecked( false );
                if ( selectClasspathContainers.getSelection() ) {
                    checkbox.getTable().setEnabled( true );
                }
                else {
                    checkbox.getTable().setEnabled( false );
                    // Clear any previously selected classpath containers
                    execute(new SetClasspathContainersCommand(server, new Object[] {} ));
                }
            } 

            public void widgetDefaultSelected(SelectionEvent e) { 
            } 
        }); 

        //
        // checkbox CheckboxTableViewer
        //
        createCheckbox();

        //
        // Populate the checkbox from the list of classpath containers in the workspace. If 
        // workspace classpath containers had been previously selected then use the list from the
        // server's instance properties to populate the checkbox. One advantage of this approach
        // is that it will handle cases where new classpath containers are added in the workspace
        // or existing containers are deleted from the workspace. 
        //
        List<String> containers = ClasspathContainersHelper.queryWorkspace();
        checkbox.setInput( containers );

        if ( selectClasspathContainers.getSelection() ) {
            checkbox.getTable().setEnabled( true );
            List<String> checkedContainers = gs.getClasspathContainers();
            for (String container: checkedContainers) {
                checkbox.setChecked( container, true );
            }
        }
        else {
            checkbox.getTable().setEnabled( false );
        }

        Trace.tracePoint("EXIT", Activator.traceSections, "ServerEditorTestEnvSection.createSection");
    }