Search in sources :

Example 91 with Composite

use of org.eclipse.swt.widgets.Composite in project translationstudio8 by heartsome.

the class SrxLanguageRulesManageDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    Composite tparent = (Composite) super.createDialogArea(parent);
    GridDataFactory.fillDefaults().grab(true, true).hint(600, 500).minSize(600, 500).applyTo(tparent);
    Composite nameCmp = new Composite(tparent, SWT.NONE);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(nameCmp);
    GridLayoutFactory.fillDefaults().numColumns(2).applyTo(nameCmp);
    Label nameLbl = new Label(nameCmp, SWT.NONE);
    nameLbl.setText(Messages.getString("srx.SrxLanguageRulesManageDialog.nameLbl"));
    nameTxt = new Text(nameCmp, SWT.BORDER);
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(nameTxt);
    createTable(tparent);
    return tparent;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text)

Example 92 with Composite

use of org.eclipse.swt.widgets.Composite in project translationstudio8 by heartsome.

the class SrxMapRulesManageDialog method createButtonBar.

@Override
protected Control createButtonBar(Composite parent) {
    Composite buttonCmp = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.makeColumnsEqualWidth = false;
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    buttonCmp.setLayout(layout);
    GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
    buttonCmp.setLayoutData(data);
    buttonCmp.setFont(parent.getFont());
    Composite leftCmp = new Composite(buttonCmp, SWT.NONE);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(leftCmp);
    GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(3).equalWidth(false).applyTo(leftCmp);
    addBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, Messages.getString("srx.SrxMapRulesManageDialog.addBtn"), false);
    editBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, Messages.getString("srx.SrxMapRulesManageDialog.editBtn"), false);
    deleteBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, Messages.getString("srx.SrxMapRulesManageDialog.deleteBtn"), false);
    Composite rightCmp = new Composite(buttonCmp, SWT.NONE);
    GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(1).equalWidth(false).applyTo(rightCmp);
    new Label(rightCmp, SWT.NONE);
    Label separatorLbl = new Label(buttonCmp, SWT.HORIZONTAL | SWT.SEPARATOR);
    GridDataFactory.fillDefaults().span(2, SWT.DEFAULT).applyTo(separatorLbl);
    new Label(buttonCmp, SWT.NONE);
    Composite bottomCmp = new Composite(buttonCmp, SWT.NONE);
    GridDataFactory.fillDefaults().grab(false, false).applyTo(bottomCmp);
    GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(2).applyTo(bottomCmp);
    createButton(bottomCmp, IDialogConstants.OK_ID, Messages.getString("srx.SrxMapRulesManageDialog.ok"), false);
    createButton(bottomCmp, IDialogConstants.CANCEL_ID, Messages.getString("srx.SrxMapRulesManageDialog.cancel"), true).setFocus();
    initListener();
    return buttonCmp;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label)

Example 93 with Composite

use of org.eclipse.swt.widgets.Composite 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 94 with Composite

use of org.eclipse.swt.widgets.Composite in project translationstudio8 by heartsome.

