java - Adding KeyListener to TitleAreaDialog -


i have titleareadialog tableviewer allows user select row table. problem is, content of table may change on time. implement refresh behaviour commonly found in browsers (e.g. pressing f5 content of table should refresh).

below screenshot should make scenario little clearer:

it looks there possible solution in this question, think flawed several reasons:

  • the listener isn't detached (e.g if reopen dialog have 2 filters on display)
  • it doen't add listener titleareadialog or widget believe belongs architectural point of view.
  • i avoid manual listener-attaching/detaching (e.g. listener should disposed titleareadialog)

long story short: proper way of adding keylistener titleareadialog (or dialog in general) without using filter mechanism described in aforementioned question?

i know question somehwhat fails in sscce department, pointers right direction highly appreciated.

dialog tableviewer

adding listener key events tricky thing. want listener fired when none of contained controls has focus , want fire if child of dialog has focus.

there 2 solutions problem:

  1. the obvious choice: use addfilter when dialog created , removefilter when dialog closed (in close()).
  2. create listener swt.keyup , add all children of dialog. necessary event fire independent of focus control.

i prefer solution 1, since it's less clutter , swt take care of (well, except adding , removing filter). adding listener child controls nothing should do, job well.


if don't want add , remove filter each time, create subclass dialog or titleareadialog once, , reuse subclassing again.

if adding , removing filter hassle in general, i'm afraid there no easier solution.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -