View | Details | Raw Unified | Return to bug 193064 | Differences between
and this patch

Collapse All | Expand All

(-)Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java (-6 / +14 lines)
Lines 1234-1241 Link Here
1234
				}
1234
				}
1235
			}
1235
			}
1236
			if (index < 0 || index >= count) return;
1236
			if (index < 0 || index >= count) return;
1237
			setSelection (index, true);
1237
			if (setSelection (index, true)) forceFocus();
1238
			forceFocus();
1239
	}
1238
	}
1240
}
1239
}
1241
void onDispose(Event event) {
1240
void onDispose(Event event) {
Lines 1306-1313 Link Here
1306
			if (mnemonic != '\0') {
1305
			if (mnemonic != '\0') {
1307
				if (Character.toLowerCase (key) == mnemonic) {
1306
				if (Character.toLowerCase (key) == mnemonic) {
1308
					if (doit) {
1307
					if (doit) {
1309
					    setSelection(i, true);
1308
					    if (setSelection(i, true)) forceFocus();
1310
					    forceFocus();
1311
					}
1309
					}
1312
					return true;
1310
					return true;
1313
				}
1311
				}
Lines 1409-1415 Link Here
1409
				int index = indexOf(item);
1407
				int index = indexOf(item);
1410
				if (item.showing){
1408
				if (item.showing){
1411
				    	int oldSelectedIndex = selectedIndex;
1409
				    	int oldSelectedIndex = selectedIndex;
1412
				    	setSelection(index, true);
1410
				    	if (!setSelection(index, true)) return;
1413
				    	if (oldSelectedIndex == selectedIndex) {
1411
				    	if (oldSelectedIndex == selectedIndex) {
1414
				    	    /* If the click is on the selected tabitem, then set focus to the tabfolder */
1412
				    	    /* If the click is on the selected tabitem, then set focus to the tabfolder */
1415
				    	    forceFocus();
1413
				    	    forceFocus();
Lines 2711-2717 Link Here
2711
	showItem(selection);
2709
	showItem(selection);
2712
	redraw();
2710
	redraw();
2713
}
2711
}
2714
void setSelection(int index, boolean notify) {	
2712
boolean setSelection(int index, boolean notify) {	
2713
	if (notify && selectedIndex != index && index != -1) {
2714
	    Event event = new Event();
2715
	    event.detail = selectedIndex;
2716
	    event.item = getItem(index);
2717
	    event.index = index;
2718
	    notifyListeners(SWT.PreSelection, event);
2719
	    if (!event.doit) return false;
2720
	}
2721
	
2715
	int oldSelectedIndex = selectedIndex;
2722
	int oldSelectedIndex = selectedIndex;
2716
	setSelection(index);
2723
	setSelection(index);
2717
	if (notify && selectedIndex != oldSelectedIndex && selectedIndex != -1) {
2724
	if (notify && selectedIndex != oldSelectedIndex && selectedIndex != -1) {
Lines 2719-2724 Link Here
2719
		event.item = getItem(selectedIndex);
2726
		event.item = getItem(selectedIndex);
2720
		notifyListeners(SWT.Selection, event);
2727
		notifyListeners(SWT.Selection, event);
2721
	}
2728
	}
2729
	return true;
2722
}
2730
}
2723
/**
2731
/**
2724
 * Sets the receiver's selection background color to the color specified
2732
 * Sets the receiver's selection background color to the color specified
(-)Eclipse SWT/common/org/eclipse/swt/SWT.java (+20 lines)
Lines 714-719 Link Here
714
     * @since 3.6
714
     * @since 3.6
715
	 */
715
	 */
716
	public static final int OpenDoc = 46;
716
	public static final int OpenDoc = 46;
717
718
        /**
719
         * The pre-selection event type (value is 47).
720
         * 
721
         * <p>
722
         * This event is sent by CTabFolder when a CTabItem is selected but before the
723
         * selection changes i.e, before the <code>SWT.Selection</code> event is
724
         * sent. The application can use the <code>doit</code> flag to cancel the
725
         * selection.
726
         * </p>
727
         * 
728
         * The detail field contains the index of the CTabItem before the selection-change.
729
         * The index field contains the index of the selected CTabItem.
730
         * 
731
         * @see org.eclipse.swt.widgets.Widget#addListener
732
         * @see org.eclipse.swt.widgets.Event
733
         * 
734
         * @since 3.6
735
         */
736
    	public static final int PreSelection = 47;
717
	
737
	
718
	/* Event Details */
738
	/* Event Details */
719
	
739
	

Return to bug 193064