How to build the plug-in for ignoring mouse wheel scrolling in the location bar of the Internal Web Browser.
01. Install(unzip) Eclipse Classic 3.7.2
02. Start eclipse with new workspace
03. Open perspective "Plug-in Development"
04. Click "Plug-ins" next to Package Explorer
05. Select org.eclipse.ui.browser (3.3.101.v20111019-1723)
06. Right-click and select "Import As"->"Source Project"
07. Go back to Package Explorer
08. Expand org.eclipse.ui.browser project
09. Open src/org.eclipse.ui.internal.browser/BrowserViewer.java
10. Goto line 719 and make sure the code
private ToolBar createLocationBar(Composite parent) {
combo = new Combo(parent, SWT.DROP_DOWN);
updateHistory();
combo.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent we) {
try {
11. Insert customizing code after "updateHistory();"
private ToolBar createLocationBar(Composite parent) {
combo = new Combo(parent, SWT.DROP_DOWN);
updateHistory();
// begin customizing
final String MOUSE_SCROLLED = "adhoc.mouseScrolled";
combo.addMouseWheelListener(new MouseWheelListener() {
public void mouseScrolled(MouseEvent e) {
if (!combo.getListVisible()) {
combo.setData(MOUSE_SCROLLED, Boolean.TRUE);
}
}
});
combo.addKeyListener(new KeyListener() {
public void keyReleased(KeyEvent e) {
}
public void keyPressed(KeyEvent e) {
if (Boolean.TRUE.equals(combo.getData(MOUSE_SCROLLED))) {
switch (e.keyCode) {
case SWT.ARROW_DOWN:
case SWT.ARROW_UP:
case SWT.PAGE_DOWN:
case SWT.PAGE_UP:
e.doit = false;
break;
}
combo.setData(MOUSE_SCROLLED, null);
}
}
});
// end customizing
combo.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent we) {
try {
12. Fix errors
12-a. Hit Ctrl+Shift+O
12-b. Choose org.eclipse.swt.events.KeyEvent
12-c. Choose org.eclipse.swt.events.MouseWheelListener
12-d. Choose org.eclipse.swt.events.KeyListener
13. Save it and close the editor
14. Execute export wizard (menu/File->Export)
15. Expand "Plug-in Development"
16. Select "Deployable plug-ins and fragments" and click "Next"
17. Enter your output directory in the "Directory" box and click "Finish"
18. Make sure {your output directory}/plugins/org.eclipse.ui.browser_3.3.101.v20111019-1723.jar existed
19. Exit eclipse
20. Backup eclipse/plugins/org.eclipse.ui.browser_3.3.101.v20111019-1723.jar
21. Copy new org.eclipse.ui.browser_3.3.101.v20111019-1723.jar to eclipse/plugins
22. Start eclipse (no need any options such as "-clean")
That's all.
Here is a binary file.
http://sourceforge.jp/downloads/users/1/1200/org.eclipse.ui.browser_3.3.101.v20111019-1723.jar
I'm not interested in this issue but it seems there is no browser having this behaviour. At least IE8, Firefox12 and Chrome21 disallowed mouse scrolling in the address bar since it is not a combo-box(control/widget).
It hurts user interface indeed.