Search in sources :

Example 1 with IConversionItemDialog

use of net.heartsome.cat.convert.ui.dialog.IConversionItemDialog in project translationstudio8 by heartsome.

the class ConversionWizardPage method createSegmentationGroup.

/**
	 * 创建分段规则选择组
	 * @param contents
	 *            ;
	 */
private void createSegmentationGroup(Composite contents) {
    Group segmentation = new Group(contents, SWT.NONE);
    //$NON-NLS-1$
    segmentation.setText(Messages.getString("wizard.ConversionWizardPage.segmentation"));
    segmentation.setLayout(new GridLayout(3, false));
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = 500;
    segmentation.setLayoutData(data);
    Label segLabel = new Label(segmentation, SWT.NONE);
    //$NON-NLS-1$
    segLabel.setText(Messages.getString("wizard.ConversionWizardPage.segLabel"));
    srxFile = new Text(segmentation, SWT.BORDER | SWT.READ_ONLY);
    srxFile.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    srxFile.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            for (ConversionConfigBean conversionConfigBean : conversionConfigBeans) {
                conversionConfigBean.setInitSegmenter(srxFile.getText());
            }
            validate();
        }
    });
    final Button segBrowse = new Button(segmentation, SWT.PUSH);
    //$NON-NLS-1$
    segBrowse.setText(Messages.getString("wizard.ConversionWizardPage.segBrowse"));
    segBrowse.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent arg0) {
            IConversionItemDialog conversionItemDialog = FileDialogFactoryFacade.createFileDialog(getShell(), SWT.NONE);
            int result = conversionItemDialog.open();
            if (result == IDialogConstants.OK_ID) {
                IConversionItem conversionItem = conversionItemDialog.getConversionItem();
                srxFile.setText(conversionItem.getLocation().toOSString());
            }
        }
    });
}
Also used : Group(org.eclipse.swt.widgets.Group) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) IConversionItemDialog(net.heartsome.cat.convert.ui.dialog.IConversionItemDialog) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) ConversionConfigBean(net.heartsome.cat.convert.ui.model.ConversionConfigBean) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) IConversionItem(net.heartsome.cat.convert.ui.model.IConversionItem)

Aggregations

IConversionItemDialog (net.heartsome.cat.convert.ui.dialog.IConversionItemDialog)1 ConversionConfigBean (net.heartsome.cat.convert.ui.model.ConversionConfigBean)1 IConversionItem (net.heartsome.cat.convert.ui.model.IConversionItem)1 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Button (org.eclipse.swt.widgets.Button)1 Group (org.eclipse.swt.widgets.Group)1 Label (org.eclipse.swt.widgets.Label)1 Text (org.eclipse.swt.widgets.Text)1