Bug 168709 [Viewers] Request to open up ViewerColumn#setEditingSupport
setEditingSupport is now marked final. I would like to override this method to handle a very specific situation. The Grid can contain a checkbox in any column as opposed to Table which can only contain a checkbox in the first column. The new viewer API allows us to easily populate these checkboxes, but there is currently nothing that propogates any changes from the widget back to the model - i.e. if someone checks a checkbox the model currently doesn't get updated because this happens without an editor. So I designed a new CheckEditingSupport class. This is essentially a marker interface that lets me know that the user has set this as a check cell. The only method used from CheckEditingSupport is setValue. Here is my setEditingSupport implementation for reference: public void setEditingSupport(EditingSupport editingSupport) { if (editingSupport instanceof CheckEditingSupport) { if (checkEditingSupport == null) { final int colIndex = getColumn().getParent().indexOf(getColumn()); getColumn().getParent().addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { if (event.detail == SWT.CHECK && event.index == colIndex) { GridItem item = (GridItem)event.item; Object element = viewer.getElementAt(viewer.getGrid().indexOf(item)); checkEditingSupport.setValue(element, new Boolean(item.getChecked(colIndex))); } } }); } checkEditingSupport = (CheckEditingSupport)editingSupport; } else { super.setEditingSupport(editingSupport); } }
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ViewerColumn.java
* @param registerListener
	 */
	void setLabelProvider(CellLabelProvider labelProvider,
			boolean registerListener) {
		if (listenerRegistered && this.labelProvider != null) {
			this.labelProvider.removeListener(listener);
			listenerRegistered = false;
		}
		this.labelProvider = labelProvider;
		if (registerListener) {
			this.labelProvider.addListener(listener);
			listenerRegistered = true;
		}
	}
	/**
	 * Return the editing support for the reciever.
	 * 
	 * @return {@link EditingSupport}
	 */
	EditingSupport getEditingSupport() {
		return editingSupport;
	}
	/**
	 * Set the editing support.
	 * 
	 * @param editingSupport
	 *            The {@link EditingSupport} to set.
	 */
	public final void setEditingSupport(EditingSupport editingSupport) {
		this.editingSupport = editingSupport;