the class ImportExternalDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    composite.setLayout(new GridLayout(1, false));
    GridDataFactory.fillDefaults().hint(500, 180).grab(true, true).applyTo(composite);
    Group groupXLIFF = new Group(composite, SWT.None);
    groupXLIFF.setLayoutData(new GridData(GridData.FILL_BOTH));
    groupXLIFF.setLayout(new GridLayout(3, false));
    groupXLIFF.setText(Messages.getString("ImportDocxDialog.XLIFFgroup"));
    Label lblXLIFF = new Label(groupXLIFF, SWT.None);
    lblXLIFF.setText(Messages.getString("ImportDocxDialog.lable.xliff"));
    xliffPathTxt = new Text(groupXLIFF, SWT.BORDER);
    xliffPathTxt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    xliffPathTxt.setEditable(false);
    if (xliffRelativePath != null) {
        xliffPathTxt.setText(xliffRelativePath);
    }
    browseXLIFFBtn = new Button(groupXLIFF, SWT.None);
    browseXLIFFBtn.setText(Messages.getString("ImportDocxDialog.browseXLIFFBtn"));
    browseXLIFFBtn.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            FileFolderSelectionDialog dialog = new FileFolderSelectionDialog(getShell(), false, IResource.FILE) {

                // 打开对话框时展开树形目录
                public void create() {
                    super.create();
                    super.getTreeViewer().expandAll();
                }
            };
            dialog.setTitle(Messages.getString("ImportDocxDialog.browseXLIFFBtn.msg0"));
            dialog.setMessage(Messages.getString("ImportDocxDialog.browseXLIFFBtn.msg1"));
            dialog.setDoubleClickSelects(true);
            dialog.setAllowMultiple(false);
            try {
                dialog.setInput(EFS.getStore(root.getLocationURI()));
            } catch (CoreException e1) {
                LOGGER.error(Messages.getString("ImportDocxDialog.LOGGER.logger1"), e1);
            }
            dialog.addFilter(new ViewerFilter() {

                @SuppressWarnings("restriction")
                @Override
                public boolean select(Viewer viewer, Object parentElement, Object element) {
                    if (element instanceof LocalFile) {
                        LocalFile folder = (LocalFile) element;
                        if (folder.getName().equalsIgnoreCase(".hsConfig") || folder.getName().equalsIgnoreCase(".metadata")) {
                            return false;
                        }
                        if (lstProject.contains(folder.toString())) {
                            return true;
                        }
                        String xliffFolderPath = folder.toString();
                        for (String projectPath : lstProject) {
                            String path1 = projectPath + System.getProperty("file.separator") + Constant.FOLDER_XLIFF;
                            if (xliffFolderPath.startsWith(path1)) {
                                return true;
                            }
                        }
                    }
                    return false;
                }
            });
            dialog.create();
            if (Window.OK == dialog.open()) {
                if (dialog.getResult() != null) {
                    Object obj = dialog.getFirstResult();
                    IFile file = root.getFileForLocation(Path.fromOSString(obj.toString()));
                    xliffPathTxt.setText(file.getFullPath().toOSString());
                    xliffFullPath = ResourceUtils.iFileToOSPath(file);
                }
                getButton(IDialogConstants.OK_ID).setEnabled(!docxPathTxt.getText().isEmpty());
            }
        }
    });
    Group groupExternal = new Group(composite, SWT.NONE);
    groupExternal.setText(Messages.getString("ImportDocxDialog.label.docx.title"));
    groupExternal.setLayout(new GridLayout(3, false));
    groupExternal.setLayoutData(new GridData(GridData.FILL_BOTH));
    Label lblRTF = new Label(groupExternal, SWT.None);
    lblRTF.setText(Messages.getString("ImportDocxDialog.label.docx"));
    GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).grab(false, false).applyTo(lblRTF);
    docxPathTxt = new Text(groupExternal, SWT.BORDER);
    docxPathTxt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    docxPathTxt.setEditable(false);
    browseDocxBtn = new Button(groupExternal, SWT.None);
    browseDocxBtn.setText(Messages.getString("ImportDocxDialog.browseDocxBtn"));
    browseDocxBtn.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(getShell());
            dialog.setText(Messages.getString("ImportDocxDialog.browseDocx.title"));
            dialog.setFilterExtensions(new String[] { "*.docx;", "*.*" });
            dialog.setFilterPath(dialogSetting.get("defaultPath"));
            String path = dialog.open();
            if (path != null) {
                if (testFileType(path)) {
                    dialogSetting.put("defaultPath", path.substring(0, path.lastIndexOf(File.separator)));
                    docxPathTxt.setText(path);
                    getButton(IDialogConstants.OK_ID).setEnabled(true && (!xliffPathTxt.getText().isEmpty()));
                } else {
                    getButton(IDialogConstants.OK_ID).setEnabled(false);
                }
            }
        }
    });
    txtImportType = new Label(composite, SWT.READ_ONLY);
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.BOTTOM).span(1, 3).grab(true, true).applyTo(txtImportType);
    return composite;
}
Also used : Group(org.eclipse.swt.widgets.Group) IFile(org.eclipse.core.resources.IFile) Composite(org.eclipse.swt.widgets.Composite) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) Viewer(org.eclipse.jface.viewers.Viewer) GridLayout(org.eclipse.swt.layout.GridLayout) LocalFile(org.eclipse.core.internal.filesystem.local.LocalFile) CoreException(org.eclipse.core.runtime.CoreException) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FileFolderSelectionDialog(net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog) FileDialog(org.eclipse.swt.widgets.FileDialog)

