Java Code Examples for org.eclipse.ui.forms.widgets.Section#setClient()

The following examples show how to use org.eclipse.ui.forms.widgets.Section#setClient() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TotalImpactResultPage.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
@Override
protected void createFormContent(IManagedForm mform) {
	ScrolledForm form = UI.formHeader(mform,
			Labels.name(setup.productSystem),
			Images.get(result));
	toolkit = mform.getToolkit();
	Composite body = UI.formBody(form, toolkit);
	Section section = UI.section(body, toolkit, M.ImpactAnalysis + ": "
			+ Labels.name(setup.impactMethod));
	UI.gridData(section, true, true);
	Composite client = toolkit.createComposite(section);
	section.setClient(client);
	UI.gridLayout(client, 1);
	createOptions(client);
	createTree(client);
	spinner.register(viewer);
	form.reflow(true);
}
 
Example 2
Source File: ImpactFactorPage.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
@Override
protected void createFormContent(IManagedForm mform) {
	ScrolledForm form = UI.formHeader(this);
	FormToolkit tk = mform.getToolkit();
	Composite body = UI.formBody(form, tk);
	Section section = UI.section(body, tk, M.ImpactFactors);
	UI.gridData(section, true, true);
	Composite client = tk.createComposite(section);
	section.setClient(client);
	UI.gridLayout(client, 1);
	render(client, section);
	List<ImpactFactor> factors = impact().impactFactors;
	sortFactors(factors);
	viewer.setInput(factors);
	form.reflow(true);
}
 
Example 3
Source File: XSPGenPage.java    From XPagesExtensionLibrary with Apache License 2.0 6 votes vote down vote up
private void createBrowserOptions(Composite parent) {
    Section rtSection = XSPEditorUtil.createSection(toolkit, parent, "Rich Text Options", 1, 1); // $NLX-XSPGenPage.RichTextOptions-1$
    Composite rtDCP = XSPEditorUtil.createSectionChild(rtSection, 2);
    rtDCP.setLayoutData(new GridData(SWT.BEGINNING, SWT.FILL, false, false, 1, 1));
    Label lfLabel = XSPEditorUtil.createLabel(rtDCP, "Save links in:", 1); // $NLX-XSPGenPage.Savelinksin-1$
    lfLabel.setToolTipText("Defines how links should be saved in a Domino document"); // $NLX-XSPGenPage.DefineshowlinksshouldbesavedinaDo-1$
    Composite buttonHolder = new Composite(rtDCP, SWT.NONE);
    buttonHolder.setBackground(getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    GridLayout gl = SWTLayoutUtils.createLayoutNoMarginDefaultSpacing(2);
    buttonHolder.setLayout(gl);
    buttonHolder.setLayoutData(new GridData(SWT.BEGINNING, SWT.FILL, false, false, 1, 1));
    XSPEditorUtil.createRadio(buttonHolder, LINK_SAVE_PROP, "Notes format", XSP_SAVE_USE_NOTES, "notesLinks", 1); //  $NON-NLS-2$ $NLX-XSPGenPage.Notesformat-1$
    XSPEditorUtil.createRadio(buttonHolder, LINK_SAVE_PROP, "Web format", XSP_SAVE_USE_WEB, "webLinks", 1); //  $NON-NLS-2$ $NLX-XSPGenPage.Webformat-1$

    rtSection.setClient(rtDCP);   
}
 
Example 4
Source File: IndexControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createIndexDescriptionSection(Composite parent, DataBindingContext ctx) {
    Section section = formPage.getToolkit().createSection(parent, Section.EXPANDED);
    section.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    section.setLayout(GridLayoutFactory.fillDefaults().create());
    section.setText(Messages.description);

    Composite client = formPage.getToolkit().createComposite(section);
    client.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    client.setLayout(GridLayoutFactory.fillDefaults().margins(10, 10).create());

    IObservableValue descriptionObservable = EMFObservables.observeDetailValue(Realm.getDefault(),
            selectedIndexObservable, BusinessDataModelPackage.Literals.INDEX__DESCRIPTION);

    new TextAreaWidget.Builder()
            .widthHint(500)
            .heightHint(70)
            .bindTo(descriptionObservable)
            .inContext(ctx)
            .adapt(formPage.getToolkit())
            .createIn(client);

    section.setClient(client);
}
 
Example 5
Source File: ImpactNwPage.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
@Override
protected void createFormContent(IManagedForm managedForm) {
	form = UI.formHeader(this);
	toolkit = managedForm.getToolkit();
	Composite body = UI.formBody(form, toolkit);
	Section section = UI.section(body, toolkit,
			M.NormalizationWeightingSets);
	UI.gridData(section, true, true);
	Composite client = toolkit.createComposite(section);
	section.setClient(client);
	UI.gridLayout(client, 1);
	SashForm sashForm = createSash(client);
	setViewer = createNwSetViewer(section, sashForm);
	factorViewer = new NwFactorViewer(sashForm, editor);
	sashForm.setWeights(new int[] { 25, 75 });
	setViewer.selectFirst();
	body.setFocus();
	form.reflow(true);
	editor.getEventBus().register(this);
	editor.onSaved(() -> updateInput());
}
 
Example 6
Source File: FilesPage.java    From typescript.java with MIT License 6 votes vote down vote up
private void createScopeSection(Composite parent) {
	FormToolkit toolkit = super.getToolkit();
	Section section = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR);
	section.setDescription(TsconfigEditorMessages.FilesPage_ScopeSection_desc);
	section.setText(TsconfigEditorMessages.FilesPage_ScopeSection_title);
	TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
	section.setLayoutData(data);

	Composite client = toolkit.createComposite(section);
	section.setClient(client);
	GridLayout layout = new GridLayout();
	layout.numColumns = 1;
	layout.marginWidth = 2;
	layout.marginHeight = 2;
	client.setLayout(layout);

	Table table = toolkit.createTable(client, SWT.NONE);
	GridData gd = new GridData(GridData.FILL_BOTH);
	gd.heightHint = 200;
	gd.widthHint = 100;
	table.setLayoutData(gd);
}
 
