delay in text input
User is typing something in Text component. When he is stopped typing for 1 second I want get text and handle it.
I try to do like that

    final Timer timer = new Timer();
		Text text = new Text(shell, SWT.BORDER);
		text.addModifyListener(new ModifyListener() {
			@Override
			public void modifyText(ModifyEvent e) {
				timer.purge();
				timer.schedule(new TimerTask() {
					@Override
					public void run() {
						//handler
						System.out
								.println("MainClass.main(...).new SelectionAdapter() {...}.widgetSelected(...).new TimerTask() {...}.run()");
					}
				}, 500);
			}
		});
But this code works incorrectly
delay in text input
===

User is typing something in Text component. When he is stopped typing for 1 second I want get text and handle it.
I try to do like that

    final Timer timer = new Timer();
		Text text = new Text(shell, SWT.BORDER);
		text.addModifyListener(new ModifyListener() {
			@Override
			public void modifyText(ModifyEvent e) {
				timer.purge();
				timer.schedule(new TimerTask() {
					@Override
					public void run() {
						//handler
						System.out
								.println("MainClass.main(...).new SelectionAdapter() {...}.widgetSelected(...).new TimerTask() {...}.run()");
					}
				}, 500);
			}
		});
But this code works incorrectly