Bug 237220 - [Preferences] No event occured at ScaleFieldEditor with mouse wheel
Summary: [Preferences] No event occured at ScaleFieldEditor with mouse wheel
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Kim Horne CLA
QA Contact:
URL:
Whiteboard:
Keywords: bugday, helpwanted
Depends on:
Blocks:
 
Reported: 2008-06-15 12:49 EDT by Satoshi OGATA CLA
Modified: 2008-12-09 04:35 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Satoshi OGATA CLA 2008-06-15 12:49:26 EDT
Hello.

I found the issue on SWT/JFace version 3.3.2.
The following source code includes the issue.

----
import java.io.IOException;

import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.jface.preference.IPreferencePageContainer;
import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.jface.preference.PreferenceManager;
import org.eclipse.jface.preference.PreferenceNode;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.preference.ScaleFieldEditor;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class NoEvent extends PreferenceDialog {

    public NoEvent(Shell parentShell, PreferenceManager manager) throws IOException {
        super(parentShell, manager);
        PreferencePage page1 = new SamplePreferencePage("Page1", this);
        PreferenceNode node1 = new PreferenceNode("node1", page1);
        manager.addToRoot(node1);
    }

    private final class SamplePreferencePage extends PreferencePage {
        private FieldEditor editor;
                private SamplePreferencePage(String title, IPreferencePageContainer container) {
            super(title);
            setContainer(container);
        }

        @Override
        protected Control createContents(Composite parent) {
            Composite composite = new Composite(parent, SWT.NONE);
            composite.setLayout(new GridLayout(2, false));
            composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

            editor = new ScaleFieldEditor("scale", "&Scale", composite);
            editor.setPage(this);
            editor.setPreferenceStore(getPreferenceStore());
            editor.load();

            editor.setPropertyChangeListener(new IPropertyChangeListener() {
                @Override
                public void propertyChange(PropertyChangeEvent event) {
                    // Event occured when scale editor was clicked.
                    // However, no event occured when scale value changed with mouse wheel.
                    System.out.println("event occured");
                }
            });

            return parent;
        }
    }

    public static void main(String[] args) throws IOException {
        Display display = new Display();
        Shell shell = new Shell(display);
        NoEvent dialog = new NoEvent(shell, new PreferenceManager());
        dialog.open();
        shell.dispose();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch()) {
                display.sleep();
            }
        }
        display.dispose();
    }
}
----
Comment 1 Remy Suen CLA 2008-12-07 07:08:45 EST
(In reply to comment #0)
> I found the issue on SWT/JFace version 3.3.2.
> The following source code includes the issue.

Hi Satoshi, thanks for your sample code. I am unable to reproduce this on 3.4.0 and on I20081202-1812. Can you confirm that this issue has been resolved on 3.4.0 or 3.4.1? Thanks.
Comment 2 Satoshi OGATA CLA 2008-12-09 04:35:12 EST
Hi, Remy-san,

I cannot reproduce this issue on SWT/JFace version 3.4.1.
Your work was helpful for many people!

Thank you for your hard work.