org.eclipse.ui.forms.widgets.Section#CLIENT_INDENT源码实例Demo

下面列出了org.eclipse.ui.forms.widgets.Section#CLIENT_INDENT 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

public Section createGroupControl(final Composite composite, final Group object) {
    final String desc = getDescription(object.getId());
    int style = Section.NO_TITLE_FOCUS_BOX | Section.TWISTIE | Section.CLIENT_INDENT;
    if (desc != null && !desc.isEmpty()) {
        style = style | Section.DESCRIPTION;
    }
    final Section groupSection = new Section(composite, style);
    groupSection.setText(getLabel(object.getId()));
    groupSection.setFont(BonitaStudioFontRegistry.getBoldFont());
    if (desc != null && !desc.isEmpty()) {
        groupSection.setDescription(desc);
    }
    groupSection.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    groupSection.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(2, 1).create());
    return groupSection;
}
 
private void doCreateWorkspaceTips(Composite mainComposite) {
    Label workspaceTips = new Label(mainComposite, SWT.NONE);
    workspaceTips.setLayoutData(GridDataFactory.fillDefaults().create());
    workspaceTips.setText(Messages.workspaceTips);

    final Section section = new Section(mainComposite, Section.TREE_NODE | Section.CLIENT_INDENT);
    section.setLayout(GridLayoutFactory.fillDefaults().margins(0, 0).create());
    section.setLayoutData(
            GridDataFactory.swtDefaults().align(SWT.FILL, SWT.TOP).hint(200, SWT.DEFAULT)
                    .grab(true, false).create());
    section.setText(Messages.moreInfo);
    Label label = new Label(section, SWT.WRAP);
    label.setLayoutData(GridDataFactory.swtDefaults().create());
    label.setText(Messages.importWorkspaceOverwriteBehavior);
    section.setClient(label);
    section.setExpanded(false);
    section.addExpansionListener(new UpdateLayoutListener(mainComposite));
}
 
private Section createStatusSection(Composite parent) {
    final Section section = new Section(parent, Section.TREE_NODE | Section.CLIENT_INDENT);
    section.setLayout(GridLayoutFactory.fillDefaults().create());
    section.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    section.setText(Messages.importDetails);
    section.addExpansionListener(new UpdateLayoutListener(parent));
    section.setExpanded(false);
    return section;
}
 
源代码4 项目: bonita-studio   文件: MessageDialogWithPrompt.java
@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);
}