下面列出了org.eclipse.ui.forms.widgets.Section#setDescription ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Constructs a section and returns a section client composite
*
* the section layout is TableWrapLayout
*
*
* @param parent parent container for the section
* @param title title of the section
* @param description description of the section
* @param toolkit toolkit to create the composite
* @param sectionFlags parameters of the section
* @param expansionListener
* @return a section client (the content container of the section)
*/
public static Section createSectionComposite(Composite parent, String title, String description,
FormToolkit toolkit, int sectionFlags, IExpansionListener expansionListener)
{
final Section section = toolkit.createSection(parent, sectionFlags);
section.setData(SECTION_IS_NOT_SPACE_GRABBING, new Object());
section.setText(title);
section.setDescription(description);
if (expansionListener != null)
{
section.addExpansionListener(expansionListener);
}
// create section client
Composite sectionClient = toolkit.createComposite(section);
TableWrapLayout layout = new TableWrapLayout();
layout.numColumns = 1;
sectionClient.setLayout(layout);
section.setClient(sectionClient);
// draw flat borders
toolkit.paintBordersFor(sectionClient);
return section;
}
private void createGeneralInformationSection(Composite parent) {
FormToolkit toolkit = super.getToolkit();
Section section = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR);
section.setDescription(TsconfigEditorMessages.OverviewPage_GeneralInformationSection_desc);
section.setText(TsconfigEditorMessages.OverviewPage_GeneralInformationSection_title);
TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
section.setLayoutData(data);
Composite body = createBody(section);
// Target/Module
createCombo(body, TsconfigEditorMessages.OverviewPage_target_label, new JSONPath("compilerOptions.target"),
TsconfigJson.getAvailableTargets(), TsconfigJson.getDefaultTarget());
createCombo(body, TsconfigEditorMessages.OverviewPage_module_label, new JSONPath("compilerOptions.module"),
TsconfigJson.getAvailableModules());
createCombo(body, TsconfigEditorMessages.OverviewPage_moduleResolution_label,
new JSONPath("compilerOptions.moduleResolution"), TsconfigJson.getAvailableModuleResolutions(),
TsconfigJson.getDefaultModuleResolution());
// Others....
createCheckbox(body, TsconfigEditorMessages.OverviewPage_experimentalDecorators_label,
new JSONPath("compilerOptions.experimentalDecorators"));
}
private void createDebuggingSection(Composite parent) {
FormToolkit toolkit = super.getToolkit();
Section section = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR);
section.setDescription(TsconfigEditorMessages.OutputPage_DebuggingSection_desc);
section.setText(TsconfigEditorMessages.OutputPage_DebuggingSection_title);
TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
section.setLayoutData(data);
Composite body = createBody(section);
createCheckbox(body, TsconfigEditorMessages.OutputPage_sourceMap_label,
new JSONPath("compilerOptions.sourceMap"));
createTextAndBrowseButton(body, TsconfigEditorMessages.OutputPage_sourceRoot_label,
new JSONPath("compilerOptions.sourceRoot"), false);
createTextAndBrowseButton(body, TsconfigEditorMessages.OutputPage_mapRoot_label,
new JSONPath("compilerOptions.mapRoot"), false);
createCheckbox(body, TsconfigEditorMessages.OutputPage_inlineSourceMap_label,
new JSONPath("compilerOptions.inlineSourceMap"));
createCheckbox(body, TsconfigEditorMessages.OutputPage_inlineSources_label,
new JSONPath("compilerOptions.inlineSources"));
}
private void createReportingSection(Composite parent) {
FormToolkit toolkit = super.getToolkit();
Section section = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR);
section.setDescription(TsconfigEditorMessages.OutputPage_ReportingSection_desc);
section.setText(TsconfigEditorMessages.OutputPage_ReportingSection_title);
TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
section.setLayoutData(data);
Composite body = createBody(section);
createCheckbox(body, TsconfigEditorMessages.OutputPage_diagnostics_label,
new JSONPath("compilerOptions.diagnostics"));
createCheckbox(body, TsconfigEditorMessages.OutputPage_pretty_label, new JSONPath("compilerOptions.pretty"));
createCheckbox(body, TsconfigEditorMessages.OutputPage_traceResolution_label,
new JSONPath("compilerOptions.traceResolution"));
createCheckbox(body, TsconfigEditorMessages.OutputPage_listEmittedFiles_label,
new JSONPath("compilerOptions.listEmittedFiles"));
}
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);
}
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 createOutputSection(Composite parent) {
FormToolkit toolkit = super.getToolkit();
Section section = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR);
section.setDescription(TsconfigEditorMessages.OutputPage_OutputSection_desc);
section.setText(TsconfigEditorMessages.OutputPage_OutputSection_title);
TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
section.setLayoutData(data);
Composite body = createBody(section);
createTextAndBrowseButton(body, TsconfigEditorMessages.OutputPage_rootDir_label,
new JSONPath("compilerOptions.rootDir"), false);
createTextAndBrowseButton(body, TsconfigEditorMessages.OutputPage_outFile_label,
new JSONPath("compilerOptions.outFile"), true);
createTextAndBrowseButton(body, TsconfigEditorMessages.OutputPage_outDir_label,
new JSONPath("compilerOptions.outDir"), false);
createCheckbox(body, TsconfigEditorMessages.OutputPage_noEmit_label, new JSONPath("compilerOptions.noEmit"));
createCheckbox(body, TsconfigEditorMessages.OutputPage_noEmitHelpers_label,
new JSONPath("compilerOptions.noEmitHelpers"));
createCheckbox(body, TsconfigEditorMessages.OutputPage_noEmitOnError_label,
new JSONPath("compilerOptions.noEmitOnError"));
createCheckbox(body, TsconfigEditorMessages.OutputPage_emitDecoratorMetadata_label,
new JSONPath("compilerOptions.emitDecoratorMetadata"));
createCheckbox(body, TsconfigEditorMessages.OutputPage_declaration_label,
new JSONPath("compilerOptions.declaration"));
createTextAndBrowseButton(body, TsconfigEditorMessages.OutputPage_declarationDir_label,
new JSONPath("compilerOptions.declarationDir"), false);
createCheckbox(body, TsconfigEditorMessages.OutputPage_emitBOM_label, new JSONPath("compilerOptions.emitBOM"));
createCheckbox(body, TsconfigEditorMessages.OutputPage_preserveConstEnums_label,
new JSONPath("compilerOptions.preserveConstEnums"));
createCheckbox(body, TsconfigEditorMessages.OutputPage_removeComments_label,
new JSONPath("compilerOptions.removeComments"));
createCheckbox(body, TsconfigEditorMessages.OutputPage_isolatedModules_label,
new JSONPath("compilerOptions.isolatedModules"));
createCheckbox(body, TsconfigEditorMessages.OutputPage_stripInternal_label,
new JSONPath("compilerOptions.stripInternal"));
}
private void createJSXSection(Composite parent) {
FormToolkit toolkit = super.getToolkit();
Section section = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR);
section.setDescription(TsconfigEditorMessages.OutputPage_JSXSection_desc);
section.setText(TsconfigEditorMessages.OutputPage_JSXSection_title);
TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
section.setLayoutData(data);
Composite body = createBody(section);
CCombo jsxCombo = createCombo(body, TsconfigEditorMessages.OutputPage_jsx_label,
new JSONPath("compilerOptions.jsx"), new String[] { "", "preserve", "react" });
Text reactNamespaceText = createText(body, TsconfigEditorMessages.OutputPage_reactNamespace_label,
new JSONPath("compilerOptions.reactNamespace"), null, "jsxFactory");
}
/**
* <p>
* This operation reads the MatrixComponent assigned to this SectionPart and
* renders the view of that data for the user.
* </p>
*
*/
public void renderSection() {
// Get this SectionPart's reference to the
// underlying Section
Section section = getSection();
// Set the description and title for this SectionPart
section.setDescription(matrixComponent.getDescription());
section.setText(matrixComponent.getName());
// Set this SectionParts reference to the underlying SWT Composite
sectionClient = parentForm.getToolkit().createComposite(section);
// Set the Composite's layout
sectionClient.setLayout(new GridLayout(2, false));
// Construct the JFace TableViewer and its controlling buttons
setupTableViewer();
setupButtons();
// Add an ExpansionListener to this Section
section.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(ExpansionEvent e) {
parentForm.reflow(true);
}
});
// Set the Composite on this Section
section.setClient(sectionClient);
return;
}
/**
* This operation sets the properties (text, tooltip, etc.) for the Section
* based on the data from the ICE DataComponent.
*/
protected void setSectionProperties() {
// Local Declarations
Section section = getSection();
// Add a description and title
section.setDescription(dataComp.getDescription());
section.setText(dataComp.getName());
}
/**
* <p>
* This operation reads the TableComponent assigned to this SectionPart and
* renders the view of that data for the user.
* </p>
*
*/
public void renderSection() {
// Local Declarations
Section section = getSection();
// Add the main description and title to the section
section.setDescription(tableComponent.getDescription());
section.setText(tableComponent.getName());
// setup the composite given the IManagedForm (parentForm)
// and the section of this sectionPart.
sectionClient = parentForm.getToolkit().createComposite(section);
// Set the layout to have three columns.
// Sets the table to take up one column, and the
// add and delete buttons take the next column.
sectionClient.setLayout(new GridLayout(2, false));
// Setup the tableComponentViewer and buttons
this.setupTableViewer();
this.setupButtons();
// Set an expansion listener in order to control the
// sectionPart's visibility to the user.
section.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(ExpansionEvent e) {
parentForm.reflow(true);
}
});
// Add the sectionClient Composite to the sectionPart.
section.setClient(sectionClient);
return;
}
private void createValidatingSection(Composite parent) {
FormToolkit toolkit = super.getToolkit();
Section section = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR);
section.setDescription(TsconfigEditorMessages.OverviewPage_ValidatingSection_desc);
section.setText(TsconfigEditorMessages.OverviewPage_ValidatingSection_title);
TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
section.setLayoutData(data);
Composite body = createBody(section);
createCheckbox(body, TsconfigEditorMessages.OverviewPage_noImplicitAny_label,
new JSONPath("compilerOptions.noImplicitAny"));
createCheckbox(body, TsconfigEditorMessages.OverviewPage_noImplicitThis_label,
new JSONPath("compilerOptions.noImplicitThis"));
createCheckbox(body, TsconfigEditorMessages.OverviewPage_noUnusedLocals_label,
new JSONPath("compilerOptions.noUnusedLocals"));
createCheckbox(body, TsconfigEditorMessages.OverviewPage_noUnusedParameters_label,
new JSONPath("compilerOptions.noUnusedParameters"));
createCheckbox(body, TsconfigEditorMessages.OverviewPage_skipDefaultLibCheck_label,
new JSONPath("compilerOptions.skipDefaultLibCheck"));
createCheckbox(body, TsconfigEditorMessages.OverviewPage_skipLibCheck_label,
new JSONPath("compilerOptions.skipLibCheck"));
createCheckbox(body, TsconfigEditorMessages.OverviewPage_suppressExcessPropertyErrors_label,
new JSONPath("compilerOptions.suppressExcessPropertyErrors"));
createCheckbox(body, TsconfigEditorMessages.OverviewPage_suppressImplicitAnyIndexErrors_label,
new JSONPath("compilerOptions.suppressImplicitAnyIndexErrors"));
createCheckbox(body, TsconfigEditorMessages.OverviewPage_allowUnusedLabels_label,
new JSONPath("compilerOptions.allowUnusedLabels"));
createCheckbox(body, TsconfigEditorMessages.OverviewPage_noImplicitReturns_label,
new JSONPath("compilerOptions.noImplicitReturns"));
createCheckbox(body, TsconfigEditorMessages.OverviewPage_noFallthroughCasesInSwitch_label,
new JSONPath("compilerOptions.noFallthroughCasesInSwitch"));
createCheckbox(body, TsconfigEditorMessages.OverviewPage_allowUnreachableCode_label,
new JSONPath("compilerOptions.allowUnreachableCode"));
createCheckbox(body, TsconfigEditorMessages.OverviewPage_forceConsistentCasingInFileNames_label,
new JSONPath("compilerOptions.forceConsistentCasingInFileNames"));
createCheckbox(body, TsconfigEditorMessages.OverviewPage_allowSyntheticDefaultImports_label,
new JSONPath("compilerOptions.allowSyntheticDefaultImports"));
createCheckbox(body, TsconfigEditorMessages.OverviewPage_strictNullChecks_label,
new JSONPath("compilerOptions.strictNullChecks"));
}