Example 7
Source File: BusinessDataModelFormPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void createMavenArtifactPropertiesGroup(Composite parent, DataBindingContext ctx) {
    Section section = formPage.getToolkit().createSection(parent, Section.EXPANDED);
    section.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    section.setLayout(GridLayoutFactory.fillDefaults().create());
    section.setText(Messages.mavenArtifactProperties);

    Composite client = formPage.getToolkit().createComposite(section);
    client.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    client.setLayout(GridLayoutFactory.fillDefaults().margins(5, 10).create());

    new TextWidget.Builder()
            .withLabel(Messages.groupId)
            .labelAbove()
            .fill()
            .withTootltip(Messages.mavenArtifactPropertiesHint)
            .grabHorizontalSpace()
            .bindTo(EMFObservables.observeDetailValue(Realm.getDefault(), formPage.observeWorkingCopy(),
                    BusinessDataModelPackage.Literals.BUSINESS_OBJECT_MODEL__GROUP_ID))
            .withTargetToModelStrategy(UpdateStrategyFactory.updateValueStrategy()
                    .withValidator(new GroupIdValidator(formPage.getRepositoryAccessor().getWorkspace()))
                    .create())
            .inContext(ctx)
            .adapt(formPage.getToolkit())
            .createIn(client);

    formPage.getToolkit().createLabel(client, "");

    section.setClient(client);
}
 
Example 8
Source File: ServiceActivatorPropertiesEditionPartForm.java    From eip-designer with Apache License 2.0 5 votes vote down vote up
/**
 * 
 */
