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 146811 Details for
Bug 73012
[CTabFolder] setEnabled for CTabItems
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch-v1
patch-73012v2.txt (text/plain), 6.59 KB, created by
Lakshmi P Shanmugam
on 2009-09-09 16:41:50 EDT
(
hide
)
Description:
patch-v1
Filename:
MIME Type:
Creator:
Lakshmi P Shanmugam
Created:
2009-09-09 16:41:50 EDT
Size:
6.59 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.swt >Index: Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java,v >retrieving revision 1.293 >diff -u -r1.293 CTabFolder.java >--- Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java 1 Jul 2009 14:49:32 -0000 1.293 >+++ Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java 9 Sep 2009 19:49:40 -0000 >@@ -1167,6 +1167,10 @@ > gc.drawPolyline(shape); > } > } >+public boolean forceFocus() { >+ if (selectedIndex > 0 && !items[selectedIndex].enabled) return false; >+ return super.forceFocus(); >+} > /** > * Returns <code>true</code> if the receiver's border is visible. > * >@@ -1870,6 +1874,10 @@ > } > } > if (index < 0 || index >= count) return; >+ while (!items[index].enabled) { >+ index = index + offset; >+ if (index < 0 || index >= count) return; >+ } > setSelection (index, true); > forceFocus(); > } >@@ -1932,7 +1940,12 @@ > if (selectedIndex >= 0) { > redraw(); > } else { >- setSelection(0, true); >+ int index = 0; >+ int count = items.length; >+ for (index = 0; index < count; index++) { >+ if (items[index].enabled) break; >+ } >+ setSelection(index, true); > } > } > boolean onMnemonic (Event event, boolean doit) { >@@ -1956,7 +1969,7 @@ > (event.stateMask & SWT.BUTTON3) != 0) return; > Event e = new Event(); > e.item = getItem(new Point(event.x, event.y)); >- if (e.item != null) { >+ if ((e.item != null) && ((CTabItem)e.item).enabled) { > notifyListeners(SWT.DefaultSelection, e); > } > } >@@ -2034,6 +2047,7 @@ > } > } > if (item != null) { >+ if (!item.enabled) return; > if (item.closeRect.contains(x,y)){ > item.closeImageState = SELECTED; > redraw(item.closeRect.x, item.closeRect.y, item.closeRect.width, item.closeRect.height, false); >@@ -2088,6 +2102,7 @@ > CTabItem item = items[i]; > close = false; > if (item.getBounds().contains(x, y)) { >+ if (!item.enabled) return; > close = true; > if (item.closeRect.contains(x, y)) { > if (item.closeImageState != SELECTED && item.closeImageState != HOT) { >@@ -2184,6 +2199,7 @@ > } > } > if (item != null) { >+ if (!item.enabled) return; > if (item.closeRect.contains(x,y)) { > boolean selected = item.closeImageState == SELECTED; > item.closeImageState = HOT; >@@ -2269,6 +2285,9 @@ > } > } > } >+ while (!items[index].enabled && index != selectedIndex) { >+ index = (index + offset + count) % count; >+ } > } > setSelection (index, true); > } >@@ -3220,7 +3239,7 @@ > showItem(selection); > return; > } >- >+ if (!items[index].enabled) return; > int oldIndex = selectedIndex; > selectedIndex = index; > if (oldIndex != -1) { >@@ -3244,6 +3263,11 @@ > oldControl.setVisible(false); > } > } >+ if (oldIndex != -1 && !items[oldIndex].enabled) { >+ if (oldControl != null && !oldControl.isDisposed() && !oldControl.isEnabled()) { >+ oldControl.setEnabled(items[oldIndex].controlEnabled); >+ } >+ } > showItem(selection); > redraw(); > } >@@ -4022,6 +4046,7 @@ > if (showChevron && chevronRect.contains(x, y)) return SWT.getMessage("SWT_ShowList"); //$NON-NLS-1$ > CTabItem item = getItem(new Point (x, y)); > if (item == null) return null; >+ if (!item.enabled) return null; > if (!item.showing) return null; > if ((showClose || item.showClose) && item.closeRect.contains(x, y)) { > return SWT.getMessage("SWT_Close"); //$NON-NLS-1$ >Index: Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java,v >retrieving revision 1.118 >diff -u -r1.118 CTabItem.java >--- Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java 1 Jul 2009 14:49:33 -0000 1.118 >+++ Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java 9 Sep 2009 19:49:42 -0000 >@@ -50,6 +50,8 @@ > int closeImageState = CTabFolder.NONE; > boolean showClose = false; > boolean showing = false; >+ boolean enabled = true; >+ boolean controlEnabled = true; > > // internal constants > static final int TOP_MARGIN = 2; >@@ -718,6 +720,24 @@ > return disabledImage; > } > /** >+ * Returns <code>true</code> if the receiver is enabled, and >+ * <code>false</code> otherwise. A disabled CTabItem is >+ * not selectable from the user interface. >+ * >+ * @return the receiver's enabled state >+ * >+ * @exception SWTException <ul> >+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> >+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> >+ * </ul> >+ * >+ * @since 3.6 >+ */ >+public boolean getEnabled () { >+ checkWidget(); >+ return this.enabled; >+} >+/** > * Returns the font that the receiver will use to paint textual information. > * > * @return the receiver's font >@@ -901,6 +921,7 @@ > } else { > this.control.setVisible(false); > } >+ this.controlEnabled = control.getEnabled(); > } > } > /** >@@ -924,6 +945,36 @@ > this.disabledImage = image; > } > /** >+ * Enables the receiver if the argument is <code>true</code>, >+ * and disables it otherwise. A disabled CTabItem is typically >+ * not selectable from the user interface. >+ * >+ * @param enabled the new enabled state >+ * >+ * @exception SWTException <ul> >+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> >+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> >+ * </ul> >+ * >+ * @since 3.6 >+ */ >+public void setEnabled (boolean enabled) { >+ checkWidget(); >+ if (this.enabled == enabled) return; >+ >+ this.enabled = enabled; >+ if (this.control != null) { >+ if (!enabled && (parent.getSelection() == this)) { >+ this.controlEnabled = this.control.getEnabled(); >+ this.control.setEnabled(enabled); >+ } else if (enabled && (parent.getSelection() == this)) { >+ if (!this.control.getEnabled()) { >+ this.control.setEnabled(this.controlEnabled); >+ } >+ } >+ } >+} >+/** > * Sets the font that the receiver will use to paint textual information > * for this item to the font specified by the argument, or to the default font > * for that kind of control if the argument is null.
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 73012
:
146811
|
146812
|
147320