use of org.eclipse.jface.bindings.keys.KeySequenceText in project translationstudio8 by heartsome.
the class PluginConfigManageDialog method createShortcutKeyGoup.
/**
* 创建快捷键面板
* @param tparent
* ;
*/
private void createShortcutKeyGoup(Composite tparent) {
Group group = new Group(tparent, SWT.None);
group.setText(Messages.getString("dialog.PluginConfigManageDialog.group"));
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(group);
GridLayoutFactory.swtDefaults().numColumns(2).applyTo(group);
Label keyLbl = new Label(group, SWT.NONE);
keyLbl.setText(Messages.getString("dialog.PluginConfigManageDialog.keyLbl"));
keyTxt = new Text(group, SWT.BORDER);
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(keyTxt);
fKeySequenceText = new KeySequenceText(keyTxt);
fKeySequenceText.setKeyStrokeLimit(4);
fKeySequenceText.addPropertyChangeListener(new IPropertyChangeListener() {
public final void propertyChange(final PropertyChangeEvent event) {
if (!event.getOldValue().equals(event.getNewValue())) {
final KeySequence keySequence = fKeySequenceText.getKeySequence();
if (!keySequence.isComplete()) {
return;
}
keyTxt.setSelection(keyTxt.getTextLimit());
}
}
});
}
Aggregations