Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 279103
Collapse All | Expand All

(-)Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java (-4 / +23 lines)
Lines 84-90 Link Here
84
	TreeColumn sortColumn;
84
	TreeColumn sortColumn;
85
	int columnCount;
85
	int columnCount;
86
	int sortDirection;
86
	int sortDirection;
87
	boolean ignoreExpand, ignoreSelect, ignoreRedraw, reloadPending, drawExpansion;
87
	boolean ignoreExpand, ignoreSelect, ignoreRedraw, reloadPending, drawExpansion, wasSelected;
88
	Rectangle imageBounds;
88
	Rectangle imageBounds;
89
	TreeItem insertItem;
89
	TreeItem insertItem;
90
	boolean insertBefore;
90
	boolean insertBefore;
Lines 1892-1899 Link Here
1892
}
1892
}
1893
1893
1894
void mouseDown (int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) {
1894
void mouseDown (int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) {
1895
	NSOutlineView widget = (NSOutlineView)view;
1896
	NSEvent nsEvent = new NSEvent(theEvent);
1895
	if (headerView != null && id == headerView.id) {
1897
	if (headerView != null && id == headerView.id) {
1896
		NSTableView widget = (NSTableView)view;
1897
		widget.setAllowsColumnReordering(false);
1898
		widget.setAllowsColumnReordering(false);
1898
		NSPoint pt = headerView.convertPoint_fromView_(new NSEvent(theEvent).locationInWindow(), null);
1899
		NSPoint pt = headerView.convertPoint_fromView_(new NSEvent(theEvent).locationInWindow(), null);
1899
		int /*long*/ nsIndex = headerView.columnAtPoint(pt);
1900
		int /*long*/ nsIndex = headerView.columnAtPoint(pt);
Lines 1911-1920 Link Here
1911
		// Bug/feature in Cocoa:  If the tree has a context menu we just set it visible instead of returning
1912
		// Bug/feature in Cocoa:  If the tree has a context menu we just set it visible instead of returning
1912
		// it from menuForEvent:.  This has the side effect, however, of sending control-click to the NSTableView,
1913
		// it from menuForEvent:.  This has the side effect, however, of sending control-click to the NSTableView,
1913
		// which is interpreted as a single click that clears the selection.  Fix is to ignore control-click,
1914
		// which is interpreted as a single click that clears the selection.  Fix is to ignore control-click,
1914
		NSEvent event = new NSEvent(theEvent);
1915
		if ((nsEvent.modifierFlags() & OS.NSControlKeyMask) != 0) return;
1915
		if ((event.modifierFlags() & OS.NSControlKeyMask) != 0) return;
1916
	}
1916
	}
1917
	wasSelected = false;
1917
	super.mouseDown(id, sel, theEvent);
1918
	super.mouseDown(id, sel, theEvent);
1919
	if (!wasSelected) {
1920
		NSPoint pt = view.convertPoint_fromView_(nsEvent.locationInWindow(), null);
1921
		int /*long*/ row = widget.rowAtPoint(pt);
1922
		if (row != -1 && widget.isRowSelected(row)) {
1923
			NSRect rect = widget.frameOfOutlineCellAtRow(row);
1924
			if (!OS.NSPointInRect(pt, rect)) {
1925
				id itemID = widget.itemAtRow(row);
1926
				Widget item = display.getWidget (itemID.id);
1927
				if (item != null && item instanceof TreeItem) {
1928
					Event event = new Event ();
1929
					event.item = item;
1930
					postEvent (SWT.Selection, event);
1931
				}
1932
			}
1933
		}
1934
	}
1935
	wasSelected = false;
1918
}
1936
}
1919
1937
1920
/*
1938
/*
Lines 2085-2090 Link Here
2085
}
2103
}
2086
2104
2087
void outlineViewSelectionDidChange (int /*long*/ id, int /*long*/ sel, int /*long*/ notification) {
2105
void outlineViewSelectionDidChange (int /*long*/ id, int /*long*/ sel, int /*long*/ notification) {
2106
	wasSelected = true;
2088
	if (ignoreSelect) return;
2107
	if (ignoreSelect) return;
2089
	NSOutlineView widget = (NSOutlineView) view;
2108
	NSOutlineView widget = (NSOutlineView) view;
2090
	int row = (int)/*64*/widget.selectedRow ();
2109
	int row = (int)/*64*/widget.selectedRow ();
(-)Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java (-4 / +18 lines)
Lines 76-82 Link Here
76
	NSTextFieldCell dataCell;
76
	NSTextFieldCell dataCell;
77
	NSButtonCell buttonCell;
77
	NSButtonCell buttonCell;
78
	int columnCount, itemCount, lastIndexOf, sortDirection;
78
	int columnCount, itemCount, lastIndexOf, sortDirection;
79
	boolean ignoreSelect, fixScrollWidth, drawExpansion;
79
	boolean ignoreSelect, fixScrollWidth, drawExpansion, wasSelected;
80
	Rectangle imageBounds;
80
	Rectangle imageBounds;
81
81
82
	static int NEXT_ID;
82
	static int NEXT_ID;
Lines 1863-1870 Link Here
1863
}
1863
}
1864
1864
1865
void mouseDown (int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) {
1865
void mouseDown (int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) {
1866
	NSTableView widget = (NSTableView)view;
1867
	NSEvent nsEvent = new NSEvent(theEvent);
1866
	if (headerView != null && id == headerView.id) {
1868
	if (headerView != null && id == headerView.id) {
1867
		NSTableView widget = (NSTableView)view;
1868
		widget.setAllowsColumnReordering(false);
1869
		widget.setAllowsColumnReordering(false);
1869
		NSPoint pt = headerView.convertPoint_fromView_(new NSEvent(theEvent).locationInWindow(), null);
1870
		NSPoint pt = headerView.convertPoint_fromView_(new NSEvent(theEvent).locationInWindow(), null);
1870
		int /*long*/ nsIndex = headerView.columnAtPoint(pt);
1871
		int /*long*/ nsIndex = headerView.columnAtPoint(pt);
Lines 1883-1892 Link Here
1883
		// it from menuForEvent:.  This has the side effect, however, of sending control-click to the NSTableView,
1884
		// it from menuForEvent:.  This has the side effect, however, of sending control-click to the NSTableView,
1884
		// which is interpreted as a single click that clears the selection.  Fix is to ignore control-click if the 
1885
		// which is interpreted as a single click that clears the selection.  Fix is to ignore control-click if the 
1885
		// view has a context menu.
1886
		// view has a context menu.
1886
		NSEvent event = new NSEvent(theEvent);
1887
		if ((nsEvent.modifierFlags() & OS.NSControlKeyMask) != 0) return;
1887
		if ((event.modifierFlags() & OS.NSControlKeyMask) != 0) return;
1888
	}
1888
	}
1889
	wasSelected = false;
1889
	super.mouseDown(id, sel, theEvent);
1890
	super.mouseDown(id, sel, theEvent);
1891
	if (!wasSelected) {
1892
		NSPoint pt = view.convertPoint_fromView_(nsEvent.locationInWindow(), null);
1893
		int /*long*/ row = widget.rowAtPoint(pt);
1894
		if (row != -1 && widget.isRowSelected(row)) {
1895
			if (0 < row && row <= itemCount) {
1896
				Event event = new Event ();
1897
				event.item = _getItem ((int)/*64*/row);
1898
				postEvent (SWT.Selection, event);
1899
			}
1900
		}
1901
	}
1902
	wasSelected = false;
1890
}
1903
}
1891
1904
1892
/*
1905
/*
Lines 3013-3018 Link Here
3013
}
3026
}
3014
3027
3015
void tableViewSelectionDidChange (int /*long*/ id, int /*long*/ sel, int /*long*/ aNotification) {
3028
void tableViewSelectionDidChange (int /*long*/ id, int /*long*/ sel, int /*long*/ aNotification) {
3029
	wasSelected = true;
3016
	if (ignoreSelect) return;
3030
	if (ignoreSelect) return;
3017
	NSTableView widget = (NSTableView) view;
3031
	NSTableView widget = (NSTableView) view;
3018
	int row = (int)/*64*/widget.selectedRow ();
3032
	int row = (int)/*64*/widget.selectedRow ();

Return to bug 279103