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 130834 Details for
Bug 193064
[CTabFolder] CtabItem pre-closure/pre-selection changed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch using Page Manager
code-193064-new.txt (text/plain), 4.55 KB, created by
Lakshmi P Shanmugam
on 2009-04-03 10:08:13 EDT
(
hide
)
Description:
patch using Page Manager
Filename:
MIME Type:
Creator:
Lakshmi P Shanmugam
Created:
2009-04-03 10:08:13 EDT
Size:
4.55 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.289 >diff -u -r1.289 CTabFolder.java >--- Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java 2 Apr 2009 22:35:06 -0000 1.289 >+++ Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java 3 Apr 2009 14:07:08 -0000 >@@ -202,6 +202,7 @@ > // on Resize > Point oldSize; > Font oldFont; >+ CTabFolderPageManager pageManager; > > // internal constants > static final int DEFAULT_WIDTH = 64; >@@ -555,6 +556,12 @@ > color.dispose(); > } > } >+boolean canLeaveThePage(int oldIndex, int newIndex) { >+ if (pageManager != null) { >+ return pageManager.canLeaveThePage(oldIndex, newIndex); >+ } >+ return true; >+} > /* > * This class was not intended to be subclassed but this restriction > * cannot be enforced without breaking backward compatibility. >@@ -1416,6 +1423,16 @@ > checkWidget(); > return mru; > } >+/** >+ * Returns the Page Manager that is used by the <code>CTabfolder</code> before switching between tab-items. >+ * >+ * @return the tabfolder's Page Manager, or null if no Page Manager has been set. >+ * >+ * @since >+ */ >+public CTabFolderPageManager getPageManager() { >+ return pageManager; >+} > int getRightItemEdge (){ > int x = getSize().x - borderRight - 3; > if (showMin) x -= BUTTON_SIZE; >@@ -3185,6 +3202,28 @@ > } > } > /** >+ * Sets the Page Manager that will be used to by the <code>CTabFolder</code> before >+ * switching between tab-items. >+ * The Page Manager should implement the <code>CTabFolderPageManager</code> and >+ * implement the method <code>canLeaveThePage</code>. >+ * >+ * @param pageManager the Page Manager for the <code>CTabFolder</code> >+ * >+ * @exception IllegalArgumentException <ul> >+ * <li>ERROR_INVALID_RANGE - if the index is out of range</li> >+ * </ul> >+ * >+ * @exception SWTException <ul> >+ * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> >+ * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> >+ * </ul> >+ * >+ * @since >+ */ >+public void setPageManager(CTabFolderPageManager pageManager) { >+ this.pageManager = pageManager; >+} >+/** > * Set the selection to the tab at the specified item. > * > * @param item the tab item to be selected >@@ -3222,7 +3261,12 @@ > showItem(selection); > return; > } >- >+ /* >+ * If the user has set a Page Manager for the previously selected tab-item, >+ * then call the canLeaveThePage() method to do any validations in the Page Manager, >+ * before switching the tab. Don't change the tab selection if validation fails. >+ */ >+ if (selectedIndex != -1 && !canLeaveThePage(selectedIndex, index)) return; > int oldIndex = selectedIndex; > selectedIndex = index; > if (oldIndex != -1) { >Index: Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderPageManager.java >=================================================================== >RCS file: Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderPageManager.java >diff -N Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderPageManager.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderPageManager.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,25 @@ >+package org.eclipse.swt.custom; >+ >+/** >+ * This is an Interface which provides a mechanism to use a Page Manager for a <code>CTabItem</code>. >+ * The Page Manager can be used to do any validations as required by the user while switching between tab-items. >+ * The Page Manager should implement the method <code>canLeaveThePage</code>. >+ */ >+ >+public interface CTabFolderPageManager { >+ /** >+ * This method is called before changing the tab selection of the <code>CTabFolder</code> >+ * >+ * @param oldIndex is index of tab selected in the <code>CTabFolder</code> >+ * @param newIndex is index of the tab that will be selected if this method returns true >+ * >+ * @return <ul> >+ * <li><code>true</code> if the tab selection should be changed from <code>oldIndex</code> >+ * to <code>newIndex</code></li> >+ * <li><code>false</code> if the tab selection should not be changed.</li> >+ * </ul> >+ * >+ * @since >+ */ >+ public boolean canLeaveThePage(int oldIndex, int newIndex); >+}
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 193064
:
130832
| 130834 |
130838
|
160744