下面列出了org.eclipse.swt.widgets.Group#getLayout ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Refreshes the specified group to re-set the default spacings that have
* been trashed by the field editors
*
* @param group
*/
void initGroup(Group group) {
GridData gd = (GridData) group.getLayoutData();
gd.grabExcessHorizontalSpace = true;
GridLayout lo = (GridLayout) group.getLayout();
lo.marginWidth = 5;
lo.marginHeight = 5;
}
protected void createStartupModuleComponent(Composite parent) {
Group group = SWTFactory.createGroup(parent, "Available Modules:", 3, 1, GridData.FILL_BOTH);
GridLayout groupLayout = (GridLayout) group.getLayout();
groupLayout.marginBottom = 8;
group.setLayout(groupLayout);
IModulesChangeListener listener = new IModulesChangeListener() {
@Override
public void onModulesChanged() {
updateLaunchConfigurationDialog();
}
};
entryPointModulesBlock = new EntryPointModulesSelectionBlock(listener);
entryPointModulesBlock.doFillIntoGrid(group, 3);
}
protected void createStartupModuleComponent(Composite parent) {
Group group = SWTFactory.createGroup(parent, "Available Modules:", 3, 1, GridData.FILL_BOTH);
GridLayout groupLayout = (GridLayout) group.getLayout();
groupLayout.marginBottom = 8;
group.setLayout(groupLayout);
IModulesChangeListener listener = new IModulesChangeListener() {
@Override
public void onModulesChanged() {
updateLaunchConfigurationDialog();
}
};
entryPointModulesSelectionBlock = new EntryPointModulesSelectionBlock(listener);
entryPointModulesSelectionBlock.doFillIntoGrid(group, 3);
}
protected void createStartupModuleComponent(Composite parent) {
Group group = SWTFactory.createGroup(parent, "Available Modules:", 3, 1, GridData.FILL_BOTH);
GridLayout groupLayout = (GridLayout) group.getLayout();
groupLayout.marginBottom = 8;
group.setLayout(groupLayout);
IModulesChangeListener listener = new IModulesChangeListener() {
@Override
public void onModulesChanged() {
updateLaunchConfigurationDialog();
}
};
entryPointModulesBlock = new EntryPointModulesSelectionBlock(listener);
entryPointModulesBlock.doFillIntoGrid(group, 3);
}
private void createEntryPointModulesComponent(Composite parent) {
Group group = SWTFactory.createGroup(parent, "Entry Point Modules", 3, 3, GridData.FILL_BOTH);
GridLayout groupLayout = (GridLayout) group.getLayout();
groupLayout.marginBottom = 8;
group.setLayout(groupLayout);
entryPointModulesBlock = new EntryPointModulesSelectionBlock(null, listener);
entryPointModulesBlock.doFillIntoGrid(group, 3);
}
private void createEntryPointModuleComponent(Composite parent) {
Group group = SWTFactory.createGroup(parent, "Entry Point Modules", 3, 1, GridData.FILL_BOTH);
GridLayout groupLayout = (GridLayout) group.getLayout();
groupLayout.marginBottom = 8;
group.setLayout(groupLayout);
entryPointModulesBlock = new EntryPointModulesSelectionBlock(null);
entryPointModulesBlock.doFillIntoGrid(group, 3);
}
@Override
protected void createFieldEditors() {
Composite composite = new Composite(getFieldEditorParent(), SWT.NONE);
GridLayoutFactory.fillDefaults() //
.numColumns(2) //
.margins(5, 8) //
.spacing(5, 20) //
.applyTo(composite);
Group group = new Group(composite, SWT.SHADOW_ETCHED_IN);
GridDataFactory.fillDefaults().span(2, 1).applyTo(group);
group.setText("Allow JSON references in additional contexts");
addField(new BooleanFieldEditor(VALIDATION_REF_SECURITY_DEFINITIONS_OBJECT, "Security Definitions Object",
group));
addField(new BooleanFieldEditor(VALIDATION_REF_SECURITY_SCHEME_OBJECT, "Security Scheme Object", group));
addField(new BooleanFieldEditor(VALIDATION_REF_SECURITY_REQUIREMENTS_ARRAY, "Security Requirements Array",
group));
addField(new BooleanFieldEditor(VALIDATION_REF_SECURITY_REQUIREMENT_OBJECT, "Security Requirement Object",
group));
// FieldEditor set parent layout to GridLayout with margin = 0
((GridLayout) group.getLayout()).marginTop = 8;
((GridLayout) group.getLayout()).marginBottom = 8;
((GridLayout) group.getLayout()).marginLeft = 8;
((GridLayout) group.getLayout()).marginRight = 8;
// Validation
Set<PreferenceProvider> providers = ExtensionUtils.getPreferenceProviders(VALIDATION_PREFERENCE_PAGE);
providers.forEach(provider -> {
for (FieldEditor field : provider.createFields(Version.SWAGGER, composite)) {
addField(field);
}
});
}