Example 95 with Composite

use of org.eclipse.swt.widgets.Composite in project translationstudio8 by heartsome.

the class CSVSettingDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    Composite tparent = (Composite) super.createDialogArea(parent);
    GridLayoutFactory.fillDefaults().numColumns(1).extendedMargins(5, 5, 5, 5).applyTo(tparent);
    int height = 160;
    if (isTBXConverter) {
        height = 230;
    }
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).hint(320, height).grab(true, true).applyTo(tparent);
    Composite cmpSelFile = new Composite(tparent, SWT.None);
    GridLayoutFactory.fillDefaults().numColumns(3).equalWidth(false).extendedMargins(0, 0, 0, 0).applyTo(cmpSelFile);
    GridDataFactory.fillDefaults().applyTo(cmpSelFile);
    new Label(cmpSelFile, SWT.None).setText(Messages.getString("dialog.CSVSettingDialog.lblFile"));
    txtCSV = new Text(cmpSelFile, SWT.BORDER);
    txtCSV.setEditable(false);
    txtCSV.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    btnBrowse = new Button(cmpSelFile, SWT.None);
    btnBrowse.setText(Messages.getString("dialog.CSVSettingDialog.btnBrowse"));
    btnBrowse.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent arg0) {
            FileDialog dialog = new FileDialog(getShell(), SWT.OPEN);
            dialog.setText(Messages.getString("dialog.CSVSettingDialog.dialogTitle"));
            String[] extensions = { "*.csv", "*.txt", "*" };
            String[] filters = { Messages.getString("dialog.CSVSettingDialog.filters1"), Messages.getString("dialog.CSVSettingDialog.filters2"), Messages.getString("dialog.CSVSettingDialog.filters3") };
            dialog.setFilterExtensions(extensions);
            dialog.setFilterNames(filters);
            String fileSep = System.getProperty("file.separator");
            if (txtCSV.getText() != null && !txtCSV.getText().trim().equals("")) {
                dialog.setFilterPath(txtCSV.getText().substring(0, txtCSV.getText().lastIndexOf(fileSep)));
                dialog.setFileName(txtCSV.getText().substring(txtCSV.getText().lastIndexOf(fileSep) + 1));
            } else {
                dialog.setFilterPath(System.getProperty("user.home"));
            }
            String name = dialog.open();
            if (name != null) {
                txtCSV.setText(name);
            }
        }

        public void widgetDefaultSelected(SelectionEvent arg0) {
        }
    });
    Composite cmpContent = new Composite(tparent, SWT.NONE);
    cmpContent.setLayout(new GridLayout(2, false));
    cmpContent.setLayoutData(new GridData(GridData.FILL_BOTH));
    createLabel(cmpContent, Messages.getString("dialog.CSVSettingDialog.cmbColSeparator"));
    cmbColSeparator = new Combo(cmpContent, SWT.NONE);
    cmbColSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    cmbColSeparator.setItems(arrColSeparator);
    cmbColSeparator.select(1);
    createLabel(cmpContent, Messages.getString("dialog.CSVSettingDialog.cmbTextDelimiter"));
    cmbTextDelimiter = new Combo(cmpContent, SWT.NONE);
    cmbTextDelimiter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    cmbTextDelimiter.setItems(arrTextDelimiter);
    cmbTextDelimiter.setText("\"");
    cmbTextDelimiter.setTextLimit(1);
    createLabel(cmpContent, Messages.getString("dialog.CSVSettingDialog.cmbEncoding"));
    cmbEncoding = new Combo(cmpContent, SWT.READ_ONLY);
    cmbEncoding.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    String[] arrEncoding = LocaleService.getPageCodes();
    cmbEncoding.setItems(arrEncoding);
    cmbEncoding.select(indexOf(arrEncoding, "UTF-8"));
    if (isTBXConverter) {
        createLabel(cmpContent, Messages.getString("dialog.CSVSettingDialog.cmbLang"));
        cmbLang = new TableComboViewer(cmpContent, SWT.READ_ONLY | SWT.BORDER);
        TableCombo tableCombo = cmbLang.getTableCombo();
        tableCombo.setShowTableLines(false);
        tableCombo.setShowTableHeader(false);
        tableCombo.setDisplayColumnIndex(-1);
        tableCombo.setShowImageWithinSelection(true);
        tableCombo.setShowColorWithinSelection(false);
        tableCombo.setShowFontWithinSelection(false);
        tableCombo.setVisibleItemCount(20);
        cmbLang.getTableCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
        ArrayList<Language> languages = new ArrayList<Language>(LocaleService.getDefaultLanguage().values());
        Collections.sort(languages, new Comparator<Language>() {

            public int compare(Language o1, Language o2) {
                return o1.toString().compareTo(o2.toString());
            }
        });
        cmbLang.setContentProvider(new ArrayContentProvider());
        cmbLang.setLabelProvider(new LanguageLabelProvider());
        cmbLang.setInput(languages);
        cmbLang.getTableCombo().select(0);
        createLabel(cmpContent, Messages.getString("dialog.CSVSettingDialog.cmbXCSTemplate"));
        cmbXCSTemplate = new Combo(cmpContent, SWT.READ_ONLY);
        cmbXCSTemplate.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        if (xcsTemplates.length > 0) {
            cmbXCSTemplate.setItems(xcsTemplates);
            cmbXCSTemplate.select(0);
        }
    }
    return tparent;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) LanguageLabelProvider(net.heartsome.cat.ts.ui.composite.LanguageLabelProvider) Label(org.eclipse.swt.widgets.Label) ArrayList(java.util.ArrayList) Text(org.eclipse.swt.widgets.Text) TableCombo(org.eclipse.nebula.widgets.tablecombo.TableCombo) Combo(org.eclipse.swt.widgets.Combo) TableComboViewer(org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer) GridLayout(org.eclipse.swt.layout.GridLayout) Language(net.heartsome.cat.common.locale.Language) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) TableCombo(org.eclipse.nebula.widgets.tablecombo.TableCombo) FileDialog(org.eclipse.swt.widgets.FileDialog) SelectionListener(org.eclipse.swt.events.SelectionListener)

Aggregations

Composite (org.eclipse.swt.widgets.Composite)2054 GridData (org.eclipse.swt.layout.GridData)1441 GridLayout (org.eclipse.swt.layout.GridLayout)1419 Label (org.eclipse.swt.widgets.Label)853 Button (org.eclipse.swt.widgets.Button)694 SelectionEvent (org.eclipse.swt.events.SelectionEvent)577 Text (org.eclipse.swt.widgets.Text)519 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)463 Group (org.eclipse.swt.widgets.Group)305 Combo (org.eclipse.swt.widgets.Combo)210 Point (org.eclipse.swt.graphics.Point)198 FillLayout (org.eclipse.swt.layout.FillLayout)188 ModifyListener (org.eclipse.swt.events.ModifyListener)186 SelectionListener (org.eclipse.swt.events.SelectionListener)183 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)182 ModifyEvent (org.eclipse.swt.events.ModifyEvent)168 Table (org.eclipse.swt.widgets.Table)159 TableViewer (org.eclipse.jface.viewers.TableViewer)153 Control (org.eclipse.swt.widgets.Control)149 ArrayList (java.util.ArrayList)107