protected Composite createPropertiesGroup(FormToolkit widgetFactory, final Composite parent) {
	Section propertiesSection = widgetFactory.createSection(parent, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
	propertiesSection.setText(EipMessages.ServiceActivatorPropertiesEditionPart_PropertiesGroupLabel);
	GridData propertiesSectionData = new GridData(GridData.FILL_HORIZONTAL);
	propertiesSectionData.horizontalSpan = 3;
	propertiesSection.setLayoutData(propertiesSectionData);
	Composite propertiesGroup = widgetFactory.createComposite(propertiesSection);
	GridLayout propertiesGroupLayout = new GridLayout();
	propertiesGroupLayout.numColumns = 3;
	propertiesGroup.setLayout(propertiesGroupLayout);
	propertiesSection.setClient(propertiesGroup);
	return propertiesGroup;
}
 
Example 9
Source File: ServiceInvocationPropertiesEditionPartForm.java    From eip-designer with Apache License 2.0 5 votes vote down vote up
/**
 * 
 */
protected Composite createPropertiesGroup(FormToolkit widgetFactory, final Composite parent) {
	Section propertiesSection = widgetFactory.createSection(parent, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
	propertiesSection.setText(EipMessages.ServiceInvocationPropertiesEditionPart_PropertiesGroupLabel);
	GridData propertiesSectionData = new GridData(GridData.FILL_HORIZONTAL);
	propertiesSectionData.horizontalSpan = 3;
	propertiesSection.setLayoutData(propertiesSectionData);
	Composite propertiesGroup = widgetFactory.createComposite(propertiesSection);
	GridLayout propertiesGroupLayout = new GridLayout();
	propertiesGroupLayout.numColumns = 3;
	propertiesGroup.setLayout(propertiesGroupLayout);
	propertiesSection.setClient(propertiesGroup);
	return propertiesGroup;
}
 
Example 10
Source File: ProcessResultPage.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private void createFlowSection(Composite parent) {
	Section section = UI.section(parent, toolkit,
			M.FlowContributionsToProcessResults);
	UI.gridData(section, true, true);
	Composite comp = toolkit.createComposite(section);
	section.setClient(comp);
	UI.gridLayout(comp, 1);

	Composite container = new Composite(comp, SWT.NONE);
	UI.gridData(container, true, false);
	UI.gridLayout(container, 5);
	UI.formLabel(container, toolkit, M.Process);
	flowProcessViewer = new ProcessViewer(container);
	flowProcessViewer.setInput(processes.values());
	flowProcessViewer.addSelectionChangedListener((selection) -> {
		flowResult.setProcess(selection);
		inputTable.refresh();
		outputTable.refresh();
	});

	UI.formLabel(container, toolkit, M.DontShowSmallerThen);
	flowSpinner = new Spinner(container, SWT.BORDER);
	flowSpinner.setValues(1, 0, 10000, 2, 1, 100);
	toolkit.adapt(flowSpinner);
	toolkit.createLabel(container, "%");
	Controls.onSelect(flowSpinner, (e) -> {
		flowCutOff = flowSpinner.getSelection();
		inputTable.refresh();
		outputTable.refresh();
	});

	Composite resultContainer = new Composite(comp, SWT.NONE);
	resultContainer.setLayout(new GridLayout(2, true));
	UI.gridData(resultContainer, true, true);
	UI.formLabel(resultContainer, M.Inputs);
	UI.formLabel(resultContainer, M.Outputs);
	inputTable = createFlowTable(resultContainer);
	outputTable = createFlowTable(resultContainer);
}
 
Example 11
Source File: OutputPage.java    From typescript.java with MIT License 5 votes vote down vote up
private Composite createBody(Section section) {
	FormToolkit toolkit = super.getToolkit();
	Composite body = toolkit.createComposite(section);
	section.setClient(body);

	GridLayout glayout = new GridLayout();
	glayout.numColumns = 1;
	body.setLayout(glayout);
	return body;
}
 
Example 12
Source File: OverviewPage.java    From typescript.java with MIT License 5 votes vote down vote up
private Composite createBody(Section section) {
	FormToolkit toolkit = super.getToolkit();
	Composite body = toolkit.createComposite(section);
	section.setClient(body);

	GridLayout glayout = new GridLayout();
	glayout.numColumns = 1;
	body.setLayout(glayout);
	return body;
}
 
Example 13
Source File: GatewayPropertiesEditionPartForm.java    From eip-designer with Apache License 2.0 5 votes vote down vote up
/**
 * 
 */
protected Composite createPropertiesGroup(FormToolkit widgetFactory, final Composite parent) {
	Section propertiesSection = widgetFactory.createSection(parent, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
	propertiesSection.setText(EipMessages.GatewayPropertiesEditionPart_PropertiesGroupLabel);
	GridData propertiesSectionData = new GridData(GridData.FILL_HORIZONTAL);
	propertiesSectionData.horizontalSpan = 3;
	propertiesSection.setLayoutData(propertiesSectionData);
	Composite propertiesGroup = widgetFactory.createComposite(propertiesSection);
	GridLayout propertiesGroupLayout = new GridLayout();
	propertiesGroupLayout.numColumns = 3;
	propertiesGroup.setLayout(propertiesGroupLayout);
	propertiesSection.setClient(propertiesGroup);
	return propertiesGroup;
}
 
Example 14
Source File: ManifestHybridEditorPage.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
private void createRemoteDataConnectionArea(Composite parent) {
    Section section = XSPEditorUtil.createSection(_toolkit, parent, "Remote Data Connection", 1, 1); // $NLX-ManifestHybridEditorPage.RemoteDataConnection-1$
    Composite container = XSPEditorUtil.createSectionChild(section, 2);
    
    Label tLabel = XSPEditorUtil.createLabel(container, "Server address:", 1); // $NLX-ManifestHybridEditorPage.Serveraddress-1$
    tLabel.setToolTipText("Fully resolvable public server URL or IP address"); // $NLX-ManifestHybridEditorPage.FullyresolvablepublicserverURLorI-1$
    XSPEditorUtil.createText(container, "appRemoteDataServerAddress", 1, 0, 40); // $NON-NLS-1$

    tLabel = XSPEditorUtil.createLabel(container, "Server name:", 1); // $NLX-ManifestHybridEditorPage.Servername-1$
    tLabel.setToolTipText("Domino abbreviated server name (e.g. crm/acme)"); // $NLX-ManifestHybridEditorPage.Dominoabbreviatedservernameegcrma-1$
    XSPEditorUtil.createText(container, "appRemoteDataServerName", 1, 0, 1); // $NON-NLS-1$

    section.setClient(container);        
}
 
Example 15
Source File: ManifestEditorPage.java    From XPagesExtensionLibrary with Apache License 2.0 4 votes vote down vote up
private void createStagingArea(Composite parent) {
    Section section = XSPEditorUtil.createSection(_toolkit, parent, "Staging Settings", 1, 1); // $NLX-ManifestEditorPage.StagingSettings-1$
    Composite container = XSPEditorUtil.createSectionChild(section, 3);

    // For de-indenting (MB) labels
    // Normal spacing is 20 so reduce to 5
    GridData gd = new GridData();
    gd.horizontalIndent = -15;
    
    Label tLabel = XSPEditorUtil.createLabel(container, "Application name:", 1); // $NLX-ManifestEditorPage.Applicationname-1$
    tLabel.setToolTipText(BluemixUtil.productizeString("The %BM_PRODUCT% application name.")); // $NLX-ManifestEditorPage.TheIBMBluemixapplicationname-1$
    XSPEditorUtil.createText(container, "appName", 2, 0, 2); // $NON-NLS-1$
    
    tLabel = XSPEditorUtil.createLabel(container, "Instances:", 1); // $NLX-ManifestEditorPage.Instances-1$
    tLabel.setToolTipText("Number of instances."); // $NLX-ManifestEditorPage.Numberofinstances-1$
    XSPEditorUtil.createTextNoFill(container, "instances", 2, 0, 6).setValidator(IntegerValidator.positiveInstance); // $NON-NLS-1$

    tLabel = XSPEditorUtil.createLabel(container, "Memory:", 1); // $NLX-ManifestEditorPage.Memory-1$
    tLabel.setToolTipText("Memory for each instance."); // $NLX-ManifestEditorPage.Memoryforeachinstance-1$
    XSPEditorUtil.createTextNoFill(container, "memory", 1, 0, 6).setValidator(IntegerValidator.positiveInstance); // $NON-NLS-1$
    XSPEditorUtil.createLabel(container, "(MB)", 1).setLayoutData(gd); // $NON-NLS-1$

    tLabel = XSPEditorUtil.createLabel(container, "Disk quota:", 1); // $NLX-ManifestEditorPage.Diskquota-1$
    tLabel.setToolTipText("Disk quota for each instance."); // $NLX-ManifestEditorPage.Diskquotaforeachinstance-1$
    XSPEditorUtil.createTextNoFill(container, "diskQuota", 1, 0, 6).setValidator(IntegerValidator.positiveInstance); // $NON-NLS-1$
    XSPEditorUtil.createLabel(container, "(MB)", 1).setLayoutData(gd); // $NON-NLS-1$
    
    tLabel = XSPEditorUtil.createLabel(container, "Build pack:", 1); // $NLX-ManifestEditorPage.Buildpack-1$
    tLabel.setToolTipText("Build pack for the application."); // $NLX-ManifestEditorPage.Buildpackfortheapplication-1$
    DCComboBox bpCombo = XSPEditorUtil.createDCCombo(container, "buildPack", 2, false, false); // $NON-NLS-1$
    bpCombo.setLookup(new BasicLookup(new String[]{"xpages_buildpack"})); // $NON-NLS-1$
    bpCombo.setEditableLabels(true);      
    
    tLabel = XSPEditorUtil.createLabel(container, "Command:", 1); // $NLX-ManifestEditorPage.Command-1$
    tLabel.setToolTipText("Launch command for the application."); // $NLX-ManifestEditorPage.Launchcommandfortheapplication-1$
    DCComboBox cmdCombo = XSPEditorUtil.createDCCombo(container, "command", 2, false, false); // $NON-NLS-1$
    cmdCombo.setLookup(new BasicLookup(new String[]{"/app/launch_xpages_webcontainer"})); // $NON-NLS-1$
    bpCombo.setEditableLabels(true);

    tLabel = XSPEditorUtil.createLabel(container, "Timeout:", 1); // $NLX-ManifestEditorPage.Timeout-1$
    tLabel.setToolTipText("Use the timeout attribute to give your application more time to start."); // $NLX-ManifestEditorPage.Usethetimeoutattributetogiveyoura-1$
    XSPEditorUtil.createTextNoFill(container, "timeout", 1, 0, 6).setValidator(IntegerValidator.positiveInstance); // $NON-NLS-1$
    XSPEditorUtil.createLabel(container, "(seconds)", 1).setLayoutData(gd); // $NLX-ManifestEditorPage.seconds-1$

    tLabel = XSPEditorUtil.createLabel(container, "Path:", 1); // $NLX-ManifestEditorPage.Path-1$
    tLabel.setToolTipText(BluemixUtil.productizeString("Use the path attribute to tell %BM_PRODUCT% where to find your application.")); // $NLX-ManifestEditorPage.UsethepathattributetotellIBMBluemixw-1$
    XSPEditorUtil.createText(container, "path", 2, 0, 1); // $NON-NLS-1$
    
    tLabel = XSPEditorUtil.createLabel(container, "Stack:", 1); // $NLX-ManifestEditorPage.Stack-1$
    tLabel.setToolTipText("Use the stack attribute to specify an alternative root filesystem (rootfs) for your application."); // $NLX-ManifestEditorPage.Usethestackattributetospecifyanal-1$
    XSPEditorUtil.createText(container, "stack", 2, 0, 1); // $NON-NLS-1$

    section.setClient(container);        
}
 
Example 16
Source File: CommonGui.java    From CodeCheckerEclipsePlugin with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Creates the resolution method group, and the package directory inputs.
 * 
 * @param toolkit
 *            The toolkit to be used.
 * @return The encapsulating Section.
 */
private Section createConfigSection(FormToolkit toolkit) {

    final Section packageConfigSection = toolkit.createSection(form.getBody(),
            ExpandableComposite.SHORT_TITLE_BAR | ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
    packageConfigSection.setEnabled(true);

    final Composite client = toolkit.createComposite(packageConfigSection);
    client.setLayout(new GridLayout(FORM_COLUMNS, false));

    packageConfigSection.setClient(client);
    packageConfigSection.setText("Configuration");

    Group resolutionType = new Group(client, SWT.NULL);
    resolutionType.setText("CodeChecker resolution method.");
    GridLayoutFactory.fillDefaults().numColumns(1).applyTo(resolutionType);
    GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.CENTER)
            .span(FORM_COLUMNS, FORM_ONE_ROW).applyTo(resolutionType);
    resolutionType.setBackground(client.getBackground());

    ccDirClient = toolkit.createComposite(client);
    GridLayoutFactory.fillDefaults().numColumns(FORM_COLUMNS).applyTo(ccDirClient);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(FORM_COLUMNS, FORM_ONE_ROW)
            .applyTo(ccDirClient);
    ccDirClient.setBackground(client.getBackground());

    pathCc = toolkit.createButton(resolutionType, "Search in PATH", SWT.RADIO);
    pathCc.setData(ResolutionMethodTypes.PATH);
    pathCc.addSelectionListener(new PackageResolutionSelectionAdapter());

    preBuiltCc = toolkit.createButton(resolutionType, "Pre built package", SWT.RADIO);
    preBuiltCc.setData(ResolutionMethodTypes.PRE);
    preBuiltCc.addSelectionListener(new PackageResolutionSelectionAdapter());

    codeCheckerDirectoryField = addTextField(toolkit, ccDirClient, CC_BIN_LABEL, "");
    codeCheckerDirectoryField.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            locateCodeChecker();
            refreshDisplay();
        }
    });

    Button codeCheckerDirectoryFieldBrowse = new Button(ccDirClient, SWT.PUSH);
    codeCheckerDirectoryFieldBrowse.setText(BROSWE);
    codeCheckerDirectoryFieldBrowse.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            FileDialog dlg = new FileDialog(client.getShell());
            dlg.setFilterPath(codeCheckerDirectoryField.getText());
            dlg.setText("Browse CodeChecker binary");
            String dir = dlg.open();
            if (dir != null) {
                codeCheckerDirectoryField.setText(dir);
                locateCodeChecker();
                refreshDisplay();
            }
        }
    });

    changeDirectoryInputs();
    return packageConfigSection;

}
 
