ボタンからのキーの送信
パレットを使用して、SWT ボタン・ウィジェットを変換に追加します。RcpTransformation クラスの postRender() メソッドをオーバーライドします。
注: postRender() メソッドをオーバーライドするには、以下の手順を実行します。
postRender() メソッドに、以下のコードを追加します。 - ソース・エディター・ペインで右クリックします。
- 「ソース」>「メソッドのオーバーライド/実装」を選択します。
- RcpTransformation の下にある postRender() にチェック・マークを付けます。
- 「OK」をクリックします。
final RcpContextAttributes attrs = (RcpContextAttributes) getContextAttributes();
button.addSelectionListener(new SelectionListener()
{
public void widgetDefaultSelected(SelectionEvent event) {
}
public void widgetSelected(SelectionEvent event) {
attrs.getSessionService().sendCommand("[enter]");
}
});