use of org.eclipse.swt.widgets.Text in project translationstudio8 by heartsome.
the class XLIFFEditorImplWithNatTable method addFilterComposite.
/**
* 添加填充过滤器面板内容的面板
* @param parent
* @return 过滤器面板;
*/
private void addFilterComposite(Composite main) {
Composite top = new Composite(main, SWT.NONE);
GridLayoutFactory.fillDefaults().numColumns(3).equalWidth(false).margins(0, 0).applyTo(top);
top.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// 输入行号进行定位
final String rowLocationStr = Messages.getString("editor.XLIFFEditorImplWithNatTable.rowLocationStr");
Text txtRowLocation = new Text(top, SWT.BORDER);
txtRowLocation.setText(rowLocationStr);
int width = 40;
if (Util.isLinux()) {
width = 35;
}
GridDataFactory.swtDefaults().hint(width, SWT.DEFAULT).applyTo(txtRowLocation);
txtRowLocation.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
Text text = (Text) e.widget;
if (rowLocationStr.equals(text.getText())) {
text.setText("");
}
}
@Override
public void focusLost(FocusEvent e) {
Text text = (Text) e.widget;
if ("".equals(text.getText())) {
text.setText(rowLocationStr);
}
}
});
txtRowLocation.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent event) {
if (event.keyCode == SWT.CR || event.keyCode == SWT.KEYPAD_CR) {
String rowNumString = ((Text) event.widget).getText().trim();
if (rowNumString != null && !"".equals(rowNumString)) {
int rowPosition;
try {
rowPosition = Integer.parseInt(rowNumString) - 1;
jumpToRow(rowPosition, false);
updateStatusLine();
} catch (NumberFormatException e) {
Text text = (Text) event.widget;
text.setText("");
}
}
}
}
});
txtRowLocation.addVerifyListener(new VerifyListener() {
public void verifyText(VerifyEvent event) {
if (event.keyCode == 0 && event.stateMask == 0) {
// 文本框得到焦点时
} else if (Character.isDigit(event.character) || event.character == '\b' || event.keyCode == 127) {
// 输入数字,或者按下Backspace、Delete键
if ("".equals(((Text) event.widget).getText().trim()) && event.character == '0') {
event.doit = false;
} else {
event.doit = true;
}
} else {
event.doit = false;
}
}
});
cmbFilter = new Combo(top, SWT.BORDER | SWT.READ_ONLY);
cmbFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// TODO 完善过滤器初始化数据。
// cmbFilter.add("所有文本段");
// cmbFilter.add("未翻译文本段");
// cmbFilter.add("已翻译文本段");
// cmbFilter.add("未批准文本段");
// cmbFilter.add("已批准文本段");
// cmbFilter.add("有批注文本段");
// cmbFilter.add("锁定文本段");
// cmbFilter.add("未锁定文本段");
// cmbFilter.add("重复文本段");
// cmbFilter.add("疑问文本段");
// cmbFilter.add("上下文匹配文本段");
// cmbFilter.add("完全匹配文本段");
// cmbFilter.add("模糊匹配文本段");
// cmbFilter.add("快速翻译文本段");
// cmbFilter.add("自动繁殖文本段");
// cmbFilter.add("错误标记文本段");
// cmbFilter.add("术语不一致文本段");
// cmbFilter.add("译文不一致文本段");
// cmbFilter.add("带修订标记文本段");
final Set<String> filterNames = XLFHandler.getFilterNames();
for (String filterName : filterNames) {
cmbFilter.add(filterName);
}
// 添加选项改变监听
cmbFilter.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
// Fixed Bug #2243 by Jason 当鼠标焦点在源文单元框中使用过滤器,对过滤后的译文进行操作会提示该行锁定不能操作
// ActiveCellEditor.commit();
HsMultiActiveCellEditor.commit(true);
Combo cmbFilter = (Combo) e.widget;
boolean isUpdated = handler.doFilter(cmbFilter.getText(), langFilterCondition);
if (isUpdated) {
if (table != null) {
bodyLayer.getSelectionLayer().clear();
if (bodyLayer.selectionLayer.getRowCount() > 0) {
// 默认选中第一行
HsMultiActiveCellEditor.commit(true);
bodyLayer.selectionLayer.doCommand(new SelectCellCommand(bodyLayer.getSelectionLayer(), getTgtColumnIndex(), isHorizontalLayout ? 0 : 1, false, false));
HsMultiCellEditorControl.activeSourceAndTargetCell(XLIFFEditorImplWithNatTable.this);
}
table.setFocus();
}
// 自动调整 NatTable 大小 ;
autoResize();
// 更新状态栏
updateStatusLine();
NattableUtil.refreshCommand(XLIFFEditorSelectionPropertyTester.PROPERTY_NAMESPACE, XLIFFEditorSelectionPropertyTester.PROPERTY_ENABLED);
}
}
});
Button btnSaveFilter = new Button(top, SWT.NONE);
// TODO 考虑换成图片显示。
btnSaveFilter.setText(Messages.getString("editor.XLIFFEditorImplWithNatTable.btnAddFilter"));
btnSaveFilter.setToolTipText(Messages.getString("editor.XLIFFEditorImplWithNatTable.btnAddFilterTooltip"));
btnSaveFilter.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
CustomFilterDialog dialog = new CustomFilterDialog(table.getShell(), cmbFilter);
dialog.open();
// int res = dialog.open();
// if (res == CustomFilterDialog.OK) {
// cmbFilter.select(cmbFilter.getItemCount() - 1); // 选中最后一行数据
// cmbFilter.notifyListeners(SWT.Selection, null);
// }
}
});
// 默认选中第一行数据
cmbFilter.select(0);
cmbFilter.notifyListeners(SWT.Selection, null);
// 更新nattable的列名为语言对
renameColumn();
top.pack();
}
use of org.eclipse.swt.widgets.Text in project translationstudio8 by heartsome.
the class AddOrUpdateLanguageDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite tparent = (Composite) super.createDialogArea(parent);
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
tparent.setLayoutData(data);
GridLayout layout = new GridLayout(3, false);
tparent.setLayout(layout);
GridData txtData = new GridData(GridData.FILL_HORIZONTAL);
txtData.horizontalSpan = 2;
Label lbl = new Label(tparent, SWT.NONE);
lbl.setText(Messages.getString("languagecode.AddOrUpdateLanguageDialog.lblLangImage"));
GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lbl);
imageLabel = new Label(tparent, SWT.NONE);
GridData imGd = new GridData();
imGd.widthHint = 16;
imGd.heightHint = 12;
imageLabel.setLayoutData(imGd);
imageLabel.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
try {
String bundlePath = FileLocator.toFileURL(Activator.getDefault().getBundle().getEntry("")).getPath();
if (this.imagePath != null && !this.imagePath.equals("")) {
String imagePath = bundlePath + this.imagePath;
if (image != null && !image.isDisposed()) {
image.dispose();
}
image = new Image(getShell().getDisplay(), imagePath);
}
if (image != null) {
ImageData imgData = image.getImageData().scaledTo(16, 12);
if (image != null && !image.isDisposed()) {
image.dispose();
}
image = new Image(getShell().getDisplay(), imgData);
imageLabel.setData(this.imagePath);
} else {
if (image != null && !image.isDisposed()) {
image.dispose();
}
image = new Image(getShell().getDisplay(), bundlePath + ImageConstant.LANG_EMPTYPIC);
}
imageLabel.setImage(image);
} catch (IOException e) {
e.printStackTrace();
}
imageLabel.setToolTipText(Messages.getString("languagecode.AddOrUpdateLanguageDialog.imageLabel"));
imageLabel.addListener(SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
FileDialog dlg = new FileDialog(getShell());
dlg.setFilterExtensions(new String[] { "*.png" });
String path = dlg.open();
if (path != null) {
ImageData data = new ImageData(path).scaledTo(16, 12);
if (image != null && !image.isDisposed()) {
image.dispose();
}
image = new Image(getShell().getDisplay(), data);
imageLabel.setImage(image);
imageLabel.setData(path);
}
}
});
new Label(tparent, SWT.NONE).setText(Messages.getString("languagecode.AddOrUpdateLanguageDialog.lblImage"));
lbl = new Label(tparent, SWT.NONE);
lbl.setText(Messages.getString("languagecode.AddOrUpdateLanguageDialog.txtCode"));
GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lbl);
txtCode = new Text(tparent, SWT.BORDER);
txtCode.setLayoutData(txtData);
txtCode.setText(strCode == null ? "" : strCode);
lbl = new Label(tparent, SWT.NONE);
lbl.setText(Messages.getString("languagecode.AddOrUpdateLanguageDialog.txtName"));
GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lbl);
txtName = new Text(tparent, SWT.BORDER);
txtName.setLayoutData(txtData);
txtName.setText(strName == null ? "" : strName);
lbl = new Label(tparent, SWT.NONE);
lbl.setText(Messages.getString("languagecode.AddOrUpdateLanguageDialog.isBidi"));
GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lbl);
btnIsBidi = new Button(tparent, SWT.RADIO);
btnIsBidi.setText(Messages.getString("languagecode.AddOrUpdateLanguageDialog.btnIsBidi"));
btnIsNotBidi = new Button(tparent, SWT.RADIO);
btnIsNotBidi.setText(Messages.getString("languagecode.AddOrUpdateLanguageDialog.btnIsNotBidi"));
if (blnIsBidi) {
btnIsBidi.setSelection(true);
} else {
btnIsNotBidi.setSelection(true);
}
tparent.computeSize(SWT.DEFAULT, SWT.DEFAULT);
txtCode.forceFocus();
txtCode.selectAll();
return tparent;
}
use of org.eclipse.swt.widgets.Text in project translationstudio8 by heartsome.
the class TranslationPreferencePage method createContents.
@Override
protected Control createContents(Composite parent) {
Composite tparent = new Composite(parent, SWT.NONE);
tparent.setLayout(new GridLayout());
tparent.setLayoutData(new GridData(GridData.FILL_BOTH));
Group group = new Group(tparent, SWT.NONE);
group.setLayout(new GridLayout());
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
group.setText(Messages.getString("translation.TranslationPreferencePage.group"));
HsImageLabel imageLabel = new HsImageLabel(Messages.getString("translation.TranslationPreferencePage.imageLabel"), Activator.getImageDescriptor("images/preference/translate/trans_32.png"));
Composite comp = imageLabel.createControl(group);
btnAutoAdaptSpacePosition = new Button(comp, SWT.CHECK);
btnAutoAdaptSpacePosition.setText(Messages.getString("translation.TranslationPreferencePage.btnAutoAdaptSpacePosition"));
btnAutoAdaptSpacePosition.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
btnAutoApplyTmMatch = new Button(comp, SWT.CHECK);
btnAutoApplyTmMatch.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
btnAutoApplyTmMatch.setText(Messages.getString("translation.TranslationPreferencePage.btnAutoApplyTmMatch"));
btnCopyToTarget = new Button(comp, SWT.CHECK);
btnCopyToTarget.setText(Messages.getString("translation.TranslationPreferencePage.btnCopyToTarget"));
btnCopyToTarget.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// btnSkipNotTranslateText = new Button(comp, SWT.CHECK);
// btnSkipNotTranslateText.setText("翻译时跳过锁定文本段");
// btnSkipNotTranslateText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
btnAutoQuickTranslation = new Button(comp, SWT.CHECK);
btnAutoQuickTranslation.setText(Messages.getString("translation.TranslationPreferencePage.btnAutoQuickTranslation"));
btnAutoQuickTranslation.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
imageLabel.computeSize();
Group openOfficeGroup = new Group(tparent, SWT.NONE);
openOfficeGroup.setLayout(new GridLayout());
openOfficeGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
openOfficeGroup.setText(Messages.getString("translation.TranslationPreferencePage.openOfficeGroup"));
HsImageLabel imageLabel2 = new HsImageLabel(Messages.getString("translation.TranslationPreferencePage.imageLabel2"), Activator.getImageDescriptor("images/preference/translate/trans_office_32.png"));
Composite composite = imageLabel2.createControl(openOfficeGroup);
GridLayout gd = new GridLayout(3, false);
gd.marginLeft = 0;
gd.marginTop = 0;
composite.setLayout(gd);
new Label(composite, SWT.NONE).setText(Messages.getString("translation.TranslationPreferencePage.lblOO"));
txtPath = new Text(composite, SWT.BORDER | SWT.READ_ONLY);
txtPath.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
btnBrowse = new Button(composite, SWT.NONE);
btnBrowse.setText(Messages.getString("translation.TranslationPreferencePage.btnBrowse"));
imageLabel2.computeSize();
setValues(false);
initListener();
return tparent;
}
use of org.eclipse.swt.widgets.Text in project translationstudio8 by heartsome.
the class NewProjectWizardProjInfoPage method reload.
public void reload() {
if (lstText != null) {
lstText.clear();
}
if (lstCombo != null) {
lstCombo.clear();
}
ArrayList<String> lstField = PreferenceUtil.getProjectFieldList();
LinkedHashMap<String, ArrayList<String>> mapAttr = PreferenceUtil.getProjectAttributeMap();
if ((lstField != null && lstField.size() > 0) || (mapAttr != null && mapAttr.size() > 0)) {
if (groupField == null || groupField.isDisposed()) {
groupField = new Group((Composite) getControl(), SWT.None);
groupField.setLayout(new GridLayout());
GridData fieldData = new GridData(GridData.FILL_BOTH);
groupField.setLayoutData(fieldData);
groupField.setText(Messages.getString("wizards.NewProjectWizardProjInfoPage.groupField"));
cmpScrolled = new ScrolledComposite(groupField, SWT.V_SCROLL);
cmpScrolled.setAlwaysShowScrollBars(false);
cmpScrolled.setLayoutData(new GridData(GridData.FILL_BOTH));
cmpScrolled.setExpandHorizontal(true);
cmpScrolled.setExpandVertical(true);
cmpField = new Composite(cmpScrolled, SWT.None);
cmpField.setLayout(new GridLayout(2, false));
cmpScrolled.setContent(cmpField);
cmpScrolled.setMinSize(cmpField.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
if (cmpField != null && !cmpField.isDisposed()) {
for (Control control : cmpField.getChildren()) {
control.dispose();
}
cmpField.layout();
cmpScrolled.layout();
groupField.layout();
groupField.getParent().layout();
cmpScrolled.setMinSize(cmpField.computeSize(SWT.DEFAULT, SWT.DEFAULT));
if (lstField != null && lstField.size() > 0) {
if (lstText == null) {
lstText = new ArrayList<Text>();
}
for (String strField : lstField) {
Label lbl = new Label(cmpField, SWT.WRAP);
String strLbl = strField.replaceAll("&", "&&") + Messages.getString("wizards.NewProjectWizardProjInfoPage.colon");
lbl.setText(strLbl);
GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lbl);
GridData gd = (GridData) lbl.getLayoutData();
Point p = lbl.computeSize(SWT.DEFAULT, SWT.DEFAULT);
if (p.x >= 100) {
gd.widthHint = 100;
}
Text txt = new Text(cmpField, SWT.BORDER);
txt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
txt.setData(strField);
txt.addListener(SWT.Modify, this);
lstText.add(txt);
cmpScrolled.setMinSize(cmpField.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
}
if (mapAttr != null && mapAttr.size() > 0) {
Iterator<Entry<String, ArrayList<String>>> it = mapAttr.entrySet().iterator();
if (lstCombo == null) {
lstCombo = new ArrayList<Combo>();
}
while (it.hasNext()) {
Entry<String, ArrayList<String>> entry = (Entry<String, ArrayList<String>>) it.next();
String attrName = entry.getKey();
ArrayList<String> lstAttrVal = entry.getValue();
lstAttrVal.add(0, "");
Label lbl = new Label(cmpField, SWT.WRAP);
String strLbl = attrName.replaceAll("&", "&&") + Messages.getString("wizards.NewProjectWizardProjInfoPage.colon");
lbl.setText(strLbl);
GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lbl);
GridData gd = (GridData) lbl.getLayoutData();
Point p = lbl.computeSize(SWT.DEFAULT, SWT.DEFAULT);
if (p.x >= 100) {
gd.widthHint = 100;
}
Combo cmb = new Combo(cmpField, SWT.READ_ONLY);
cmb.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
cmb.setItems(lstAttrVal.toArray(new String[lstAttrVal.size()]));
cmb.select(0);
cmb.setData(attrName);
lstCombo.add(cmb);
cmpScrolled.setMinSize(cmpField.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
}
cmpScrolled.setMinSize(cmpField.computeSize(SWT.DEFAULT, SWT.DEFAULT));
cmpField.layout();
cmpScrolled.layout();
groupField.layout();
groupField.getParent().layout();
}
} else if (groupField != null && !groupField.isDisposed()) {
Composite cmpParent = groupField.getParent();
groupField.dispose();
cmpParent.layout();
}
}
use of org.eclipse.swt.widgets.Text in project translationstudio8 by heartsome.
the class ProjectSettingBaseInfoPage method createContents.
/**
* Create contents of the preference page.
* @param parent
*/
@Override
public Control createContents(Composite parent) {
// GridData fieldData = new GridData();
// fieldData.heightHint = 10;
// Composite container = new Composite(parent, SWT.NULL);
// container.setLayout(new GridLayout());
// container.setLayoutData(fieldData);
//
// ScrolledComposite cmpScrolled = new ScrolledComposite(container, SWT.V_SCROLL);
// cmpScrolled.setAlwaysShowScrollBars(true);
// cmpScrolled.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// cmpScrolled.setExpandHorizontal(true);
// cmpScrolled.setExpandVertical(true);
Composite cmpField = new Composite(parent, SWT.None);
cmpField.setLayout(new GridLayout(2, false));
// cmpScrolled.setContent(cmpField);
// cmpScrolled.setMinSize(cmpField.computeSize(SWT.DEFAULT, SWT.DEFAULT));
Label label = new Label(cmpField, SWT.RIGHT);
GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label);
label.setText(Messages.getString("projectsetting.ProjectSettingBaseInfoPage.projectNameLabel"));
Point namePoint = label.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
projectNameLabel = new Label(cmpField, SWT.NONE);
// cmpScrolled.setMinSize(cmpField.computeSize(SWT.DEFAULT, SWT.DEFAULT));
label = new Label(cmpField, SWT.RIGHT);
GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label);
label.setText(Messages.getString("projectsetting.ProjectSettingBaseInfoPage.sourceLangLabel"));
Point srcPoint = label.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
sourceLangLabel = new Label(cmpField, SWT.NONE);
// cmpScrolled.setMinSize(cmpField.computeSize(SWT.DEFAULT, SWT.DEFAULT));
label = new Label(cmpField, SWT.RIGHT);
GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label);
label.setText(Messages.getString("projectsetting.ProjectSettingBaseInfoPage.targetlangLabel"));
Point tgtPoint = label.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
targetlangLabel = new Label(cmpField, SWT.NONE);
// cmpScrolled.setMinSize(cmpField.computeSize(SWT.DEFAULT, SWT.DEFAULT));
initData();
int width = Math.max(namePoint.x, Math.max(srcPoint.x, tgtPoint.x)) + 10;
Map<String, String> mapField = projCfgBean.getMapField();
if (mapField != null && mapField.size() > 0) {
lstText = new ArrayList<Text>();
Iterator<Entry<String, String>> it = mapField.entrySet().iterator();
while (it.hasNext()) {
Entry<String, String> entry = (Entry<String, String>) it.next();
Label lbl = new Label(cmpField, SWT.WRAP);
String strLbl = TextUtil.xmlToString(entry.getKey()).replaceAll("&", "&&") + Messages.getString("wizards.NewProjectWizardProjInfoPage.colon");
lbl.setText(strLbl);
GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lbl);
GridData gd = (GridData) lbl.getLayoutData();
Point p = lbl.computeSize(SWT.DEFAULT, SWT.DEFAULT);
if (p.x > width) {
gd.widthHint = width;
}
Text txt = new Text(cmpField, SWT.BORDER);
txt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
txt.setText(TextUtil.xmlToString(entry.getValue()));
txt.setData(TextUtil.xmlToString(entry.getKey()));
txt.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
if (lstText != null && lstText.size() > 0) {
boolean isValid = true;
for (Text txt : lstText) {
String value = txt.getText();
if (value != null && !value.equals("")) {
if (value.trim().equals("")) {
setErrorMessage(Messages.getString("wizard.NewProjectWizardProjInfoPage.msg3"));
isValid = false;
setValid(false);
break;
} else if (value.trim().length() > 50) {
setErrorMessage(Messages.getString("wizard.NewProjectWizardProjInfoPage.msg4"));
setValid(false);
isValid = false;
break;
}
}
}
if (isValid) {
setErrorMessage(null);
setValid(true);
}
}
}
});
lstText.add(txt);
// cmpScrolled.setMinSize(cmpField.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
}
Map<String, Object[]> mapAttr = projCfgBean.getMapAttr();
if (mapAttr != null && mapAttr.size() > 0) {
lstCombo = new ArrayList<Combo>();
Iterator<Entry<String, Object[]>> it = mapAttr.entrySet().iterator();
while (it.hasNext()) {
Entry<String, Object[]> entry = (Entry<String, Object[]>) it.next();
String attrName = TextUtil.xmlToString(entry.getKey());
String attrSelVal = TextUtil.xmlToString((String) entry.getValue()[0]);
@SuppressWarnings("unchecked") List<String> lstAttrVal = (List<String>) entry.getValue()[1];
String[] arrAttrVal = new String[lstAttrVal.size()];
int selIndex = 0;
for (int i = 0; i < lstAttrVal.size(); i++) {
arrAttrVal[i] = TextUtil.xmlToString(lstAttrVal.get(i));
if (attrSelVal.equals(arrAttrVal[i])) {
selIndex = i;
}
}
Label lbl = new Label(cmpField, SWT.WRAP);
String strLbl = attrName.replaceAll("&", "&&") + Messages.getString("wizards.NewProjectWizardProjInfoPage.colon");
lbl.setText(strLbl);
GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lbl);
GridData gd = (GridData) lbl.getLayoutData();
Point p = lbl.computeSize(SWT.DEFAULT, SWT.DEFAULT);
if (p.x > width) {
gd.widthHint = width;
}
Combo cmb = new Combo(cmpField, SWT.READ_ONLY);
cmb.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
cmb.setItems(arrAttrVal);
cmb.select(selIndex);
cmb.setData(attrName);
lstCombo.add(cmb);
// cmpScrolled.setMinSize(cmpField.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
}
return cmpField;
}
Aggregations