Example 17
Source File: MessageDialogWithPrompt.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected Control createCustomArea(Composite parent) {
    if (detailsMessage != null) {
        parent.setLayout(GridLayoutFactory.swtDefaults().numColumns(2).create());
        //Above Image filler
        Image image = getImage();
        if (image != null) {
            Label filler = new Label(parent, SWT.NULL);
            filler.setImage(image);
            GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.BEGINNING)
                    .applyTo(filler);
            filler.setVisible(false);
        }

        Section section = new Section(parent,
                Section.TWISTIE | Section.NO_TITLE_FOCUS_BOX | Section.CLIENT_INDENT);
        section.setText(Messages.moreDetails);
        section.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

        Composite client = new Composite(section, SWT.NONE);
        client.setLayoutData(GridDataFactory.fillDefaults().create());
        client.setLayout(GridLayoutFactory.fillDefaults().create());

        Link detailsLabel = new Link(client, getMessageLabelStyle());
        linkSelectionListener.ifPresent(listener -> detailsLabel.addListener(SWT.Selection, listener));
        detailsLabel.setText(detailsMessage);
        GridDataFactory
                .fillDefaults()
                .align(SWT.FILL, SWT.BEGINNING)
                .grab(true, false)
                .hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH),
                        SWT.DEFAULT)
                .applyTo(detailsLabel);
        section.setClient(client);
        section.addExpansionListener(new ExpansionAdapter() {

            @Override
            public void expansionStateChanged(ExpansionEvent e) {
                parent.getShell().pack();
            }
        });
        return section;
    }
    return super.createCustomArea(parent);
}
 
