Wednesday, September 4, 2013

How to create a Eclipse plugin wizard page part 2

How To Capture Keyboard Event in the plug-in wizard

Next lets see how to get what user input in the text box.
To that we need to put key Listener.

        host.addKeyListener(new KeyListener() {

            public void keyPressed(KeyEvent e) {

            public void keyReleased(KeyEvent e) {
                if (!host.getText().isEmpty()) {



We can attach a KeyListener() or KeyAdapter() to a widget control to keep track the keyboard event.

Adds the listener to the collection of listeners who will be notified when keys are pressed and released  on the system keyboard, by sending it one of the messages defined in the KeyListener interface.

we can use the getText() method to o get the what the user has enterd.

public String getText1() {
        return host.getText();

And after we need to add the page to the wizard. Wizard is invoked by when we call the addpages() method.Here I have given a parameter user_select_value.It is not necessary to do that.Create a new instance of the wizard page and then add it to the list of pages.
          RS_wizard_page1 one;
        one = new RS_wizard_page1(user_select_value);

No comments:

Post a Comment