Search in sources :

Example 16 with ModifyEvent

use of org.eclipse.swt.events.ModifyEvent in project translationstudio8 by heartsome.

the class AddOrEditXmlConvertConfigDialog method createRootTxt.

/**
	 * 创建xml根,与存储目录
	 * @param tparent
	 *            ;
	 */
private void createRootTxt(Composite tparent) {
    Composite composite = new Composite(tparent, SWT.NONE);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(composite);
    GridLayoutFactory.fillDefaults().spacing(0, SWT.DEFAULT).numColumns(5).applyTo(composite);
    Label rootLbl = new Label(composite, SWT.NONE);
    rootLbl.setText(Messages.getString("dialogs.AddOrEditXmlConvertConfigDialog.rootLbl"));
    rootTxt = new Text(composite, SWT.BORDER);
    GridDataFactory.fillDefaults().indent(6, SWT.DEFAULT).hint(100, SWT.DEFAULT).applyTo(rootTxt);
    // 显示一个图标与“被保存到:”
    Label iconLbl = new Label(composite, SWT.NONE);
    iconLbl.setImage(icon);
    GridDataFactory.fillDefaults().indent(4, SWT.DEFAULT).applyTo(iconLbl);
    Label textLbl = new Label(composite, SWT.NONE);
    textLbl.setText(Messages.getString("dialogs.AddOrEditXmlConvertConfigDialog.textLbl"));
    rootTipLbl = new Label(composite, SWT.NONE);
    GridDataFactory.fillDefaults().grab(true, false).align(SWT.LEFT, SWT.CENTER).applyTo(rootTipLbl);
    rootTxt.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            String tipText = root.getFullPath().append(ADConstants.AD_xmlConverterConfigFolder).append("config_" + rootTxt.getText().trim() + ".xml").toOSString();
            rootTipLbl.setText(tipText);
            rootTipLbl.pack();
            rootTipLbl.setToolTipText(tipText);
        }
    });
    // 在添加状态下,当根元素文本框失去焦点后,验证是否为空,验证是否重复
    rootTxt.addFocusListener(new org.eclipse.swt.events.FocusAdapter() {

        @Override
        public void focusLost(FocusEvent e) {
            String rootStr = rootTxt.getText().trim();
            if (isAdd || (!rootStr.equals(curRootStr))) {
                if ("".equals(rootStr)) {
                    MessageDialog.openWarning(getShell(), Messages.getString("dialogs.AddOrEditXmlConvertConfigDialog.msgTitle1"), Messages.getString("dialogs.AddOrEditXmlConvertConfigDialog.msg1"));
                } else {
                    // 提示文件是否重复
                    String configXmlLoaction = root.getLocation().append(ADConstants.AD_xmlConverterConfigFolder).append("config_" + rootStr + ".xml").toOSString();
                    File xmlConfigFile = new File(configXmlLoaction);
                    if (xmlConfigFile.exists()) {
                        String configXmlFullPath = root.getFullPath().append(ADConstants.AD_xmlConverterConfigFolder).append("config_" + rootStr + ".xml").toOSString();
                        MessageDialog.openWarning(getShell(), Messages.getString("dialogs.AddOrEditXmlConvertConfigDialog.msgTitle1"), MessageFormat.format(Messages.getString("dialogs.AddOrEditXmlConvertConfigDialog.msg2"), configXmlFullPath));
                    }
                }
                super.focusLost(e);
            }
        }
    });
}
Also used : ModifyEvent(org.eclipse.swt.events.ModifyEvent) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) FocusEvent(org.eclipse.swt.events.FocusEvent) File(java.io.File)

Example 17 with ModifyEvent

use of org.eclipse.swt.events.ModifyEvent in project translationstudio8 by heartsome.

the class AnalysisXmlConvertConfigDialg method createRootTxt.

