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 148799 Details for
Bug 291383
CCombo creates too many shells
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
CCombo share shells
ccombohack.txt (text/plain), 3.98 KB, created by
Kevin Barnes
on 2009-10-05 12:29:04 EDT
(
hide
)
Description:
CCombo share shells
Filename:
MIME Type:
Creator:
Kevin Barnes
Created:
2009-10-05 12:29:04 EDT
Size:
3.98 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.swt >Index: Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java,v >retrieving revision 1.132 >diff -u -r1.132 CCombo.java >--- Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java 1 Oct 2009 18:05:43 -0000 1.132 >+++ Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java 1 Oct 2009 20:07:25 -0000 >@@ -59,6 +59,7 @@ > Shell _shell; > > static final String PACKAGE_PREFIX = "org.eclipse.swt.custom."; //$NON-NLS-1$ >+ static final String SHELL_KEY = "org.eclipse.swt.custom.CCombo.SHELL"; //$NON-NLS-1$ > > /** > * Constructs a new instance of this class given its parent >@@ -361,17 +362,12 @@ > notifyListeners(SWT.Dispose, event); > event.type = SWT.None; > >- if (popup != null && !popup.isDisposed ()) { >- list.removeListener (SWT.Dispose, listener); >- popup.dispose (); >- } >+ disposePopup (); > Shell shell = getShell (); > shell.removeListener (SWT.Deactivate, listener); > Display display = getDisplay (); > display.removeFilter (SWT.FocusIn, filter); >- popup = null; > text = null; >- list = null; > arrow = null; > _shell = null; > break; >@@ -432,9 +428,14 @@ > checkWidget (); > text.copy (); > } >-void createPopup(String[] items, int selectionIndex) { >- // create shell and list >- popup = new Shell (getShell (), SWT.NO_TRIM | SWT.ON_TOP); >+void createPopup(String[] items, int selectionIndex) { >+ Shell shell = getShell(); >+ popup = (Shell) shell.getData (SHELL_KEY); >+ if (popup == null || popup.isDisposed ()) { >+ popup = new Shell (getShell (), SWT.NO_TRIM | SWT.ON_TOP); >+ shell.setData (SHELL_KEY, popup); >+ } >+ > int style = getStyle (); > int listStyle = SWT.SINGLE | SWT.V_SCROLL; > if ((style & SWT.FLAT) != 0) listStyle |= SWT.FLAT; >@@ -444,6 +445,7 @@ > if (font != null) list.setFont (font); > if (foreground != null) list.setForeground (foreground); > if (background != null) list.setBackground (background); >+ list.setVisible(false); > > int [] popupEvents = {SWT.Close, SWT.Paint, SWT.Deactivate}; > for (int i=0; i<popupEvents.length; i++) popup.addListener (popupEvents [i], listener); >@@ -511,12 +513,26 @@ > text.setText(""); //$NON-NLS-1$ > list.deselectAll (); > } >+void disposePopup() { >+ if (popup != null && !popup.isDisposed ()) { >+ list.removeListener (SWT.Dispose, listener); >+ list.dispose(); >+ if (popup.getChildren().length == 0) { >+ popup.dispose (); >+ Shell shell = getShell(); >+ if (!shell.isDisposed()) shell.setData(SHELL_KEY, null); >+ } >+ popup = null; >+ list = null; >+ } >+} > void dropDown (boolean drop) { > if (drop == isDropped ()) return; > if (!drop) { > popup.setVisible (false); >- if (!isDisposed () && isFocusControl()) { >- text.setFocus(); >+ if (!isDisposed ()) { >+ list.setVisible (false); >+ if (isVisible() && isFocusControl ()) text.setFocus (); > } > return; > } >@@ -524,10 +540,7 @@ > if (getShell() != popup.getParent ()) { > String[] items = list.getItems (); > int selectionIndex = list.getSelectionIndex (); >- list.removeListener (SWT.Dispose, listener); >- popup.dispose(); >- popup = null; >- list = null; >+ disposePopup (); > createPopup (items, selectionIndex); > } > >@@ -552,6 +565,7 @@ > if (y + height > displayRect.y + displayRect.height) y = parentRect.y - height; > if (x + width > displayRect.x + displayRect.width) x = displayRect.x + displayRect.width - listRect.width; > popup.setBounds (x, y, width, height); >+ list.setVisible (true); > popup.setVisible (true); > if (isFocusControl()) list.setFocus (); > } >@@ -995,7 +1009,7 @@ > }); > } > boolean isDropped () { >- return popup.getVisible (); >+ return list.isVisible(); > } > public boolean isFocusControl () { > checkWidget(); >@@ -1131,6 +1145,7 @@ > text.paste (); > } > void popupEvent(Event event) { >+ if (!isDropped()) return; > switch (event.type) { > case SWT.Paint: > // draw black rectangle around list
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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 291383
: 148799