use of org.eclipse.swt.events.SelectionListener in project translationstudio8 by heartsome.
the class TMXValidatorDialog method createMenu.
private void createMenu(Composite tparent) {
Menu menuBar = new Menu(getShell(), SWT.BAR);
getShell().setMenuBar(menuBar);
getShell().pack();
Rectangle screenSize = Display.getDefault().getClientArea();
Rectangle frameSize = getShell().getBounds();
getShell().setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
// 文件菜单
Menu fileMenu = new Menu(menuBar);
MenuItem fileItem = new MenuItem(menuBar, SWT.CASCADE);
fileItem.setText(Messages.getString("dialog.TMXValidatorDialog.fileMenu"));
fileItem.setMenu(fileMenu);
MenuItem openFileItem = new MenuItem(fileMenu, SWT.PUSH);
openFileItem.setText(Messages.getString("dialog.TMXValidatorDialog.openFileItem"));
openFileItem.setImage(new Image(Display.getDefault(), openFilePath));
openFileItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
openFile();
}
});
MenuItem clearCharItem = new MenuItem(fileMenu, SWT.PUSH);
clearCharItem.setText(Messages.getString("dialog.TMXValidatorDialog.clearCharItem"));
clearCharItem.setImage(new Image(Display.getDefault(), clearCharPath));
clearCharItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
cleanCharacters();
}
});
new MenuItem(fileMenu, SWT.SEPARATOR);
MenuItem quitItem = new MenuItem(fileMenu, SWT.PUSH);
quitItem.setText(Messages.getString("dialog.TMXValidatorDialog.quitItem"));
quitItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
close();
}
});
// 帮助菜单
Menu helpMenu = new Menu(menuBar);
MenuItem helpItem = new MenuItem(menuBar, SWT.CASCADE);
helpItem.setText(Messages.getString("dialog.TMXValidatorDialog.helpMenu"));
helpItem.setMenu(helpMenu);
MenuItem aboutItem = new MenuItem(helpMenu, SWT.PUSH);
aboutItem.setText(Messages.getString("dialog.TMXValidatorDialog.aboutItem"));
String aboutPath = PluginUtil.getAbsolutePath(PluginConstants.LOGO_TMXVALIDATOR_MENU_PATH);
aboutItem.setImage(new Image(Display.getDefault(), aboutPath));
aboutItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
AboutDialog dialog = new AboutDialog(getShell(), Messages.getString("dialog.TMXValidatorDialog.aboutItemName"), imagePath, Messages.getString("dialog.TMXValidatorDialog.version"));
dialog.open();
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
}
use of org.eclipse.swt.events.SelectionListener in project translationstudio8 by heartsome.
the class XSLTransformationDialog method createMenu.
/**
* 创建菜单 ;
*/
private void createMenu() {
Menu menu = new Menu(getShell(), SWT.BAR);
getShell().setMenuBar(menu);
getShell().pack();
Rectangle screenSize = Display.getDefault().getClientArea();
Rectangle frameSize = getShell().getBounds();
getShell().setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
Menu fileMenu = new Menu(menu);
MenuItem fileItem = new MenuItem(menu, SWT.CASCADE);
fileItem.setText(Messages.getString("dialog.XSLTransformationDialog.fileItem"));
fileItem.setMenu(fileMenu);
MenuItem exitItem = new MenuItem(fileMenu, SWT.PUSH);
exitItem.setText(Messages.getString("dialog.XSLTransformationDialog.exitItem"));
exitItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
close();
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
Menu helpMenu = new Menu(menu);
MenuItem helpItem = new MenuItem(menu, SWT.CASCADE);
helpItem.setText(Messages.getString("dialog.XSLTransformationDialog.helpMenu"));
helpItem.setMenu(helpMenu);
MenuItem aboutItem = new MenuItem(helpMenu, SWT.PUSH);
aboutItem.setText(Messages.getString("dialog.XSLTransformationDialog.aboutItem"));
String imgPath = PluginUtil.getAbsolutePath(PluginConstants.LOGO_XSL_MENU_PATH);
aboutItem.setImage(new Image(Display.getDefault(), imgPath));
aboutItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
AboutDialog dialog = new AboutDialog(getShell(), Messages.getString("dialog.XSLTransformationDialog.aboutItemName"), imagePath, Messages.getString("dialog.XSLTransformationDialog.aboutItemVersion"));
dialog.open();
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
}
use of org.eclipse.swt.events.SelectionListener in project translationstudio8 by heartsome.
the class NonTranslationQAPage method initListener.
/**
* 一些事件的添加
*/
public void initListener() {
// 非译元素的添加事件
addBtn.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
addNonTransElement();
}
public void widgetDefaultSelected(SelectionEvent e) {
addNonTransElement();
}
});
editBtn.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent arg0) {
editNontransElement();
}
public void widgetDefaultSelected(SelectionEvent arg0) {
editNontransElement();
}
});
// 删除按钮的点击操作
deleteBtn.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
deleteElement();
}
public void widgetDefaultSelected(SelectionEvent e) {
deleteElement();
}
});
// 给comboViewer添加事件,同时传入内置元素
comboViewer.getCombo().addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
addInternalElement();
comboViewer.getCombo().setText(Messages.getString("qa.preference.NonTranslationQAPage.addInterElement"));
}
public void widgetDefaultSelected(SelectionEvent e) {
addInternalElement();
comboViewer.getCombo().setText(Messages.getString("qa.preference.NonTranslationQAPage.addInterElement"));
}
});
// 非译元素列表的点击事件
tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
ISelection selection = tableViewer.getSelection();
if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) {
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
if (structuredSelection.getFirstElement() instanceof NontransElementBean) {
if (structuredSelection.size() == 1 && !validIsInternalElementNonTip((NontransElementBean) structuredSelection.getFirstElement())) {
editBtn.setEnabled(true);
} else {
editBtn.setEnabled(false);
}
deleteBtn.setEnabled(true);
} else {
setAddModel();
}
} else {
setAddModel();
}
}
});
tableViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent arg0) {
editNontransElement();
}
});
}
use of org.eclipse.swt.events.SelectionListener in project translationstudio8 by heartsome.
the class ColumnCategoriesDialog method createUpButton.
private Button createUpButton(Composite upDownbuttonComposite) {
Button upButton = new Button(upDownbuttonComposite, SWT.PUSH);
upButton.setImage(GUIHelper.getImage("arrow_up"));
upButton.setLayoutData(GridDataFactory.fillDefaults().grab(false, true).align(SWT.CENTER, SWT.CENTER).create());
upButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
public void widgetSelected(SelectionEvent e) {
moveSelectedUp();
}
});
return upButton;
}
use of org.eclipse.swt.events.SelectionListener in project translationstudio8 by heartsome.
the class ColumnCategoriesDialog method createAddButton.
private Button createAddButton(Composite buttonComposite) {
Button addButton = new Button(buttonComposite, SWT.PUSH);
addButton.setImage(GUIHelper.getImage("arrow_right"));
addButton.setLayoutData(GridDataFactory.fillDefaults().grab(false, true).align(SWT.CENTER, SWT.CENTER).create());
addButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
public void widgetSelected(SelectionEvent e) {
addSelected();
}
});
return addButton;
}
Aggregations