private void createRootTxt(Composite tparent) {
    Composite composite = new Composite(tparent, SWT.NONE);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(composite);
    GridLayoutFactory.fillDefaults().spacing(0, 1).numColumns(5).applyTo(composite);
    Label analysisXmlLbl = new Label(composite, SWT.NONE);
    analysisXmlLbl.setText(Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.analysisXmlLbl"));
    GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(analysisXmlLbl);
    Composite browseCmp = new Composite(composite, SWT.NONE);
    GridDataFactory.fillDefaults().indent(6, SWT.DEFAULT).grab(true, false).span(4, SWT.DEFAULT).applyTo(browseCmp);
    GridLayoutFactory.fillDefaults().numColumns(2).extendedMargins(0, 0, 0, 0).applyTo(browseCmp);
    analysisTxt = new Text(browseCmp, SWT.BORDER);
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(analysisTxt);
    Button browseBtn = new Button(browseCmp, SWT.NONE);
    browseBtn.setText(Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.browseBtn"));
    Label rootLbl = new Label(composite, SWT.NONE);
    rootLbl.setText(Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.rootLbl"));
    GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(rootLbl);
    rootTxt = new Text(composite, SWT.BORDER);
    GridDataFactory.fillDefaults().indent(6, SWT.DEFAULT).hint(100, SWT.DEFAULT).applyTo(rootTxt);
    // 显示一个图标与“被保存到:”
    Label iconLbl = new Label(composite, SWT.NONE);
    iconLbl.setImage(icon);
    GridDataFactory.fillDefaults().indent(4, SWT.DEFAULT).applyTo(iconLbl);
    Label textLbl = new Label(composite, SWT.NONE);
    textLbl.setText(Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.textLbl"));
    rootTipLbl = new Label(composite, SWT.NONE);
    GridDataFactory.fillDefaults().grab(true, false).align(SWT.LEFT, SWT.CENTER).applyTo(rootTipLbl);
    rootTxt.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            String tipText = root.getFullPath().append(ADConstants.AD_xmlConverterConfigFolder).append("config_" + rootTxt.getText().trim().toLowerCase() + ".xml").toOSString();
            rootTipLbl.setText(tipText);
            rootTipLbl.pack();
            rootTipLbl.setToolTipText(tipText);
        }
    });
    // 在添加状态下,当根元素文本框失去焦点后,验证是否为空,验证是否重复
    rootTxt.addFocusListener(new org.eclipse.swt.events.FocusAdapter() {

        public void focusLost(FocusEvent e) {
            String rootStr = rootTxt.getText().trim().toLowerCase();
            if ("".equals(rootStr)) {
                MessageDialog.openInformation(getShell(), Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.msgTitle"), Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.msg1"));
            } else {
                // 提示文件是否重复
                String configXmlLoaction = root.getLocation().append(ADConstants.AD_xmlConverterConfigFolder).append("config_" + rootStr + ".xml").toOSString();
                File xmlConfigFile = new File(configXmlLoaction);
                if (xmlConfigFile.exists()) {
                    String configXmlFullPath = root.getFullPath().append(ADConstants.AD_xmlConverterConfigFolder).append("config_" + rootStr + ".xml").toOSString();
                    MessageDialog.openInformation(getShell(), Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.msgTitle"), MessageFormat.format(Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.msg2"), configXmlFullPath));
                }
            }
            super.focusLost(e);
        }
    });
    browseBtn.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            FileDialog fd = new FileDialog(getShell(), SWT.OPEN);
            String[] extensions = { "*.xml", "*" };
            String[] names = { Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.filterXML"), Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.filterAll") };
            fd.setText(Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.fdTitle"));
            fd.setFilterExtensions(extensions);
            fd.setFilterNames(names);
            String xmlLocation = fd.open();
            analysisTxt.setText(xmlLocation);
            // 解析XML文件并且填充到列表
            analysisXml(xmlLocation);
        }
    });
    analysisTxt.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(FocusEvent e) {
            analysisXml(analysisTxt.getText());
            super.focusLost(e);
        }
    });
}
Also used : FocusAdapter(org.eclipse.swt.events.FocusAdapter) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) FocusEvent(org.eclipse.swt.events.FocusEvent) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FocusAdapter(org.eclipse.swt.events.FocusAdapter) File(java.io.File) FileDialog(org.eclipse.swt.widgets.FileDialog)

Example 18 with ModifyEvent

use of org.eclipse.swt.events.ModifyEvent in project translationstudio8 by heartsome.

the class ExportExternalDialog method createDialogArea.

