use of org.eclipse.ui.forms.widgets.FormToolkit in project translationstudio8 by heartsome.
the class ConcordanceSearchDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
tparent = (Composite) super.createDialogArea(parent);
GridLayoutFactory.swtDefaults().spacing(0, 0).extendedMargins(SWT.DEFAULT, SWT.DEFAULT, 0, 0).applyTo(tparent);
// tparent.setLayout(new GridLayout());
GridData parentData = new GridData(GridData.FILL_BOTH);
parentData.widthHint = 1058;
tparent.setLayoutData(parentData);
Group groupSearch = new Group(tparent, SWT.NONE);
GridLayoutFactory.swtDefaults().margins(5, 5).numColumns(3).equalWidth(false).applyTo(groupSearch);
GridDataFactory.fillDefaults().grab(true, false).applyTo(groupSearch);
groupSearch.setText(Messages.getString("dialog.ConcordanceSearchDialog.groupSearch"));
Label lblSearch = new Label(groupSearch, SWT.NONE);
lblSearch.setText(Messages.getString("dialog.ConcordanceSearchDialog.lblSearch"));
GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lblSearch);
cmbSearch = new Combo(groupSearch, SWT.BORDER | SWT.DROP_DOWN);
cmbSearch.setText(strSearchText == null ? "" : InnerTagUtil.resolveTag(strSearchText));
GridData txtData = new GridData();
// 解决在 Windows 下文本框高度太小的问题
// txtData.heightHint = 20;
txtData.widthHint = 610;
cmbSearch.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
btnSearch = new Button(groupSearch, SWT.PUSH);
btnSearch.setText(Messages.getString("dialog.ConcordanceSearchDialog.btnSearch"));
new Label(groupSearch, SWT.NONE);
Composite compCondition = new Composite(groupSearch, SWT.NONE);
GridLayoutFactory.fillDefaults().numColumns(3).equalWidth(false).applyTo(compCondition);
GridDataFactory.fillDefaults().span(2, 1).grab(true, false).applyTo(compCondition);
btnIsCaseSensitive = new Button(compCondition, SWT.CHECK);
btnIsCaseSensitive.setText(Messages.getString("dialog.ConcordanceSearchDialog.btnIsCaseSensitive"));
GridDataFactory.swtDefaults().applyTo(btnIsCaseSensitive);
btnIsIgnoreMark = new Button(compCondition, SWT.CHECK);
btnIsIgnoreMark.setText(Messages.getString("dialog.ConcordanceSearchDialog.btnIsIgnoreMark"));
btnIsIgnoreMark.setSelection(true);
GridDataFactory.swtDefaults().applyTo(btnIsIgnoreMark);
btnApplyRegularExpression = new Button(compCondition, SWT.CHECK);
btnApplyRegularExpression.setText(Messages.getString("dialog.ConcordanceSearchDialog.btnApplyRegularExpression"));
GridDataFactory.swtDefaults().applyTo(btnApplyRegularExpression);
Label lblTM = new Label(groupSearch, SWT.NONE);
lblTM.setText(Messages.getString("dialog.ConcordanceSearchDialog.lblDB"));
GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lblTM);
Composite compDB = new Composite(groupSearch, SWT.NONE);
GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(compDB);
GridDataFactory.fillDefaults().span(2, 1).grab(true, false).applyTo(compDB);
cmbDatabase = new Combo(compDB, SWT.READ_ONLY);
GridDataFactory.swtDefaults().hint(150, SWT.DEFAULT).applyTo(cmbDatabase);
initDatabaseCombo();
btnSelectLang = new Button(compDB, SWT.RIGHT);
// GridData data = new GridData();
// data.widthHint = 150;
// data.heightHint = 27;
// btnSelectLang.setLayoutData(data);
// btnSelectLang.setImage(Activator.getImageDescriptor(ImageConstants.CONCORDANCE_SELECT_LANG).createImage());
// btnSelectLang.addPaintListener(new PaintListener() {
// public void paintControl(PaintEvent e) {
// e.gc.drawText(Messages.getString("dialog.ConcordanceSearchDialog.btnSelectLang"), 5, 5,
// SWT.DRAW_TRANSPARENT);
// }
// });
btnSelectLang.setText(Messages.getString("dialog.ConcordanceSearchDialog.btnSelectLang"));
initLanguageMenu();
FormToolkit toolkit = new FormToolkit(parent.getDisplay());
Group groupFilter = new Group(tparent, SWT.None);
GridLayoutFactory.swtDefaults().margins(5, 5).applyTo(groupFilter);
GridDataFactory.fillDefaults().grab(true, false).applyTo(groupFilter);
groupFilter.setText(Messages.getString("dialog.ConcordanceSearchDialog.groupFilter"));
cmpExpandableFilter = toolkit.createExpandableComposite(groupFilter, ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE);
cmpExpandableFilter.setText(Messages.getString("dialog.ConcordanceSearchDialog.cmpExpandableFilter"));
Composite cmpFilter = toolkit.createComposite(cmpExpandableFilter);
cmpFilter.setLayout(new GridLayout(3, false));
GridDataFactory.fillDefaults().grab(true, false).applyTo(cmpFilter);
cmpExpandableFilter.setBackground(tparent.getBackground());
cmpExpandableFilter.setClient(cmpFilter);
cmpFilter.setBackground(tparent.getBackground());
cmbSrcOrTgt = new Combo(cmpFilter, SWT.READ_ONLY);
GridDataFactory.swtDefaults().hint(100, SWT.DEFAULT).applyTo(cmbSrcOrTgt);
cmbSrcOrTgt.setItems(new String[] { Messages.getString("dialog.ConcordanceSearchDialog.cmbSrcOrTgt1"), Messages.getString("dialog.ConcordanceSearchDialog.cmbSrcOrTgt2") });
cmbSrcOrTgt.setData(Messages.getString("dialog.ConcordanceSearchDialog.cmbSrcOrTgt1"), strSrcLang);
cmbSrcOrTgt.setData(Messages.getString("dialog.ConcordanceSearchDialog.cmbSrcOrTgt2"), strTgtLang);
cmbContain = new Combo(cmpFilter, SWT.READ_ONLY);
GridDataFactory.swtDefaults().hint(100, SWT.DEFAULT).applyTo(cmbContain);
cmbContain.setItems(new String[] { Messages.getString("dialog.ConcordanceSearchDialog.cmbContain1"), Messages.getString("dialog.ConcordanceSearchDialog.cmbContain2") });
cmbContain.setData(Messages.getString("dialog.ConcordanceSearchDialog.cmbContain1"), "LIKE");
cmbContain.setData(Messages.getString("dialog.ConcordanceSearchDialog.cmbContain2"), "NOT LIKE");
cmbFilter = new Combo(cmpFilter, SWT.BORDER | SWT.DROP_DOWN);
GridDataFactory.swtDefaults().hint(410, SWT.DEFAULT).applyTo(cmbFilter);
cmpExpandableFilter.setExpanded(false);
groupTable = new Group(tparent, SWT.None);
GridLayoutFactory.swtDefaults().margins(5, 5).spacing(0, 2).numColumns(1).equalWidth(false).applyTo(groupTable);
GridDataFactory.fillDefaults().hint(740, 450).applyTo(groupTable);
groupTable.setText(Messages.getString("dialog.ConcordanceSearchDialog.groupTable"));
groupTable.setBackground(groupTable.getParent().getBackground());
groupTable.setBackgroundMode(SWT.INHERIT_FORCE);
cmpExpandableFilter.addExpansionListener(new IExpansionListener() {
public void expansionStateChanging(ExpansionEvent e) {
layoutExpandable();
}
public void expansionStateChanged(ExpansionEvent e) {
layoutExpandable();
}
});
jTable = new JaretTable(groupTable, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL) {
public void rowSelectionAdded(IRow row) {
super.rowSelectionAdded(row);
// XPropRow propRow = (XPropRow) row;
// HashMap<String, String> map = (HashMap<String, String>) propRow.getDataMap();
// String strChangeDate = map.get("changeDate");
// // strChangeDate = checkString(strChangeDate == null || strChangeDate.equals("") ? "" :
// CommonFunctions
// // .retGMTdate(strChangeDate));
// strChangeDate = checkString(strChangeDate == null || strChangeDate.equals("") ? "" : strChangeDate);
// String strChangeId = checkString(map.get("changeId"));
// String strDbInfo = checkString(map.get("dbType")) + "/" + checkString(map.get("severName")) + "/"
// + checkString(map.get("dbName"));
// String strProjectInfo = checkString(map.get("projectRef"));
// String strJobInfo = checkString(map.get("jobRef"));
// MessageFormat mf = new MessageFormat(strMsg);
// lblInfo.setText(mf.format(new String[] { strChangeDate, strChangeId, strDbInfo, strProjectInfo,
// strJobInfo }));
}
};
jTable.setLayoutData(new GridData(GridData.FILL_BOTH));
((DefaultTableHeaderRenderer) jTable.getHeaderRenderer()).setAlignment(DefaultTableHeaderRenderer.Alignment.LEFT);
jTable.setHeaderResizeAllowed(false);
jTable.setAllowSorting(false);
jTable.registerCellEditor(String.class, new ReadOnlyTextCellEditor(true));
PropListeningTableModel model = new PropListeningTableModel();
ListPropCol colTag = new ListPropCol("Flag", Messages.getString("dialog.ConcordanceSearchDialog.colTag"), "Flag", -1);
model.addColumn(colTag);
jTable.getTableViewState().setColumnWidth(colTag, 55);
if (strSrcLang != null) {
PropCol ct1 = new PropCol("Source", strSrcLang, "Source");
ct1.setEditable(false);
model.addColumn(ct1);
jTable.getTableViewState().setColumnWidth(ct1, 325);
}
if (strTgtLang != null) {
PropCol col = new PropCol("Target", strTgtLang, "Target");
model.addColumn(col);
jTable.getTableViewState().setColumnWidth(col, 325);
}
for (int i = 0; i < lstLangs.size(); i++) {
String strLang = lstLangs.get(i);
ListPropCol col = new ListPropCol("Target", strLang, "LstTarget", i);
col.setEditable(true);
model.addColumn(col);
jTable.getTableViewState().setColumnWidth(col, 0);
}
PropCol attrCol = new PropCol("Attribute", "Attribute", "Attribute");
attrCol.setEditable(false);
model.addColumn(attrCol);
jTable.getTableViewState().setColumnWidth(attrCol, 325);
tableModel = model;
jTable.setHeaderHeight(20);
jTable.setTableModel(tableModel);
jTable.setDrawHeader(true);
// jTable.getTableViewState().setRowHeightMode(ITableViewState.RowHeightMode.VARIABLE);
jTable.registerCellRenderer(tableModel.getColumn(2), new TextCellRenderer());
colCount = jTable.getColumnCount();
for (int colNum = colCount - 2; colNum >= 3; colNum--) {
IColumn column = jTable.getColumn(colNum);
jTable.registerCellRenderer(tableModel.getColumn(colNum), new TextCellRenderer());
jTable.getTableViewState().setColumnVisible(column, false);
}
ImageCellRender imgRender = new ImageCellRender();
// 表示需要删除标记(记录有标记时要显示的图片)
imgRender.addImageDescriptorMapping(Boolean.FALSE, "1", Activator.getImageDescriptor(ImageConstants.TAG_DELETE));
// 表示需要添加标记(记录有标记时要显示的图片)
imgRender.addImageDescriptorMapping(Boolean.TRUE, "2", Activator.getImageDescriptor(ImageConstants.TAG_ADD));
jTable.registerCellRenderer(tableModel.getColumn(0), imgRender);
jTable.getSelectionModel().setOnlyRowSelectionAllowed(true);
jTable.getSelectionModel().setMultipleSelectionAllowed(false);
Composite cmpPage = new Composite(groupTable, SWT.NONE);
GridLayoutFactory.fillDefaults().spacing(3, 0).extendedMargins(0, 5, 0, 0).numColumns(3).equalWidth(false).applyTo(cmpPage);
cmpPage.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
cmpPage.setBackground(cmpPage.getParent().getBackground());
cmpPage.setBackgroundMode(SWT.INHERIT_FORCE);
new Label(cmpPage, SWT.None).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
ToolBar toolBar = new ToolBar(cmpPage, SWT.NO_FOCUS | SWT.FLAT);
btnFirst = new ToolItem(toolBar, SWT.PUSH);
btnFirst.setImage(firstImage);
btnPre = new ToolItem(toolBar, SWT.NONE);
btnPre.setImage(preImage);
btnNext = new ToolItem(toolBar, SWT.NONE);
btnNext.setImage(nextImage);
btnLast = new ToolItem(toolBar, SWT.NONE);
btnLast.setImage(lastImage);
txtPage = new Text(cmpPage, SWT.BORDER);
GridDataFactory.fillDefaults().hint(80, SWT.DEFAULT).applyTo(txtPage);
readDialogSettings();
updateCombo(cmbSearch, lstSearchHistory);
updateCombo(cmbFilter, lstFilterHistory);
if (!strSearchText.equals("")) {
cmbSearch.setText(strSearchText);
} else if (lstSearchHistory != null && lstSearchHistory.size() > 0) {
cmbSearch.setText(lstSearchHistory.get(0));
}
cmbSearch.setSelection(new Point(0, cmbSearch.getText().length()));
if (lstFilterHistory != null && lstFilterHistory.size() > 0) {
cmbFilter.setText(lstFilterHistory.get(0));
cmbFilter.setSelection(new Point(0, cmbFilter.getText().length()));
}
initListener();
return parent;
}
use of org.eclipse.ui.forms.widgets.FormToolkit in project azure-tools-for-java by Microsoft.
the class AzureNewDockerLoginPage method createControl.
/**
* Create contents of the wizard.
* @param parent
*/
public void createControl(Composite parent) {
Composite mainContainer = new Composite(parent, SWT.NONE);
setControl(mainContainer);
mainContainer.setLayout(new GridLayout(2, false));
dockerHostImportKeyvaultCredsRadioButton = new Button(mainContainer, SWT.RADIO);
GridData gd_dockerHostImportKeyvaultCredsRadioButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_dockerHostImportKeyvaultCredsRadioButton.horizontalIndent = 5;
dockerHostImportKeyvaultCredsRadioButton.setLayoutData(gd_dockerHostImportKeyvaultCredsRadioButton);
dockerHostImportKeyvaultCredsRadioButton.setText("Import credentials from Azure Key Vault:");
dockerHostImportKeyvaultComboBox = new Combo(mainContainer, SWT.READ_ONLY);
GridData gd_dockerHostImportKeyvaultComboBox = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_dockerHostImportKeyvaultComboBox.widthHint = 230;
dockerHostImportKeyvaultComboBox.setLayoutData(gd_dockerHostImportKeyvaultComboBox);
dockerHostNewCredsRadioButton = new Button(mainContainer, SWT.RADIO);
GridData gd_dockerHostNewCredsRadioButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_dockerHostNewCredsRadioButton.horizontalIndent = 5;
dockerHostNewCredsRadioButton.setLayoutData(gd_dockerHostNewCredsRadioButton);
dockerHostNewCredsRadioButton.setText("New log in credentials:");
new Label(mainContainer, SWT.NONE);
credsTabfolder = new TabFolder(mainContainer, SWT.NONE);
GridData gd_credsTabfolder = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 2);
gd_credsTabfolder.heightHint = 235;
credsTabfolder.setLayoutData(gd_credsTabfolder);
vmCredsTableItem = new TabItem(credsTabfolder, SWT.NONE);
vmCredsTableItem.setText("VM Credentials");
Composite vmCredsComposite = new Composite(credsTabfolder, SWT.NONE);
vmCredsTableItem.setControl(vmCredsComposite);
vmCredsComposite.setLayout(new GridLayout(6, false));
Label lblUsername = new Label(vmCredsComposite, SWT.NONE);
GridData gd_lblUsername = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
gd_lblUsername.horizontalIndent = 5;
lblUsername.setLayoutData(gd_lblUsername);
lblUsername.setText("Username:");
dockerHostUsernameTextField = new Text(vmCredsComposite, SWT.BORDER);
GridData gd_dockerHostUsernameTextField = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_dockerHostUsernameTextField.widthHint = 150;
dockerHostUsernameTextField.setLayoutData(gd_dockerHostUsernameTextField);
new Label(vmCredsComposite, SWT.NONE);
new Label(vmCredsComposite, SWT.NONE);
new Label(vmCredsComposite, SWT.NONE);
Label lblPassword = new Label(vmCredsComposite, SWT.NONE);
GridData gd_lblPassword = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
gd_lblPassword.horizontalIndent = 5;
lblPassword.setLayoutData(gd_lblPassword);
lblPassword.setText("Password:");
dockerHostFirstPwdField = new Text(vmCredsComposite, SWT.BORDER | SWT.PASSWORD);
GridData gd_dockerHostFirstPwdField = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_dockerHostFirstPwdField.widthHint = 150;
dockerHostFirstPwdField.setLayoutData(gd_dockerHostFirstPwdField);
dockerHostPwdLabel = new Label(vmCredsComposite, SWT.NONE);
dockerHostPwdLabel.setText("(Optional)");
new Label(vmCredsComposite, SWT.NONE);
new Label(vmCredsComposite, SWT.NONE);
Label lblConfirm = new Label(vmCredsComposite, SWT.NONE);
GridData gd_lblConfirm = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
gd_lblConfirm.horizontalIndent = 5;
lblConfirm.setLayoutData(gd_lblConfirm);
lblConfirm.setText("Confirm:");
dockerHostSecondPwdField = new Text(vmCredsComposite, SWT.BORDER | SWT.PASSWORD);
GridData gd_dockerHostSecondPwdField = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_dockerHostSecondPwdField.widthHint = 150;
dockerHostSecondPwdField.setLayoutData(gd_dockerHostSecondPwdField);
new Label(vmCredsComposite, SWT.NONE);
new Label(vmCredsComposite, SWT.NONE);
new Label(vmCredsComposite, SWT.NONE);
new Label(vmCredsComposite, SWT.NONE);
new Label(vmCredsComposite, SWT.NONE);
new Label(vmCredsComposite, SWT.NONE);
new Label(vmCredsComposite, SWT.NONE);
new Label(vmCredsComposite, SWT.NONE);
new Label(vmCredsComposite, SWT.NONE);
Label lblSsh = new Label(vmCredsComposite, SWT.NONE);
GridData gd_lblSsh = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_lblSsh.horizontalIndent = 5;
lblSsh.setLayoutData(gd_lblSsh);
lblSsh.setText("SSH");
Label label = new Label(vmCredsComposite, SWT.SEPARATOR | SWT.HORIZONTAL);
label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 5, 1));
dockerHostNoSshRadioButton = new Button(vmCredsComposite, SWT.RADIO);
GridData gd_dockerHostNoSshRadioButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1);
gd_dockerHostNoSshRadioButton.horizontalIndent = 5;
dockerHostNoSshRadioButton.setLayoutData(gd_dockerHostNoSshRadioButton);
dockerHostNoSshRadioButton.setText("None");
new Label(vmCredsComposite, SWT.NONE);
new Label(vmCredsComposite, SWT.NONE);
dockerHostAutoSshRadioButton = new Button(vmCredsComposite, SWT.RADIO);
GridData gd_dockerHostAutoSshRadioButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1);
gd_dockerHostAutoSshRadioButton.horizontalIndent = 5;
dockerHostAutoSshRadioButton.setLayoutData(gd_dockerHostAutoSshRadioButton);
dockerHostAutoSshRadioButton.setText("Auto-generate");
new Label(vmCredsComposite, SWT.NONE);
new Label(vmCredsComposite, SWT.NONE);
dockerHostImportSshRadioButton = new Button(vmCredsComposite, SWT.RADIO);
GridData gd_dockerHostImportSshRadioButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1);
gd_dockerHostImportSshRadioButton.horizontalIndent = 5;
dockerHostImportSshRadioButton.setLayoutData(gd_dockerHostImportSshRadioButton);
dockerHostImportSshRadioButton.setText("Import from directory:");
new Label(vmCredsComposite, SWT.NONE);
new Label(vmCredsComposite, SWT.NONE);
dockerHostImportSSHTextField = new Text(vmCredsComposite, SWT.BORDER);
GridData gd_dockerHostImportSSHTextField = new GridData(SWT.FILL, SWT.CENTER, true, false, 5, 1);
gd_dockerHostImportSSHTextField.horizontalIndent = 24;
dockerHostImportSSHTextField.setLayoutData(gd_dockerHostImportSSHTextField);
dockerHostImportSSHBrowseButton = new Button(vmCredsComposite, SWT.NONE);
dockerHostImportSSHBrowseButton.setText("Browse...");
daemonCredsTableItem = new TabItem(credsTabfolder, SWT.NONE);
daemonCredsTableItem.setText("Docker Daemon Credentials");
Composite daemonCredsComposite = new Composite(credsTabfolder, SWT.NONE);
daemonCredsTableItem.setControl(daemonCredsComposite);
daemonCredsComposite.setLayout(new GridLayout(4, false));
Label lblDockerDaemonPort = new Label(daemonCredsComposite, SWT.NONE);
GridData gd_lblDockerDaemonPort = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
gd_lblDockerDaemonPort.horizontalIndent = 5;
lblDockerDaemonPort.setLayoutData(gd_lblDockerDaemonPort);
lblDockerDaemonPort.setText("Docker daemon port:");
dockerDaemonPortTextField = new Text(daemonCredsComposite, SWT.BORDER);
GridData gd_dockerDaemonPortTextField = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_dockerDaemonPortTextField.widthHint = 50;
dockerDaemonPortTextField.setLayoutData(gd_dockerDaemonPortTextField);
new Label(daemonCredsComposite, SWT.NONE);
Label lblTlsSecurity = new Label(daemonCredsComposite, SWT.NONE);
GridData gd_lblTlsSecurity = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_lblTlsSecurity.horizontalIndent = 5;
lblTlsSecurity.setLayoutData(gd_lblTlsSecurity);
lblTlsSecurity.setText("TLS security");
Label label_1 = new Label(daemonCredsComposite, SWT.SEPARATOR | SWT.HORIZONTAL);
label_1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));
dockerHostNoTlsRadioButton = new Button(daemonCredsComposite, SWT.RADIO);
GridData gd_dockerHostNoTlsRadioButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1);
gd_dockerHostNoTlsRadioButton.horizontalIndent = 5;
dockerHostNoTlsRadioButton.setLayoutData(gd_dockerHostNoTlsRadioButton);
dockerHostNoTlsRadioButton.setText("None");
new Label(daemonCredsComposite, SWT.NONE);
dockerHostAutoTlsRadioButton = new Button(daemonCredsComposite, SWT.RADIO);
GridData gd_dockerHostAutoTlsRadioButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1);
gd_dockerHostAutoTlsRadioButton.horizontalIndent = 5;
dockerHostAutoTlsRadioButton.setLayoutData(gd_dockerHostAutoTlsRadioButton);
dockerHostAutoTlsRadioButton.setText("Auto-generate");
new Label(daemonCredsComposite, SWT.NONE);
dockerHostImportTlsRadioButton = new Button(daemonCredsComposite, SWT.RADIO);
GridData gd_dockerHostImportTlsRadioButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1);
gd_dockerHostImportTlsRadioButton.horizontalIndent = 5;
dockerHostImportTlsRadioButton.setLayoutData(gd_dockerHostImportTlsRadioButton);
dockerHostImportTlsRadioButton.setText("Import from directory:");
new Label(daemonCredsComposite, SWT.NONE);
dockerHostImportTLSTextField = new Text(daemonCredsComposite, SWT.BORDER);
GridData gd_dockerHostImportTLSTextField = new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1);
gd_dockerHostImportTLSTextField.horizontalIndent = 24;
dockerHostImportTLSTextField.setLayoutData(gd_dockerHostImportTLSTextField);
dockerHostImportTLSBrowseButton = new Button(daemonCredsComposite, SWT.NONE);
dockerHostImportTLSBrowseButton.setText("Browse...");
dockerHostSaveCredsCheckBox = new Button(mainContainer, SWT.CHECK);
GridData gd_dockerHostSaveCredsCheckBox = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_dockerHostSaveCredsCheckBox.horizontalIndent = 5;
dockerHostSaveCredsCheckBox.setLayoutData(gd_dockerHostSaveCredsCheckBox);
dockerHostSaveCredsCheckBox.setText("Save credentials into a new Azure Key Vault:");
dockerHostNewKeyvaultTextField = new Text(mainContainer, SWT.BORDER);
GridData gd_dockerHostNewKeyvaultTextField = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_dockerHostNewKeyvaultTextField.widthHint = 210;
dockerHostNewKeyvaultTextField.setLayoutData(gd_dockerHostNewKeyvaultTextField);
FormToolkit toolkit = new FormToolkit(mainContainer.getDisplay());
toolkit.getHyperlinkGroup().setHyperlinkUnderlineMode(HyperlinkSettings.UNDERLINE_HOVER);
managedForm = new ManagedForm(mainContainer);
errMsgForm = managedForm.getForm();
errMsgForm.setVisible(false);
// errMsgForm.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
// errMsgForm.setBackground(mainContainer.getBackground());
errDispatcher = managedForm.getMessageManager();
// errDispatcher.addMessage("dockerHostNameTextField", "Test error", null, IMessageProvider.ERROR, dockerHostNameTextField);
// errMsgForm.setMessage("This is an error message", IMessageProvider.ERROR);
initUIMainContainer(mainContainer);
mainContainer.setTabList(new Control[] { dockerHostImportKeyvaultCredsRadioButton, dockerHostImportKeyvaultComboBox, dockerHostNewCredsRadioButton, credsTabfolder, dockerHostSaveCredsCheckBox, dockerHostNewKeyvaultTextField });
}
use of org.eclipse.ui.forms.widgets.FormToolkit in project azure-tools-for-java by Microsoft.
the class AzureExportDockerTlsKeysDialog method createDialogArea.
/**
* Create contents of the dialog.
* @param parent
*/
@Override
protected Control createDialogArea(Composite parent) {
setTitle("Export TLS Certificates");
setMessage(pathToolTip);
Composite area = (Composite) super.createDialogArea(parent);
Composite mainContainer = new Composite(area, SWT.NONE);
mainContainer.setLayout(new GridLayout(2, false));
GridData gd_mainContainer = new GridData(GridData.FILL_BOTH);
gd_mainContainer.widthHint = 524;
mainContainer.setLayoutData(gd_mainContainer);
exportTlsPathTextField = new Text(mainContainer, SWT.BORDER);
exportTlsPathTextField.setToolTipText(pathToolTip);
exportTlsPathTextField.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent event) {
path = (((Text) event.getSource()).getText());
if (path != null && Files.isDirectory(Paths.get(path))) {
errDispatcher.removeMessage("exportTlsPathTextField", exportTlsPathTextField);
setErrorMessage(null);
} else {
errDispatcher.addMessage("exportTlsPathTextField", pathToolTip, null, IMessageProvider.ERROR, exportTlsPathTextField);
setErrorMessage("Invalid directory path");
}
}
});
GridData gd_exportTlsPathTextField = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
gd_exportTlsPathTextField.widthHint = 380;
gd_exportTlsPathTextField.verticalIndent = 5;
gd_exportTlsPathTextField.horizontalIndent = 5;
exportTlsPathTextField.setLayoutData(gd_exportTlsPathTextField);
Button exportTlsPathBrowseButton = new Button(mainContainer, SWT.NONE);
exportTlsPathBrowseButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
DirectoryDialog directoryDialog = new DirectoryDialog(exportTlsPathTextField.getShell());
directoryDialog.setText("Select TLS Certificates Directory");
directoryDialog.setFilterPath(System.getProperty("user.home"));
String pathSelected = directoryDialog.open();
if (pathSelected == null) {
return;
}
path = pathSelected;
exportTlsPathTextField.setText(path);
}
});
GridData gd_exportTlsPathBrowseButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_exportTlsPathBrowseButton.verticalIndent = 5;
exportTlsPathBrowseButton.setLayoutData(gd_exportTlsPathBrowseButton);
exportTlsPathBrowseButton.setText("Browse...");
Label lblNote = new Label(mainContainer, SWT.NONE);
GridData gd_lblNote = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_lblNote.verticalIndent = 5;
gd_lblNote.horizontalIndent = 5;
lblNote.setLayoutData(gd_lblNote);
lblNote.setText("Note:");
new Label(mainContainer, SWT.NONE);
Label lblAnyExisting = new Label(mainContainer, SWT.NONE);
GridData gd_lblAnyExisting = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
gd_lblAnyExisting.horizontalIndent = 20;
lblAnyExisting.setLayoutData(gd_lblAnyExisting);
lblAnyExisting.setText("Any existing \"ca.pem\", \"ca-key.pem\", \"cert.pem\",\"key.pem\", \"server.pem\" and \"server-key.pem\"");
Label lblWillBeOverwritten = new Label(mainContainer, SWT.NONE);
GridData gd_lblWillBeOverwritten = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
gd_lblWillBeOverwritten.horizontalIndent = 20;
lblWillBeOverwritten.setLayoutData(gd_lblWillBeOverwritten);
lblWillBeOverwritten.setText("certificate files in the selected directory will be overwritten!");
FormToolkit toolkit = new FormToolkit(mainContainer.getDisplay());
toolkit.getHyperlinkGroup().setHyperlinkUnderlineMode(HyperlinkSettings.UNDERLINE_HOVER);
managedForm = new ManagedForm(mainContainer);
errMsgForm = managedForm.getForm();
errMsgForm.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
errMsgForm.setBackground(mainContainer.getBackground());
errDispatcher = managedForm.getMessageManager();
return area;
}
use of org.eclipse.ui.forms.widgets.FormToolkit in project azure-tools-for-java by Microsoft.
the class AzureInputDockerLoginCredsDialog method createDialogArea.
/**
* Create contents of the dialog.
* @param parent
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite area = (Composite) super.createDialogArea(parent);
Composite mainContainer = new Composite(area, SWT.NONE);
mainContainer.setLayout(new GridLayout(4, false));
mainContainer.setLayoutData(new GridData(GridData.FILL_BOTH));
copyFromAzureKeyButton = new Button(mainContainer, SWT.NONE);
GridData gd_copyFromAzureKeyButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1);
gd_copyFromAzureKeyButton.horizontalIndent = 3;
copyFromAzureKeyButton.setLayoutData(gd_copyFromAzureKeyButton);
copyFromAzureKeyButton.setText("Copy from Azure Key Vault...");
new Label(mainContainer, SWT.NONE);
Label separatorCopyKeyVaultLabel = new Label(mainContainer, SWT.SEPARATOR | SWT.HORIZONTAL);
GridData gd_separatorCopyKeyVaultLabel = new GridData(SWT.FILL, SWT.CENTER, false, false, 3, 1);
gd_separatorCopyKeyVaultLabel.widthHint = 199;
separatorCopyKeyVaultLabel.setLayoutData(gd_separatorCopyKeyVaultLabel);
new Label(mainContainer, SWT.NONE);
Label lblUsername = new Label(mainContainer, SWT.NONE);
GridData gd_lblUsername = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
gd_lblUsername.horizontalIndent = 5;
lblUsername.setLayoutData(gd_lblUsername);
lblUsername.setText("Username:");
dockerHostUsernameTextField = new Text(mainContainer, SWT.BORDER);
dockerHostUsernameTextField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
new Label(mainContainer, SWT.NONE);
Label lblPassword = new Label(mainContainer, SWT.NONE);
GridData gd_lblPassword = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
gd_lblPassword.horizontalIndent = 5;
lblPassword.setLayoutData(gd_lblPassword);
lblPassword.setText("Password:");
dockerHostFirstPwdField = new Text(mainContainer, SWT.BORDER | SWT.PASSWORD);
dockerHostFirstPwdField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
new Label(mainContainer, SWT.NONE);
Label lblConfirm = new Label(mainContainer, SWT.NONE);
GridData gd_lblConfirm = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
gd_lblConfirm.horizontalIndent = 5;
lblConfirm.setLayoutData(gd_lblConfirm);
lblConfirm.setText("Confirm:");
dockerHostSecondPwdField = new Text(mainContainer, SWT.BORDER | SWT.PASSWORD);
dockerHostSecondPwdField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
new Label(mainContainer, SWT.NONE);
new Label(mainContainer, SWT.NONE);
new Label(mainContainer, SWT.NONE);
new Label(mainContainer, SWT.NONE);
new Label(mainContainer, SWT.NONE);
Label lblSsh_1 = new Label(mainContainer, SWT.NONE);
GridData gd_lblSsh_1 = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_lblSsh_1.horizontalIndent = 3;
lblSsh_1.setLayoutData(gd_lblSsh_1);
lblSsh_1.setText("SSH");
Label lblSsh = new Label(mainContainer, SWT.SEPARATOR | SWT.HORIZONTAL);
lblSsh.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1));
lblSsh.setText("SSH");
new Label(mainContainer, SWT.NONE);
dockerHostKeepSshRadioButton = new Button(mainContainer, SWT.RADIO);
GridData gd_dockerHostKeepSshRadioButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1);
gd_dockerHostKeepSshRadioButton.horizontalIndent = 5;
dockerHostKeepSshRadioButton.setLayoutData(gd_dockerHostKeepSshRadioButton);
dockerHostKeepSshRadioButton.setText("Use current keys");
new Label(mainContainer, SWT.NONE);
dockerHostImportSshRadioButton = new Button(mainContainer, SWT.RADIO);
GridData gd_dockerHostImportSshRadioButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1);
gd_dockerHostImportSshRadioButton.horizontalIndent = 5;
dockerHostImportSshRadioButton.setLayoutData(gd_dockerHostImportSshRadioButton);
dockerHostImportSshRadioButton.setText("Import from directory:");
new Label(mainContainer, SWT.NONE);
new Label(mainContainer, SWT.NONE);
dockerHostImportSSHTextField = new Text(mainContainer, SWT.BORDER);
dockerHostImportSSHTextField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
dockerHostImportSSHBrowseButton = new Button(mainContainer, SWT.NONE);
dockerHostImportSSHBrowseButton.setText("Browse...");
dockerHostAutoSshRadioButton = new Button(mainContainer, SWT.RADIO);
GridData gd_dockerHostAutoSshRadioButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1);
gd_dockerHostAutoSshRadioButton.horizontalIndent = 5;
dockerHostAutoSshRadioButton.setLayoutData(gd_dockerHostAutoSshRadioButton);
dockerHostAutoSshRadioButton.setText("Regenerate keys");
new Label(mainContainer, SWT.NONE);
FormToolkit toolkit = new FormToolkit(mainContainer.getDisplay());
toolkit.getHyperlinkGroup().setHyperlinkUnderlineMode(HyperlinkSettings.UNDERLINE_HOVER);
managedForm = new ManagedForm(mainContainer);
errMsgForm = managedForm.getForm();
errMsgForm.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
errMsgForm.setBackground(mainContainer.getBackground());
errDispatcher = managedForm.getMessageManager();
initUIComponents(mainContainer);
return area;
}
use of org.eclipse.ui.forms.widgets.FormToolkit in project tdi-studio-se by Talend.
the class RuntimeGraphcsComposite method createReportField.
/* private void createInfoField(Composite parent) {
infoComposite = createFlatFormComposite(parent, new FormToolkit(Display.getDefault()));
FormLayout reportLayout = new FormLayout();
reportLayout.marginWidth = 0;
reportLayout.marginHeight = 0;
infoComposite.setLayout(reportLayout);
FormData reportData = new FormData();
reportData.left = new FormAttachment(65, 5);
reportData.right = new FormAttachment(100, -5);
reportData.top = new FormAttachment(50, 0);
reportData.bottom = new FormAttachment(100, -5);
infoComposite.setLayoutData(reportData);
Group group = new Group(infoComposite, SWT.NULL);
FormLayout groupLayout = new FormLayout();
groupLayout.marginWidth = 0;
groupLayout.marginHeight = 0;
group.setLayout(groupLayout);
FormData groupData = new FormData();
groupData.left = new FormAttachment(0, 0);
groupData.right = new FormAttachment(100, 0);
groupData.top = new FormAttachment(0, 0);
groupData.bottom = new FormAttachment(100, 0);
group.setLayoutData(groupData);
group.setText("Run job Informations");
infoField = new Text(group, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.READ_ONLY);
infoField.setEditable(false);
infoField.setBackground(group.getBackground());
FormData data;
data = new FormData();
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(100, 0);
data.top = new FormAttachment(0, 0);
data.bottom = new FormAttachment(100, 0);
infoField.setLayoutData(data);
}*/
private void createReportField(Composite parent) {
reportComposite = createFlatFormComposite(parent, new FormToolkit(Display.getDefault()));
FormLayout reportLayout = new FormLayout();
reportComposite.setLayout(reportLayout);
FormData reportData = new FormData();
reportData.left = new FormAttachment(65, 5);
reportData.right = new FormAttachment(100, -5);
reportData.top = new FormAttachment(0, 0);
reportData.bottom = new FormAttachment(100, -5);
reportComposite.setLayoutData(reportData);
Group group = new Group(reportComposite, SWT.NULL);
FormLayout groupLayout = new FormLayout();
group.setLayout(groupLayout);
FormData groupData = new FormData();
groupData.left = new FormAttachment(0, 0);
groupData.right = new FormAttachment(100, 0);
groupData.top = new FormAttachment(0, 0);
groupData.bottom = new FormAttachment(100, 0);
group.setLayoutData(groupData);
//$NON-NLS-1$
group.setText("Job execution information");
reportField = new StyledText(group, SWT.WRAP | SWT.V_SCROLL | SWT.READ_ONLY);
//may be CoreUIPlugin.setCSSClass can do this globally ,check later
reportField.setBackground(getDisplay().getSystemColor(SWT.COLOR_WHITE));
FormData data;
data = new FormData();
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(100, 0);
data.top = new FormAttachment(0, 0);
data.bottom = new FormAttachment(93, 0);
reportField.setLayoutData(data);
displayReportField();
//export button
Button exportButton = new Button(group, SWT.PUSH);
//$NON-NLS-1$
exportButton.setText("Export");
FormData exportData = new FormData();
exportData.left = new FormAttachment(100, -70);
exportData.right = new FormAttachment(100, 0);
exportData.bottom = new FormAttachment(100, -1);
exportButton.setLayoutData(exportData);
exportButton.setEnabled(true);
exportButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (messageManager == null || messageManager.getMessages().size() < 1) {
//$NON-NLS-1$ //$NON-NLS-2$
MessageDialog.openWarning(getShell(), "Warning", "No log to export.");
return;
}
UnboundedFifoBuffer messages = messageManager.getMessages();
Iterator iterator = messages.iterator();
StringBuilder content = new StringBuilder();
while (iterator.hasNext()) {
ReportMessage message = (ReportMessage) iterator.next();
content.append(message.getContent());
}
if (isMonitoring) {
//$NON-NLS-1$ //$NON-NLS-2$
MessageDialog.openWarning(getShell(), "Warning", "Waiting for job done.");
return;
}
FileDialog dialog = new FileDialog(getShell(), SWT.SAVE);
//$NON-NLS-1$
dialog.setFilterPath(".");
String fileName = dialog.open();
if (fileName != null) {
FileWriter writer = null;
try {
writer = new FileWriter(fileName);
writer.write(content.toString());
} catch (IOException e1) {
e1.printStackTrace();
} finally {
try {
if (writer != null) {
writer.close();
}
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
}
});
}
Aggregations