use of org.eclipse.swt.events.SelectionEvent in project translationstudio8 by heartsome.
the class TmDbManagerDialog method createHelpControl.
/**
* 添加帮助按钮 robert 2012-09-06
*/
@Override
protected Control createHelpControl(Composite parent) {
// ROBERTHELP 记忆库管理
String language = CommonFunction.getSystemLanguage();
final String helpUrl = MessageFormat.format("/net.heartsome.cat.ts.ui.help/html/{0}/ch06s02.html#tm-management", language);
Image helpImage = JFaceResources.getImage(DLG_IMG_HELP);
ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS);
((GridLayout) parent.getLayout()).numColumns++;
toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
toolBar.setCursor(cursor);
toolBar.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
cursor.dispose();
}
});
ToolItem helpItem = new ToolItem(toolBar, SWT.NONE);
helpItem.setImage(helpImage);
//$NON-NLS-1$
helpItem.setToolTipText(JFaceResources.getString("helpToolTip"));
helpItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl);
}
});
return toolBar;
}
use of org.eclipse.swt.events.SelectionEvent in project translationstudio8 by heartsome.
the class ConcordanceSearchDialog method initListener.
/**
* 初始化各控件的监听 ;
*/
private void initListener() {
btnSearch.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
initGroupIdAndSearch();
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
cmbSearch.addKeyListener(new KeyListener() {
public void keyPressed(KeyEvent e) {
if (e.character == SWT.CR) {
initGroupIdAndSearch();
}
}
public void keyReleased(KeyEvent e) {
}
});
btnFirst.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
if (curPageNum > 0 && amountPage > 0) {
curPageNum = 1;
if (search()) {
refreshPageNumText();
}
}
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
btnPre.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
if (curPageNum > 0) {
curPageNum--;
if (search()) {
refreshPageNumText();
}
}
}
});
btnNext.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
if (curPageNum < amountPage) {
curPageNum++;
if (search()) {
refreshPageNumText();
}
}
}
});
btnLast.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
if (curPageNum > 0 && amountPage > 0) {
curPageNum = amountPage;
if (search()) {
refreshPageNumText();
}
}
}
});
txtPage.addKeyListener(new KeyListener() {
public void keyReleased(KeyEvent e) {
}
public void keyPressed(KeyEvent e) {
if (e.character == SWT.CR) {
String pageNum = txtPage.getText();
try {
curPageNum = Integer.parseInt(pageNum);
} catch (NumberFormatException e1) {
// LOGGER.error("NumberFormatException", e1);
txtPage.setText(String.valueOf(curPageNum) + splitPageSeparator + amountPage);
return;
}
if (curPageNum > amountPage) {
curPageNum = amountPage;
}
if (curPageNum < 1) {
curPageNum = 1;
}
search();
txtPage.setText(String.valueOf(curPageNum));
}
}
});
txtPage.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
refreshPageNumText();
}
@Override
public void focusGained(FocusEvent e) {
txtPage.setText("");
}
});
}
use of org.eclipse.swt.events.SelectionEvent in project translationstudio8 by heartsome.
the class ExportTmxDialog method createHelpControl.
/**
* 添加帮助按钮 robert 2012-09-06
*/
@Override
protected Control createHelpControl(Composite parent) {
// ROBERTHELP 导出tmx
String language = CommonFunction.getSystemLanguage();
final String helpUrl = MessageFormat.format("/net.heartsome.cat.ts.ui.help/html/{0}/ch06s03.html#export-tmx", language);
Image helpImage = JFaceResources.getImage(DLG_IMG_HELP);
ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS);
((GridLayout) parent.getLayout()).numColumns++;
toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
toolBar.setCursor(cursor);
toolBar.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
cursor.dispose();
}
});
ToolItem helpItem = new ToolItem(toolBar, SWT.NONE);
helpItem.setImage(helpImage);
//$NON-NLS-1$
helpItem.setToolTipText(JFaceResources.getString("helpToolTip"));
helpItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl);
}
});
return toolBar;
}
use of org.eclipse.swt.events.SelectionEvent in project translationstudio8 by heartsome.
the class NewTmDbImportPage method createControl.
/**
* Create contents of the wizard.
* @param parent
*/
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
setControl(container);
container.setLayout(new GridLayout(3, false));
Label lblTmx = new Label(container, SWT.NONE);
lblTmx.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblTmx.setText(Messages.getString("wizard.NewTmDbImportPage.lblTmx"));
tmxFileText = new Text(container, SWT.BORDER);
tmxFileText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
tmxFileText.setEditable(false);
Button tmxFileBorwserBtn = new Button(container, SWT.NONE);
tmxFileBorwserBtn.setText(Messages.getString("wizard.NewTmDbImportPage.tmxFileBorwserBtn"));
tmxFileBorwserBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog dlg = new FileDialog(getShell());
String[] filterExt = { "*.tmx;*.xlsx;*.txt" };
dlg.setFilterExtensions(filterExt);
String path = dlg.open();
if (path != null) {
tmxFileText.setText(path);
}
}
});
}
use of org.eclipse.swt.events.SelectionEvent in project translationstudio8 by heartsome.
the class UpdateTMWizardDialog method createHelpControl.
/**
* 添加帮助按钮
* robert 2012-09-06
*/
@Override
protected Control createHelpControl(Composite parent) {
// ROBERTHELP 更新记忆库
String language = CommonFunction.getSystemLanguage();
final String helpUrl = MessageFormat.format("/net.heartsome.cat.ts.ui.help/html/{0}/ch06.html#update-tm", language);
Image helpImage = JFaceResources.getImage(DLG_IMG_HELP);
ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS);
((GridLayout) parent.getLayout()).numColumns++;
toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
toolBar.setCursor(cursor);
toolBar.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
cursor.dispose();
}
});
ToolItem helpItem = new ToolItem(toolBar, SWT.NONE);
helpItem.setImage(helpImage);
//$NON-NLS-1$
helpItem.setToolTipText(JFaceResources.getString("helpToolTip"));
helpItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl);
}
});
return toolBar;
}
Aggregations