Search in sources :

Example 51 with FileDialog

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

the class KeyController2 method exportCSV.

public void exportCSV(Shell shell) {
    final FileDialog fileDialog = new FileDialog(shell, SWT.SAVE | SWT.SHEET);
    //$NON-NLS-1$
    fileDialog.setFilterExtensions(new String[] { "*.csv" });
    //$NON-NLS-1$
    fileDialog.setFilterNames(new String[] { Util.translateString(RESOURCE_BUNDLE, "csvFilterName") });
    fileDialog.setOverwrite(true);
    final String filePath = fileDialog.open();
    if (filePath == null) {
        return;
    }
    final SafeRunnable runnable = new SafeRunnable() {

        public final void run() throws IOException {
            Writer fileWriter = null;
            try {
                //$NON-NLS-1$
                fileWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filePath), "UTF-8"));
                final Object[] bindingElements = bindingModel.getBindings().toArray();
                for (int i = 0; i < bindingElements.length; i++) {
                    final BindingElement be = (BindingElement) bindingElements[i];
                    if (be.getTrigger() == null || be.getTrigger().isEmpty() || be.getContext() == null || be.getContext().getName() == null) {
                        continue;
                    }
                    StringBuffer buffer = new StringBuffer();
                    buffer.append(ESCAPED_QUOTE + Util.replaceAll(be.getCategory(), ESCAPED_QUOTE, REPLACEMENT) + ESCAPED_QUOTE + DELIMITER);
                    buffer.append(ESCAPED_QUOTE + be.getName() + ESCAPED_QUOTE + DELIMITER);
                    buffer.append(ESCAPED_QUOTE + be.getTrigger().format() + ESCAPED_QUOTE + DELIMITER);
                    buffer.append(ESCAPED_QUOTE + be.getContext().getName() + ESCAPED_QUOTE);
                    //$NON-NLS-1$
                    buffer.append(System.getProperty("line.separator"));
                    fileWriter.write(buffer.toString());
                }
            } finally {
                if (fileWriter != null) {
                    try {
                        fileWriter.close();
                    } catch (final IOException e) {
                    // At least I tried.
                    }
                }
            }
        }
    };
    SafeRunner.run(runnable);
}
Also used : BindingElement(org.eclipse.ui.internal.keys.model.BindingElement) SafeRunnable(org.eclipse.jface.util.SafeRunnable) IOException(java.io.IOException) BufferedWriter(java.io.BufferedWriter) FileOutputStream(java.io.FileOutputStream) OutputStreamWriter(java.io.OutputStreamWriter) FileDialog(org.eclipse.swt.widgets.FileDialog) Writer(java.io.Writer) OutputStreamWriter(java.io.OutputStreamWriter) BufferedWriter(java.io.BufferedWriter)

Example 52 with FileDialog

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

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

the class ImportDocxDialog method initListener.

/**
	 * 初始化按钮监听 ;
	 */
private void initListener() {
    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();
            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);
            }
        }
    });
    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.setFilterNames(new String[] { Messages.getString(Messages.getString("ImportDocxDialog.browseDocx.filter")) });
            String fileSep = System.getProperty("file.separator");
            if (docxPathTxt.getText() != null && !docxPathTxt.getText().trim().equals("")) {
                dialog.setFilterPath(docxPathTxt.getText().substring(0, docxPathTxt.getText().lastIndexOf(fileSep)));
                dialog.setFileName(docxPathTxt.getText().substring(docxPathTxt.getText().lastIndexOf(fileSep) + 1));
            } else {
                dialog.setFilterPath(System.getProperty("user.home"));
            }
            String path = dialog.open();
            if (path != null) {
                docxPathTxt.setText(path);
            }
        }
    });
}
Also used : LocalFile(org.eclipse.core.internal.filesystem.local.LocalFile) IFile(org.eclipse.core.resources.IFile) CoreException(org.eclipse.core.runtime.CoreException) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Viewer(org.eclipse.jface.viewers.Viewer) FileFolderSelectionDialog(net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog) FileDialog(org.eclipse.swt.widgets.FileDialog)

Example 54 with FileDialog

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

use of org.eclipse.swt.widgets.FileDialog 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

FileDialog (org.eclipse.swt.widgets.FileDialog)512 File (java.io.File)198 SelectionEvent (org.eclipse.swt.events.SelectionEvent)181 Button (org.eclipse.swt.widgets.Button)181 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)160 Label (org.eclipse.swt.widgets.Label)153 Text (org.eclipse.swt.widgets.Text)151 Composite (org.eclipse.swt.widgets.Composite)136 Shell (org.eclipse.swt.widgets.Shell)120 GridData (org.eclipse.swt.layout.GridData)110 ModifyListener (org.eclipse.swt.events.ModifyListener)109 ModifyEvent (org.eclipse.swt.events.ModifyEvent)107 GridLayout (org.eclipse.swt.layout.GridLayout)105 Group (org.eclipse.swt.widgets.Group)90 Event (org.eclipse.swt.widgets.Event)76 Listener (org.eclipse.swt.widgets.Listener)76 Display (org.eclipse.swt.widgets.Display)72 FormAttachment (org.eclipse.swt.layout.FormAttachment)68 FormData (org.eclipse.swt.layout.FormData)68 FormLayout (org.eclipse.swt.layout.FormLayout)68