Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » How to trigger ICellModifier 's modify()?
How to trigger ICellModifier 's modify()? [message #1403801] Sun, 27 July 2014 19:00
yev xxxxx is currently offline yev xxxxxFriend
Messages: 17
Registered: July 2014
Junior Member
I have a TableViewer where one of the columns is a DialogCellEditor.
A provider is bounded to the treeviewer.

Whenever user changes a value in the table (dialogcelleditor) I want modify() method to be invoke in order to update the model.

The problem, modify() method is being invoked only once, even if I try to update value of other rows.


Full code is complex, some snippets if more needed please tell.

MyProvider is a provider bounded to a Table.

MyCellEditor extends DialogCellEditor{
 
 protected Object openDialogBox(Control cellEditorWindow) {
    editor = ...;
    if (editor.open() == Dialog.OK){	
      this.updateContents(myVal);
      this.doSetValue(myVal);
      this.focusLost(); // I need this to remove the focus from editor, and invoke modify() of ICellModifier
    }	
 }	
}
public MyProvider  IStructuredContentProvider,ITableLabelProvider,IContentProvider,ICellModifier {
  public void modify(Object element, String property, Object value) {
  }
}


Update:
I tried to debug jface code and started with stack trace when modify() method was triggered:


	MyProvider.modify(Object, String, Object)
	ColumnViewer$2.setValue(Object, Object)
	ColumnViewer$2(EditingSupport).saveCellEditorValue(CellEditor, ViewerCell)
	TableViewerEditor(ColumnViewerEditor).saveEditorValue(CellEditor) 
	TableViewerEditor(ColumnViewerEditor).applyEditorValue()
	ColumnViewerEditor$2.applyEditorValue()
	CellEditor$1.run()
	SafeRunner.run(ISafeRunnable) 
	JFaceUtil$1.run(ISafeRunnable)
	SafeRunnable.run(ISafeRunnable) 
	MyCellEditor(CellEditor).fireApplyEditorValue() line: 333	
	MyCellEditor(CellEditor).focusLost() 
	


On the next time when I updated the value modify() method wasn't triggered, the issue is with CellEditor.focusLost(): (jface code)

 protected void focusLost() {
		if (isActivated()) {  <= isActivated() is always false, even if I try to call this.activate
			fireApplyEditorValue();
			deactivate();
		}
	}

and this is the code of isActivated(): (jface code)
public boolean isActivated() {
	// Use the state of the visible style bit (getVisible()) rather than the
	// window's actual visibility (isVisible()) to get correct handling when
	// an ancestor control goes invisible, see bug 85331.
	return control != null && control.getVisible();
	}



[Updated on: Tue, 29 July 2014 13:19]

Report message to a moderator

Previous Topic:Is there any way to get SourceViewer by a known StyledText?
Next Topic:Filter ComboBox content prior to its expansion
Goto Forum:
  


Current Time: Tue Sep 18 13:52:15 GMT 2018

Powered by FUDForum. Page generated in 0.01233 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top