下面列出了org.eclipse.ui.forms.widgets.TableWrapData#FILL_GRAB 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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);
}
private void createPluginsSection(Composite parent) {
Section sctnPlugins = createSection(parent, "Plug-ins");
sctnPlugins.setLayout(FormUtils.createClearTableWrapLayout(false, 1));
TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
sctnPlugins.setLayoutData(data);
FormText text = formToolkit.createFormText(sctnPlugins, true);
ImageDescriptor idesc = HybridUI.getImageDescriptor(HybridUI.PLUGIN_ID, "/icons/etool16/cordovaplug_wiz.png");
text.setImage("plugin", idesc.createImage());
text.setText(PLUGINS_SECTION_CONTENT, true, false);
sctnPlugins.setClient(text);
text.addHyperlinkListener(this);
}
@Override
public void createPartControl(Composite parent){
parent.setLayout(new FillLayout());
form = tk.createScrolledForm(parent);
TableWrapLayout twl = new TableWrapLayout();
form.getBody().setLayout(twl);
tblArtikel =
new LabeledInputField.AutoForm(form.getBody(), getFieldDefs(parent.getShell()));
TableWrapData twd = new TableWrapData(TableWrapData.FILL_GRAB);
twd.grabHorizontal = true;
tblArtikel.setLayoutData(twd);
GlobalEventDispatcher.addActivationListener(this, this);
}
public Composite createDisplay(Composite parent, IViewSite site){
form = UiDesk.getToolkit().createForm(parent);
TableWrapLayout twl = new TableWrapLayout();
form.getBody().setLayout(twl);
tblPls = new LabeledInputField.AutoForm(form.getBody(), data);
tblPls.setModelService(ModelServiceHolder.get());
TableWrapData twd = new TableWrapData(TableWrapData.FILL_GRAB);
twd.grabHorizontal = true;
tblPls.setLayoutData(twd);
TableWrapData twd2 = new TableWrapData(TableWrapData.FILL_GRAB);
tComment = UiDesk.getToolkit().createText(form.getBody(), StringTool.leer, SWT.BORDER);
tComment.setLayoutData(twd2);
return form.getBody();
}
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");
}
private void createExportSection(Composite parent) {
Section sctnExport = createSection(parent, "Export");
sctnExport.setLayout(FormUtils.createClearTableWrapLayout(false, 1));
TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
sctnExport.setLayoutData(data);
FormText text = formToolkit.createFormText(sctnExport, true);
ImageDescriptor idesc = HybridUI.getImageDescriptor(HybridUI.PLUGIN_ID, "/icons/etool16/export_wiz.png");
text.setImage("export", idesc.createImage());
text.setText(EXPORT_SECTION_CONTENT, true, false);
sctnExport.setClient(text);
text.addHyperlinkListener(this);
}
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"));
}
public void createControl(Composite parent){
DBImportWizard wiz = (DBImportWizard) getWizard();
FormToolkit tk = UiDesk.getToolkit();
Form form = tk.createForm(parent);
form.setText(Messages.DBImportFirstPage_Connection); //$NON-NLS-1$
Composite body = form.getBody();
body.setLayout(new TableWrapLayout());
tk.createLabel(body, Messages.DBImportFirstPage_EnterType); //$NON-NLS-1$
dbTypes = new List(body, SWT.BORDER);
dbTypes.setItems(supportedDB);
dbTypes.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e){
int it = dbTypes.getSelectionIndex();
switch (it) {
case MYSQL:
case POSTGRESQL:
server.setEnabled(true);
dbName.setEnabled(true);
defaultUser = ""; //$NON-NLS-1$
defaultPassword = ""; //$NON-NLS-1$
break;
case H2:
server.setEnabled(false);
dbName.setEnabled(true);
defaultUser = "sa";
defaultPassword = "";
break;
case ODBC:
server.setEnabled(false);
dbName.setEnabled(true);
defaultUser = "sa"; //$NON-NLS-1$
defaultPassword = ""; //$NON-NLS-1$
break;
default:
break;
}
DBImportSecondPage sec = (DBImportSecondPage) getNextPage();
sec.name.setText(defaultUser);
sec.pwd.setText(defaultPassword);
}
});
tk.adapt(dbTypes, true, true);
tk.createLabel(body, Messages.DBImportFirstPage_serverAddress); //$NON-NLS-1$
server = tk.createText(body, "", SWT.BORDER); //$NON-NLS-1$
TableWrapData twr = new TableWrapData(TableWrapData.FILL_GRAB);
server.setLayoutData(twr);
tk.createLabel(body, Messages.DBImportFirstPage_databaseName); //$NON-NLS-1$
dbName = tk.createText(body, "", SWT.BORDER); //$NON-NLS-1$
TableWrapData twr2 = new TableWrapData(TableWrapData.FILL_GRAB);
dbName.setLayoutData(twr2);
if (wiz.preset != null && wiz.preset.length > 1) {
int idx = StringTool.getIndex(supportedDB, wiz.preset[0]);
if (idx < dbTypes.getItemCount()) {
dbTypes.select(idx);
}
server.setText(wiz.preset[1]);
dbName.setText(wiz.preset[2]);
}
setControl(form);
}
public void createControl(Composite parent){
FormToolkit tk = UiDesk.getToolkit();
Form form = tk.createForm(parent);
form.setText(Messages.DBConnectFirstPage_connectioNDetails); //$NON-NLS-1$
Composite body = form.getBody();
body.setLayout(new TableWrapLayout());
FormText alt = tk.createFormText(body, false);
StringBuilder old = new StringBuilder();
old.append("<form>"); //$NON-NLS-1$
String driver = "";
String user = "";
String typ = "";
String connectString = "";
Hashtable<Object, Object> hConn = null;
String cnt = CoreHub.localCfg.get(Preferences.CFG_FOLDED_CONNECTION, null);
if (cnt != null) {
hConn = PersistentObject.fold(StringTool.dePrintable(cnt));
if (hConn != null) {
driver =
PersistentObject.checkNull(hConn.get(Preferences.CFG_FOLDED_CONNECTION_DRIVER));
connectString =
PersistentObject.checkNull(hConn
.get(Preferences.CFG_FOLDED_CONNECTION_CONNECTSTRING));
user =
PersistentObject.checkNull(hConn.get(Preferences.CFG_FOLDED_CONNECTION_USER));
typ = PersistentObject.checkNull(hConn.get(Preferences.CFG_FOLDED_CONNECTION_TYPE));
}
}
// Check whether we were overridden
String dbUser = System.getProperty(ElexisSystemPropertyConstants.CONN_DB_USERNAME);
String dbPw = System.getProperty(ElexisSystemPropertyConstants.CONN_DB_PASSWORD);
String dbFlavor = System.getProperty(ElexisSystemPropertyConstants.CONN_DB_FLAVOR);
String dbSpec = System.getProperty(ElexisSystemPropertyConstants.CONN_DB_SPEC);
if (dbUser != null && dbPw != null && dbFlavor != null && dbSpec != null) {
old.append("<br/><li><b>Aktuelle Verbindung wurde via Übergabeparameter ans Programm gesetzt!</b></li><br/>"); //$NON-NLS-1$
}
if (ch.rgw.tools.StringTool.isNothing(connectString)) {
old.append("<br/>"); //$NON-NLS-1$
old.append("Keine konfigurierte Verbindung."); //$NON-NLS-1$
} else {
old.append("Konfigurierte Verbindung ist:<br/>"); //$NON-NLS-1$
old.append("<li><b>Typ:</b> ").append(typ).append("</li>"); //$NON-NLS-1$ //$NON-NLS-2$
old.append("<li><b>Treiber</b> ").append(driver).append("</li>"); //$NON-NLS-1$ //$NON-NLS-2$
old.append("<li><b>Verbinde</b> ").append(connectString).append("</li>"); //$NON-NLS-1$ //$NON-NLS-2$
old.append("<li><b>Username</b> ").append(user).append("</li>"); //$NON-NLS-1$ //$NON-NLS-2$
}
if (PersistentObject.getConnection() != null
&& PersistentObject.getConnection().getConnectString() != null) {
old.append("<li><b>Effektiv</b> verwendet wird:").append( //$NON-NLS-1$
PersistentObject.getConnection().getConnectString()).append("</li>"); //$NON-NLS-1$
}
old.append("</form>"); //$NON-NLS-1$
alt.setText(old.toString(), true, false);
// Composite form=new Composite(parent, SWT.BORDER);
Label sep = tk.createSeparator(body, SWT.NONE);
TableWrapData twd = new TableWrapData();
twd.heightHint = 5;
sep.setLayoutData(twd);
tk.createLabel(body, Messages.DBConnectFirstPage_enterType); //$NON-NLS-1$
dbTypes = new Combo(body, SWT.BORDER | SWT.SIMPLE);
dbTypes.setItems(supportedDB);
dbTypes.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e){
int it = dbTypes.getSelectionIndex();
switch (it) {
case 0:
case 1:
server.setEnabled(true);
dbName.setEnabled(true);
defaultUser = "elexis"; //$NON-NLS-1$
defaultPassword = "elexisTest"; //$NON-NLS-1$
break;
case 2:
server.setEnabled(false);
dbName.setEnabled(true);
defaultUser = "sa"; //$NON-NLS-1$
defaultPassword = ""; //$NON-NLS-1$
break;
default:
break;
}
DBConnectSecondPage sec = (DBConnectSecondPage) getNextPage();
sec.name.setText(defaultUser);
sec.pwd.setText(defaultPassword);
}
});
tk.adapt(dbTypes, true, true);
tk.createLabel(body, Messages.DBConnectFirstPage_serevrAddress); //$NON-NLS-1$
server = tk.createText(body, "", SWT.BORDER); //$NON-NLS-1$
TableWrapData twr = new TableWrapData(TableWrapData.FILL_GRAB);
server.setLayoutData(twr);
tk.createLabel(body, Messages.DBConnectFirstPage_databaseName); //$NON-NLS-1$
dbName = tk.createText(body, "", SWT.BORDER); //$NON-NLS-1$
TableWrapData twr2 = new TableWrapData(TableWrapData.FILL_GRAB);
dbName.setLayoutData(twr2);
setControl(form);
}