### 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 CTabfolder
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 CTabFolder
before
+ * switching between tab-items.
+ * The Page Manager should implement the CTabFolderPageManager
and
+ * implement the method canLeaveThePage
.
+ *
+ * @param pageManager the Page Manager for the CTabFolder
+ *
+ * @exception IllegalArgumentException
CTabItem
.
+ * 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 canLeaveThePage
.
+ */
+
+public interface CTabFolderPageManager {
+ /**
+ * This method is called before changing the tab selection of the CTabFolder
+ *
+ * @param oldIndex is index of tab selected in the CTabFolder
+ * @param newIndex is index of the tab that will be selected if this method returns true
+ *
+ * @return true
if the tab selection should be changed from oldIndex
+ * to newIndex
false
if the tab selection should not be changed.