Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 162200 Details for
Bug 306067
[Widgets] SWT.Deactivate event is not fired to the dropdown shell when enable the Desktop effect
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
Snippet file
SnippetShellDeactivate.java (text/x-java), 3.17 KB, created by
Chih-Hung Chiang
on 2010-03-16 14:34:23 EDT
(
hide
)
Description:
Snippet file
Filename:
MIME Type:
Creator:
Chih-Hung Chiang
Created:
2010-03-16 14:34:23 EDT
Size:
3.17 KB
patch
obsolete
>package org.eclipse.swt.snippets; > >import org.eclipse.swt.SWT; >import org.eclipse.swt.events.DisposeEvent; >import org.eclipse.swt.events.DisposeListener; >import org.eclipse.swt.events.MouseAdapter; >import org.eclipse.swt.events.MouseEvent; >import org.eclipse.swt.events.SelectionAdapter; >import org.eclipse.swt.events.SelectionEvent; >import org.eclipse.swt.graphics.Device; >import org.eclipse.swt.graphics.Point; >import org.eclipse.swt.graphics.Rectangle; >import org.eclipse.swt.layout.RowLayout; >import org.eclipse.swt.widgets.Button; >import org.eclipse.swt.widgets.Display; >import org.eclipse.swt.widgets.Event; >import org.eclipse.swt.widgets.Listener; >import org.eclipse.swt.widgets.Shell; > > > >public class SnippetShellDeactivate { > static Display display = null; > static Shell shell = null; > static Button button = null; > static Shell dropDownShell = null; > > public static void main(String[] args) { > Device.DEBUG = true; > display = new Display(); > shell = new Shell(display); > shell.setLayout(new RowLayout()); > > // create the drop down shell > dropDownShell = new Shell(shell, SWT.ON_TOP | SWT.DROP_DOWN); > dropDownShell.setLayout(new RowLayout()); > dropDownShell.setVisible(false); > dropDownShell.addListener(SWT.Deactivate, new Listener() { > public void handleEvent(Event event) { > System.out.println("dropDownShell entering Deactivate event handler and will hide the dropdown shell"); > hideDropDown(); > } > }); > > dropDownShell.addListener(SWT.Close, new Listener() { > public void handleEvent(Event event) { > hideDropDown(); > } > }); > > > // create the button > button = new Button(shell, SWT.PUSH); > button.setText("Open"); > button.addSelectionListener(new SelectionAdapter() { > public void widgetSelected(SelectionEvent e) { > if (!dropDownShell.isVisible()) { > System.out.println("Open button entering widgetSelected event handler and will show the dropdown shell"); > showDropDown(); > } > } > }); > > button.addMouseListener(new MouseAdapter() { > > public void mouseDown(MouseEvent e) { > System.out.println("Open button entering mouseDown event handler"); > super.mouseDown(e); > } > > public void mouseUp(MouseEvent e) { > System.out.println("Open button entering mouseUp event handler"); > super.mouseUp(e); > } > }); > > > shell.setSize(300, 300); > shell.addDisposeListener(new DisposeListener () { > public void widgetDisposed(DisposeEvent e) { > if (dropDownShell != null && !dropDownShell.isDisposed()) { > dropDownShell.dispose(); > dropDownShell = null; > } > } > }); > shell.open(); > while (!shell.isDisposed()) { > if (!display.readAndDispatch()) > display.sleep(); > } > display.dispose(); > } > > private static void showDropDown() { > if (dropDownShell != null && !dropDownShell.isDisposed()) { > dropDownShell.setText("This is a drop down shell"); > dropDownShell.setSize(100, 200); > Rectangle buttonRect = button.getBounds(); > Point p = button.getParent().toDisplay(new Point(buttonRect.x, buttonRect.y + buttonRect.height)); > dropDownShell.setLocation(p.x, p.y); > dropDownShell.setVisible(true); > dropDownShell.setFocus(); > } > } > > private static void hideDropDown() { > dropDownShell.setVisible(false); > } > >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 306067
: 162200