protected Control createDialogArea(Composite parent) {
    Composite tparent = (Composite) super.createDialogArea(parent);
    GridDataFactory.createFrom(new GridData(GridData.FILL_BOTH)).hint(600, SWT.DEFAULT).applyTo(tparent);
    final Group groupFile = new Group(tparent, SWT.NONE);
    groupFile.setText(Messages.getString("ExportDocxDialog.lable.xliff"));
    groupFile.setLayout(new GridLayout(1, false));
    groupFile.setLayoutData(new GridData(GridData.FILL_BOTH));
    final TableViewer tbv = new TableViewer(groupFile, SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
    final Table table = tbv.getTable();
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    TableLayout tableLayout = new TableLayout();
    table.setLayout(tableLayout);
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).hint(SWT.DEFAULT, 90).applyTo(table);
    tableLayout.addColumnData(new ColumnWeightData(1));
    new TableColumn(table, SWT.NONE).setText(Messages.getString("ExportDocxDialog.lable.nodot"));
    tableLayout.addColumnData(new ColumnWeightData(10));
    new TableColumn(table, SWT.NONE).setText(Messages.getString("ExportDocxDialog.lable.fullPath"));
    tableLayout.addColumnData(new ColumnWeightData(2));
    new TableColumn(table, SWT.NONE).setText(Messages.getString("ExportDocxDialog.lable.srcLang"));
    tableLayout.addColumnData(new ColumnWeightData(2));
    new TableColumn(table, SWT.NONE).setText(Messages.getString("ExportDocxDialog.lable.tgtLang"));
    tbv.setLabelProvider(new TableViewLabelProvider());
    tbv.setContentProvider(new ArrayContentProvider());
    tbv.setInput(xlfBeans);
    final Group groupExportType = new Group(tparent, SWT.NONE);
    groupExportType.setText(Messages.getString("ExportDocxDialog.lable.exporttype"));
    groupExportType.setLayout(new GridLayout(3, false));
    groupExportType.setLayoutData(new GridData(GridData.FILL_BOTH));
    final Label lblExportType = new Label(groupExportType, SWT.NONE);
    lblExportType.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblExportType.setText(Messages.getString("ExportDocxDialog.lable.exportchoose"));
    cmb = new Combo(groupExportType, SWT.NONE | SWT.READ_ONLY);
    GridDataFactory.swtDefaults().span(2, 1).grab(true, false).align(SWT.FILL, SWT.FILL).applyTo(cmb);
    for (String type : ExportExternal.getExportTypes()) {
        cmb.add(type);
    }
    cmb.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            final int exportCode = ExportExternal.getExportTypeCode(cmb.getSelectionIndex());
            btnHsproofNote.setEnabled(exportCode == ExportExternal.EXPORT_HSPROOF);
            btnHsproofState.setEnabled(btnHsproofNote.getEnabled());
            btnNotrans.setEnabled(exportCode != ExportExternal.EXPORT_TMX && btnFilterWhenState.getSelection());
            if (ExportExternal.EXPORT_TMX == exportCode && btnFilterWhenState.getSelection()) {
                btnNotrans.setSelection(false);
            }
        }
    });
    final Label lblR8State = new Label(groupExportType, SWT.NONE);
    lblR8State.setText(Messages.getString("ExportDocxDialog.lable.hsproof"));
    btnHsproofState = new Button(groupExportType, SWT.CHECK);
    btnHsproofState.setText(Messages.getString("ExportDocxDialog.statusBtn"));
    btnHsproofNote = new Button(groupExportType, SWT.CHECK);
    btnHsproofNote.setText(Messages.getString("ExportDocxDialog.commentBtn"));
    final Group groupFilter = new Group(tparent, SWT.NONE);
    groupFilter.setText(Messages.getString("ExportDocxDialog.lable.filter"));
    groupFilter.setLayout(new GridLayout(3, false));
    groupFilter.setLayoutData(new GridData(GridData.FILL_BOTH));
    // 过滤大类
    btnAllTrans = new Button(groupFilter, SWT.RADIO);
    btnAllTrans.setText(Messages.getString("ExportDocxDialog.lable.filterAll"));
    btnAllTrans.setSelection(true);
    btnAllTrans.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (btnAllTrans.getSelection()) {
                setFilterDefaultValue();
            }
        }
    });
    btnOnlySpecial = new Button(groupFilter, SWT.RADIO);
    btnOnlySpecial.setText(Messages.getString("ExportDocxDialog.onlyExportBtn"));
    btnOnlySpecial.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (btnOnlySpecial.getSelection()) {
                setFilterDefaultValue();
            }
        }

        ;
    });
    btnFilterWhenState = new Button(groupFilter, SWT.RADIO);
    btnFilterWhenState.setText(Messages.getString("ExportDocxDialog.lable.hasState"));
    btnFilterWhenState.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (btnFilterWhenState.getSelection()) {
                setFilterDefaultValue();
            }
        }

        ;
    });
    // 大类细节
    cmpFilterAllTrans = new Composite(groupFilter, SWT.NONE);
    cmpFilterAllTrans.setLayout(new GridLayout(1, false));
    cmpFilterAllTrans.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    btnExceptLocked = new Button(cmpFilterAllTrans, SWT.CHECK);
    btnExceptLocked.setText(Messages.getString("ExportDocxDialog.lable.exceptLock"));
    btnExceptLocked.setEnabled(true);
    btnExceptContextMatch = new Button(cmpFilterAllTrans, SWT.CHECK);
    btnExceptContextMatch.setText(Messages.getString("ExportDocxDialog.lable.exceptCxtMatch"));
    btnExceptContextMatch.setEnabled(true);
    btnExceptFullMatch = new Button(cmpFilterAllTrans, SWT.CHECK);
    btnExceptFullMatch.setText(Messages.getString("ExportDocxDialog.lable.exceptFullMatch"));
    cmpFilterOnlySpecial = new Composite(groupFilter, SWT.NONE);
    cmpFilterOnlySpecial.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    cmpFilterOnlySpecial.setLayout(new GridLayout(1, false));
    btnHasNote = new Button(cmpFilterOnlySpecial, SWT.CHECK);
    btnHasNote.setText(Messages.getString("ExportDocxDialog.onlyExportNoteBtn"));
    btnNeedReview = new Button(cmpFilterOnlySpecial, SWT.CHECK);
    btnNeedReview.setText(Messages.getString("ExportDocxDialog.onlyExportReviewBtn"));
    cmpFilterWhenState = new Composite(groupFilter, SWT.NONE);
    cmpFilterWhenState.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    cmpFilterWhenState.setLayout(new GridLayout(1, false));
    btnNotrans = new Button(cmpFilterWhenState, SWT.CHECK);
    btnNotrans.setText(Messages.getString("ExportDocxDialog.lable.state.noTrans"));
    btnNotrans.setText(Messages.getString("ExportDocxDialog.lable.state.noTrans"));
    btnNewtrans = new Button(cmpFilterWhenState, SWT.CHECK);
    btnNewtrans.setText(Messages.getString("ExportDocxDialog.lable.state.new"));
    btnNewtrans.setText(Messages.getString("ExportDocxDialog.lable.state.new"));
    btnTransed = new Button(cmpFilterWhenState, SWT.CHECK);
    btnTransed.setText(Messages.getString("ExportDocxDialog.lable.state.hasTrans"));
    btnApproved = new Button(cmpFilterWhenState, SWT.CHECK);
    btnApproved.setText(Messages.getString("ExportDocxDialog.lable.state.hasApprove"));
    Composite cmpSaveas = new Composite(tparent, SWT.NONE);
    cmpSaveas.setLayout(GridLayoutFactory.swtDefaults().numColumns(3).create());
    cmpSaveas.setLayoutData(new GridData(GridData.FILL_BOTH));
    Label lblSaveas = new Label(cmpSaveas, SWT.NONE);
    lblSaveas.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblSaveas.setText(Messages.getString("ExportDocxDialog.lable.saveas"));
    txtSaveas = new Text(cmpSaveas, SWT.BORDER | SWT.READ_ONLY);
    txtSaveas.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    txtSaveas.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            getButton(IDialogConstants.OK_ID).setEnabled(!txtSaveas.getText().isEmpty());
        }
    });
    Button btnSaveas = new Button(cmpSaveas, SWT.NONE);
    btnSaveas.setText(Messages.getString("ExportDocxDialog.browseDocxBtn"));
    btnSaveas.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog dialog = new DirectoryDialog(getShell());
            dialog.setFilterPath(dialogSetting.get("defaultPath"));
            String path = dialog.open();
            if (path != null) {
                txtSaveas.setText(path);
                dialogSetting.put("defaultPath", path);
            }
        }
    });
    setDefaultValue();
    return parent;
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) Group(org.eclipse.swt.widgets.Group) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) Combo(org.eclipse.swt.widgets.Combo) Text(org.eclipse.swt.widgets.Text) TableColumn(org.eclipse.swt.widgets.TableColumn) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableViewer(org.eclipse.jface.viewers.TableViewer) TableLayout(org.eclipse.jface.viewers.TableLayout) DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog)