Example 18
Source File: ApplicationOverviewEditorPart.java    From codewind-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public ProjectLinkSection(Composite parent, FormToolkit toolkit, int hSpan, int vSpan) {
	Section section = toolkit.createSection(parent, ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
       section.setText(Messages.AppOverviewEditorProjectLinksSection);
       section.setLayoutData(new GridData(SWT.FILL,SWT.FILL, true, false, hSpan, vSpan));
       section.setExpanded(true);

       Composite composite = toolkit.createComposite(section);
       GridLayout layout = new GridLayout();
       layout.numColumns = 2;
       layout.marginHeight = 5;
       layout.marginWidth = 10;
       layout.verticalSpacing = 10;
       layout.horizontalSpacing = 10;
       composite.setLayout(layout);
       composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
       toolkit.paintBordersFor(composite);
       section.setClient(composite);
       
	// Link description and manage link
	toLinkDescriptionText = new Text(composite, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY);
	toLinkDescriptionText.setText(Messages.AppOverviewEditorProjectLinksNoLinks);
	toLinkDescriptionText.setData(FormToolkit.KEY_DRAW_BORDER, Boolean.FALSE);
	toLinkDescriptionText.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false));
	IDEUtil.paintBackgroundToMatch(toLinkDescriptionText, composite);

	Hyperlink manageLink = toolkit.createHyperlink(composite, Messages.AppOverviewEditorProjectLinksManageLinks, SWT.WRAP);
	GridData data = new GridData(GridData.END, GridData.BEGINNING, false, false);
	manageLink.setLayoutData(data);

	manageLink.addHyperlinkListener(new HyperlinkAdapter() {
		@Override
		public void linkActivated(org.eclipse.ui.forms.events.HyperlinkEvent e) {
			final CodewindConnection conn = getConn();
			final CodewindApplication app = getApp(conn);
			ManageLinksAction.openManageLinksDialog(app);
		}
	});

	// Link table
	toLinkTable = new LinkTable(composite, toolkit, Messages.LinkMgmtProjectColumn);

	// From link description
	fromLinkDescriptionText = new Text(composite, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY);
	fromLinkDescriptionText.setText(Messages.AppOverviewEditorProjectLinksNoFromLinks);
	fromLinkDescriptionText.setData(FormToolkit.KEY_DRAW_BORDER, Boolean.FALSE);
	fromLinkDescriptionText.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false, 2, 1));
	IDEUtil.paintBackgroundToMatch(fromLinkDescriptionText, composite);

	// From link table
	fromLinkTable = new LinkTable(composite, toolkit, Messages.AppOverviewEditorProjectLinksSourceProject);

	// Initialize
	toLinkTable.tableComp.setVisible(false);
	((GridData) toLinkTable.tableComp.getLayoutData()).exclude = true;

	fromLinkTable.tableComp.setVisible(false);
	((GridData) fromLinkTable.tableComp.getLayoutData()).exclude = true;
}
 
