use of org.eclipse.jface.dialogs.IDialogSettings in project translationstudio8 by heartsome.
the class ImportDocxDialog method okPressed.
@Override
protected void okPressed() {
if (xliffPathTxt.getText() == null || xliffPathTxt.getText().trim().equals("")) {
MessageDialog.openInformation(getShell(), Messages.getString("all.dialog.ok.title"), Messages.getString("ImportDocxDialog.ok.msg0"));
return;
}
IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings();
dialogSettings.put(STORE_DOCX_PATH, docxPathTxt.getText().trim());
XLFValidator.resetFlag();
if (!XLFValidator.validateXliffFile(xliffFullPath)) {
return;
}
XLFValidator.resetFlag();
final String docxPath = docxPathTxt.getText();
if (docxPath == null || docxPath.trim().equals("")) {
MessageDialog.openInformation(getShell(), Messages.getString("all.dialog.ok.title"), Messages.getString("ImportDocxDialog.ok.msg1"));
return;
}
if (!new File(docxPath).exists()) {
MessageDialog.openWarning(getShell(), Messages.getString("all.dialog.warning"), MessageFormat.format(Messages.getString("ImportDocxDialog.ok.msg2"), new Object[] { docxPath }));
return;
}
// 开始进行处理
IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
monitor.beginTask(Messages.getString("ImportDocxDialog.ok.monitor.msg0"), 10);
beginImport(docxPath);
monitor.done();
} catch (Exception e) {
LOGGER.error("", e);
}
}
};
try {
new ProgressMonitorDialog(getShell()).run(true, true, runnable);
} catch (Exception e) {
LOGGER.error("", e);
}
close();
}
use of org.eclipse.jface.dialogs.IDialogSettings in project translationstudio8 by heartsome.
the class FindReplaceDialog method writeDialogSettings.
private void writeDialogSettings() {
IDialogSettings ids = getDialogSettings();
ids.put("nattable.FindReplaceDialog.direction", backwardButton.getSelection());
ids.put("nattable.FindReplaceDialog.range", targetButton.getSelection());
ids.put("nattable.FindReplaceDialog.caseSensitive", caseSensitiveButton.getSelection());
ids.put("nattable.FindReplaceDialog.wholeWord", wholeWordButton.getSelection());
ids.put("nattable.FindReplaceDialog.regEx", regExButton.getSelection());
if (okToUse(cmbFind)) {
String findString = cmbFind.getText();
if (findString.length() > 0) {
lstFindHistory.add(0, findString);
}
writeHistory(lstFindHistory, ids, "nattable.FindReplaceDialog.findHistory");
}
if (okToUse(cmbReplace)) {
String replaceString = cmbReplace.getText();
if (replaceString.length() > 0) {
lstReplaceHistory.add(0, replaceString);
}
writeHistory(lstReplaceHistory, ids, "nattable.FindReplaceDialog.replaceHistory");
}
}
use of org.eclipse.jface.dialogs.IDialogSettings in project translationstudio8 by heartsome.
the class WizardFileSystemResourceExportPage2 method internalSaveWidgetValues.
/**
* Hook method for saving widget values for restoration by the next instance of this class.
*/
protected void internalSaveWidgetValues() {
// update directory names history
IDialogSettings settings = getDialogSettings();
if (settings != null) {
String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID);
if (directoryNames == null) {
directoryNames = new String[0];
}
directoryNames = addToHistory(directoryNames, getDestinationValue());
settings.put(STORE_DESTINATION_NAMES_ID, directoryNames);
// options
if (null != overwriteExistingFilesCheckbox) {
settings.put(STORE_OVERWRITE_EXISTING_FILES_ID, overwriteExistingFilesCheckbox.getSelection());
}
settings.put(STORE_CREATE_STRUCTURE_ID, true);
settings.put(SELECT_TM_EXPORTED, tmCheck.getSelection());
settings.put(SELECT_TB_EXPORTED, tbCheck.getSelection());
}
}
use of org.eclipse.jface.dialogs.IDialogSettings in project translationstudio8 by heartsome.
the class FileAnalysisDialog method createFileDataGroup.
/**
* @param parent
*/
public void createFileDataGroup(Composite parent) {
Composite parentCmp = new Composite(parent, SWT.NONE);
GridLayoutFactory.fillDefaults().extendedMargins(9, 9, 0, 0).numColumns(1).applyTo(parentCmp);
GridDataFactory.fillDefaults().grab(true, true).applyTo(parentCmp);
tableViewer = new TableViewer(parentCmp, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
final Table table = tableViewer.getTable();
GridData tableData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH);
tableData.heightHint = 50;
table.setLayoutData(tableData);
table.setLinesVisible(true);
table.setHeaderVisible(true);
String[] columnNames = new String[] { Messages.getString("qa.all.dialog.index"), Messages.getString("qa.dialogs.FileAnalysisDialog.xliffFile") };
int[] columnAlignments = new int[] { SWT.LEFT, SWT.LEFT };
for (int i = 0; i < columnNames.length; i++) {
TableColumn tableColumn = new TableColumn(table, columnAlignments[i]);
tableColumn.setText(columnNames[i]);
tableColumn.setWidth(50);
}
tableViewer.setLabelProvider(new TableViewerLabelProvider());
tableViewer.setContentProvider(new ArrayContentProvider());
tableViewer.setInput(getQATableInfo());
// 让列表列宽动态变化
table.addListener(SWT.Resize, new Listener() {
public void handleEvent(Event event) {
final Table table = ((Table) event.widget);
final TableColumn[] columns = table.getColumns();
event.widget.getDisplay().syncExec(new Runnable() {
public void run() {
double[] columnWidths = new double[] { 0.1, 0.8 };
for (int i = 0; i < columns.length; i++) columns[i].setWidth((int) (table.getBounds().width * columnWidths[i]));
}
});
}
});
// 如果是字数分析
if (isWordsFa) {
IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings();
if (CommonFunction.checkEdition("U")) {
exter101Btn = new Button(parentCmp, SWT.CHECK);
exter101Btn.setText(Messages.getString("qa.dialogs.FileAnalysisDialog.lockExter101"));
exter101Btn.setSelection(dialogSettings.getBoolean(LOCK_EXTER_101));
}
exter100Btn = new Button(parentCmp, SWT.CHECK);
exter100Btn.setText(Messages.getString("qa.dialogs.FileAnalysisDialog.lockExter100"));
interRepeatBtn = new Button(parentCmp, SWT.CHECK);
interRepeatBtn.setText(Messages.getString("qa.dialogs.FileAnalysisDialog.lockInterRepeat"));
exter100Btn.setSelection(dialogSettings.getBoolean(LOCK_EXTER_100));
interRepeatBtn.setSelection(dialogSettings.getBoolean(LOCK_INTER_REPEAT));
}
}
use of org.eclipse.jface.dialogs.IDialogSettings in project translationstudio8 by heartsome.
the class FileAnalysisDialog method okPressed.
@Override
protected void okPressed() {
// 传入要锁定重复文本段的参数
if (isWordsFa) {
model.setLockExter101(CommonFunction.checkEdition("U") ? exter101Btn.getSelection() : false);
model.setLockExter100(exter100Btn.getSelection());
model.setLockInterRepeat(interRepeatBtn.getSelection());
IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings();
dialogSettings.put(LOCK_EXTER_101, CommonFunction.checkEdition("U") ? exter101Btn.getSelection() : false);
dialogSettings.put(LOCK_EXTER_100, exter100Btn.getSelection());
dialogSettings.put(LOCK_INTER_REPEAT, interRepeatBtn.getSelection());
}
super.okPressed();
}
Aggregations