Search code examples
javaswtactioncomposite

How create action for composite


I've created my own org.eclipse.swt.widgets.Composite. I am using this composite within a org.eclipse.jface.wizard.WizardPage.

org.eclipse.swt.widgets.Composite has a variable pageComplete. I have to check the value of this variable after any change in the Composite or after every change of this variable. How do it do that?

My first idea was to create my own action for the Composite, but I don't know how to do that.

Or maybe someone can think of a better way to achieve this?


Solution

  • If you have this question - please, read this article

    Thank to @mmoulis

    ps: how i did

    Add to org.eclipse.swt.widgets.Composite class value:

    private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
    

    And added two methods

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        propertyChangeSupport.addPropertyChangeListener(listener);
    }
    
    public void removePropertyChangeListener(PropertyChangeListener listener) {
        propertyChangeSupport.removePropertyChangeListener(listener);
    }
    

    And in pages class added listener to org.eclipse.swt.widgets.Composite

    composite.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
        }
    });
    

    This all ( :