Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » treeviewer columns disposal(dispose columns then setContentProvider causes exception label 0 has no label provider)
icon9.gif  treeviewer columns disposal [message #1023620] Sun, 24 March 2013 19:05 Go to next message
Mokhtar Abdu is currently offline Mokhtar Abdu
Messages: 104
Registered: November 2011
Senior Member
Edit: i commented all except dispose method and discovered that the first tree column was not disposed !!!!!!!!!!!!!!!!!!!!!!!!! is this the reason?
Hi,
When I dispose and then create my treeviewer columns DYNAMICALLY, then set contentProvider of the treeviewer, I get exception "colmun X has no label..."
method:
public  void updateTree(ArrayList<ResultsVersion> selectedVersions) {
		disposeTreeColumns();
		createTreeColumns();
		trVrCandidates.setContentProvider(new CandidatesContentProvider());
		trVrCandidates.setLabelProvider(new CandidatesLabelProvider());	
		trVrCandidates.setInput(selectedVersions);
		}
		
	}

First call of updateTree() works fine but secend not. As if the disposal of columns is not yet finished. (If i dispose the treeviewer itself and create it, this problem disappears but this is a bad solution for me)

Here are the disposal and creation methods:
private void disposeTreeColumns() {
		TreeColumn[] clmns =  trVrCandidates.getTree().getColumns();
		for (TreeColumn clm : clmns) {
			 clm.dispose();
		}
	}

Here the param model is what determine how many columns i need to create.
private void createTreeColumns(ArrayList<ResultsVersion> model) {
for (ResultsVersion rv : model) {
  TreeViewerColumn treeViewerColumn = new TreeViewerColumn(trVrCandidates, SWT.NONE); 
TreeColumn trclmnNewColumn = treeViewerColumn.getColumn();
trclmnNewColumn.setWidth(120);
trclmnNewColumn.setText(rv.getTimeTag());
}
}

please Help me Confused I am dying because of this.
Thanks
Mok

[Updated on: Sun, 24 March 2013 19:16]

Report message to a moderator

Re: treeviewer columns disposal [message #1023640 is a reply to message #1023620] Sun, 24 March 2013 20:22 Go to previous message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5422
Registered: July 2009
Senior Member
a) why do you set a content provider all time?
b) why not setting the label-provider before the content-provider

Tom

On 24.03.13 15:05, Mokhtar Abdu wrote:
> Hi,
> When I dispose and then create my treeviewer columns DYNAMICALLY, then
> set contentProvider of the treeviewer, I get exception "colmun X has no
> label..."
> method:
>
> public void updateTree(ArrayList<ResultsVersion> selectedVersions) {
> disposeTreeColumns();
> createTreeColumns();
> trVrCandidates.setContentProvider(new
> CandidatesContentProvider());
> trVrCandidates.setLabelProvider(new CandidatesLabelProvider());
> trVrCandidates.setInput(selectedVersions);
> }
>
> }
>
> First call of updateTree() works fine but secend not. As if the disposal
> of columns is not yet finished. (If i dispose the treeviewer itself and
> create it, this problem disappears but this is a bad solution for me)
>
> Here are the disposal and creation methods:
>
> private void disposeTreeColumns() {
> TreeColumn[] clmns = trVrCandidates.getTree().getColumns();
> for (TreeColumn clm : clmns) {
> clm.dispose();
> }
> }
>
> Here the param model is what determine how many columns i need to create.
>
> private void createTreeColumns(ArrayList<ResultsVersion> model) {
> for (ResultsVersion rv : model) {
> TreeViewerColumn treeViewerColumn = new
> TreeViewerColumn(trVrCandidates, SWT.NONE); TreeColumn trclmnNewColumn =
> treeViewerColumn.getColumn();
> trclmnNewColumn.setWidth(120);
> trclmnNewColumn.setText(rv.getTimeTag());
> }
> }
>
> please Help me :? I am dying because of this.
> Thanks
> Mok
Previous Topic:drag and drop change icon
Next Topic:CoolBar on Windows does not works in Eclipse
Goto Forum:
  


Current Time: Fri Oct 24 11:27:09 GMT 2014

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

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