Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Editable columns of tree viewer(How to make columns of tree viewer editable)
Editable columns of tree viewer [message #538631] Tue, 08 June 2010 05:14 Go to next message
vrush Mising name
Messages: 51
Registered: July 2009
Location: Pune
Member
Hi,

I have tree viewer with two columns as property and value. I need to make 2nd column editable. Tried setting column editors and column properties as follows but not able to edit any column.

Code snippet :

viewer = new TreeViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
viewer.setColumnProperties(new String[] {"Property","Value"});

viewer.setCellEditors(new CellEditor[]{new TextCellEditor(viewer.getTree()), new TextCellEditor(viewer.getTree())});

viewer.setCellModifier(new ICellModifier() {
@Override
public void modify(Object element, String property, Object value) {
System.out.println("propertyName\t" + property);
}
@Override
public Object getValue(Object element, String property) {

return null;
}
@Override
public boolean canModify(Object element, String property) {
/*
return true;
}
});
viewer.setContentProvider(new ViewContentProvider());
viewer.setLabelProvider(new ViewLabelProvider());
viewer.setSorter(new NameSorter());



Please suggest if missing anything. Stuck.
Any help would be grateful.

Thanks,
Vrushali.
Re: Editable columns of tree viewer [message #538657 is a reply to message #538631] Tue, 08 June 2010 07:05 Go to previous messageGo to next message
Vijay Raj
Messages: 608
Registered: July 2009
Senior Member
public Object getValue(Object element, String property) {

return null;
}

should not return a null value


---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
Re: Editable columns of tree viewer [message #538909 is a reply to message #538631] Wed, 09 June 2010 00:39 Go to previous messageGo to next message
vrush Mising name
Messages: 51
Registered: July 2009
Location: Pune
Member

Hi,

Thanks for your reply. I tried returning some random string from the function getValue() but still it does not seem to be working. I'm not even getting editable text.
I'm referring to snippet
http://bingjava.appspot.com/snippet.jsp?id=2206

I need the same functionality in treeviewer with columns.

Can you/anyone please look through and suggest missings?

Thanks again in advance,
Vrushali.
Re: Editable columns of tree viewer [message #538999 is a reply to message #538631] Wed, 09 June 2010 06:04 Go to previous message
vrush Mising name
Messages: 51
Registered: July 2009
Location: Pune
Member

Thanks for rightly pointing out mistake. Its working now.

Thanks a lot,
Vrushali.
Previous Topic:How to get OS X standard menubar behavior?
Next Topic:ExpandBar not expanded properly
Goto Forum:
  


Current Time: Mon Jul 28 18:47:40 EDT 2014

Powered by FUDForum. Page generated in 0.02295 seconds