Example 19 with ModifyEvent

use of org.eclipse.swt.events.ModifyEvent in project translationstudio8 by heartsome.

the class FindReplaceDialog method createInputPanel.

private Composite createInputPanel(final Composite composite) {
    final Composite row = new Composite(composite, SWT.NONE);
    row.setLayout(new GridLayout(2, false));
    final Label findLabel = new Label(row, SWT.NONE);
    findLabel.setText(Messages.getString("dialog.FindReplaceDialog.findLabel"));
    GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(findLabel);
    cmbFind = new Combo(row, SWT.DROP_DOWN | SWT.BORDER);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(cmbFind);
    cmbFind.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            /*
				 * boolean enabled = findText.getText().length() > 0; findButton.setEnabled(enabled);
				 * findNextButton.setEnabled(enabled); replaceAllButton.setEnabled(!sourceButton.getSelection() &&
				 * enabled); if (!enabled) { replaceButton.setEnabled(false); }
				 */
            setEnable();
        }
    });
    cmbFind.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            if (findButton.isEnabled()) {
                doFindNext();
            }
        }
    });
    Label replaceWithLabel = new Label(row, SWT.NONE);
    replaceWithLabel.setText(Messages.getString("dialog.FindReplaceDialog.replaceWithLabel"));
    GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(replaceWithLabel);
    cmbReplace = new Combo(row, SWT.DROP_DOWN | SWT.BORDER);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(cmbReplace);
    return row;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Combo(org.eclipse.swt.widgets.Combo)