Example 19
Source File: ListComponentSectionPage.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected void createFormContent(IManagedForm managedForm) {

	// Get the parent form and the toolkit
	final ScrolledForm scrolledForm = managedForm.getForm();
	final FormToolkit formToolkit = managedForm.getToolkit();

	// Set a GridLayout with a single column. Remove the default margins.
	GridLayout layout = new GridLayout(1, true);
	layout.marginWidth = 0;
	layout.marginHeight = 0;
	scrolledForm.getBody().setLayout(layout);

	// Only create something if there is valid input.
	if (list != null) {

		// Get the parent
		Composite parent = managedForm.getForm().getBody();

		shell = parent.getShell();
		// Create the section and set its layout info
		Section listSection = formToolkit.createSection(parent,
				ExpandableComposite.TITLE_BAR | Section.DESCRIPTION
						| ExpandableComposite.TWISTIE
						| ExpandableComposite.EXPANDED
						| ExpandableComposite.COMPACT);
		listSection.setLayout(new GridLayout(1, false));
		listSection.setLayoutData(
				new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		// Create the section client, which is the client area of the
		// section that will actually render data.
		sectionClient = new Composite(listSection, SWT.FLAT);
		sectionClient.setLayout(new GridLayout(2, false));
		sectionClient.setLayoutData(
				new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		// Fixes section header bug where label color is spammed
		sectionClient.setBackground(
				Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		// Fixes background color bug for NatTable
		sectionClient.setBackgroundMode(SWT.INHERIT_FORCE);

		// Draws the table and sets that instance variable
		table = new ListComponentNattable(sectionClient, list, true);

		// Create the buttons for add, delete, up, and down
		createButtons();

		// Set the section client.
		listSection.setClient(sectionClient);
	}

	return;
}
 
Example 20
Source File: EssentialsPage.java    From thym with Eclipse Public License 1.0 3 votes vote down vote up
private void createNameDescriptionSection(Composite parent) {
	Section sctnNameAndDescription = createSection(parent, "Name and Description");
	sctnNameAndDescription.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));

	Composite container = formToolkit.createComposite(sctnNameAndDescription, SWT.WRAP);
	formToolkit.paintBordersFor(container);
	sctnNameAndDescription.setClient(container);
	container.setLayout(FormUtils.createSectionClientGridLayout(false, 2));

	GridData textGridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);

	createFormFieldLabel(container, "ID:");

	txtIdtxt = formToolkit.createText(container, "", SWT.NONE);
	txtIdtxt.setLayoutData(textGridData);

	createFormFieldLabel(container, "Name:");

	txtName = formToolkit.createText(container, "", SWT.NONE);
	GridDataFactory.createFrom(textGridData).applyTo(txtName);

	createFormFieldLabel(container, "Version:");

	txtVersion = formToolkit.createText(container, "", SWT.NONE);
	GridDataFactory.createFrom(textGridData).applyTo(txtVersion);

	createFormFieldLabel(container, "Description:");

	txtDescription = formToolkit.createText(container, "", SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
	GridDataFactory.createFrom(textGridData).hint(SWT.DEFAULT, 100).applyTo(txtDescription);

	createFormFieldLabel(container, "Content Source:");

	txtContentsource = formToolkit.createText(container, "", SWT.NONE);
	GridDataFactory.createFrom(textGridData).applyTo(txtContentsource);
}