Example 20 with ModifyEvent

use of org.eclipse.swt.events.ModifyEvent in project translationstudio8 by heartsome.

the class InputDialog method createDialogArea.

/*
	 * (non-Javadoc) Method declared on Dialog.
	 */
protected Control createDialogArea(Composite parent) {
    // create composite
    Composite composite = (Composite) super.createDialogArea(parent);
    // create message
    if (message != null) {
        Label label = new Label(composite, SWT.WRAP);
        label.setText(message);
        GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        label.setLayoutData(data);
        label.setFont(parent.getFont());
    }
    text = new Text(composite, getInputTextStyle());
    text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    text.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP);
    GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    errorMessageText.setLayoutData(data);
    errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    // Set the error message text
    // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292
    setErrorMessage(errorMessage);
    applyDialogFont(composite);
    return composite;
}
Also used : ModifyEvent(org.eclipse.swt.events.ModifyEvent) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) Text(org.eclipse.swt.widgets.Text)

Aggregations

ModifyEvent (org.eclipse.swt.events.ModifyEvent)297 ModifyListener (org.eclipse.swt.events.ModifyListener)296 GridData (org.eclipse.swt.layout.GridData)200 Text (org.eclipse.swt.widgets.Text)177 GridLayout (org.eclipse.swt.layout.GridLayout)175 Composite (org.eclipse.swt.widgets.Composite)162 Label (org.eclipse.swt.widgets.Label)156 SelectionEvent (org.eclipse.swt.events.SelectionEvent)155 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)126 Button (org.eclipse.swt.widgets.Button)93 Combo (org.eclipse.swt.widgets.Combo)61 Group (org.eclipse.swt.widgets.Group)47 SelectionListener (org.eclipse.swt.events.SelectionListener)37 File (java.io.File)27 KeyEvent (org.eclipse.swt.events.KeyEvent)27 StyledText (org.eclipse.swt.custom.StyledText)23 DirectoryDialog (org.eclipse.swt.widgets.DirectoryDialog)21 FocusEvent (org.eclipse.swt.events.FocusEvent)19 Point (org.eclipse.swt.graphics.Point)19 FileDialog (org.eclipse.swt.widgets.FileDialog)18