Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » TableViewer.setInput does not update the table
TableViewer.setInput does not update the table [message #1709459] Mon, 28 September 2015 14:52 Go to next message
Xavipen Mising name is currently offline Xavipen Mising nameFriend
Messages: 57
Registered: March 2011
Member
Hi,

I have created a Composite that has a table. The controls are created in the constructor along with the providers. see snipped below for the provider initialization.

		ObservableSetContentProvider cp = new ObservableSetContentProvider(){
			public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
				System.out.println("Input change");
				try{
					super.inputChanged(viewer, oldInput, newInput);
				}catch ( Throwable e){
					System.out.println("Tricks");
				}
			}
			public Object[] getElements(Object inputElement) {
				System.out.println("Calling elements");
				return super.getElements(inputElement);
			}
			
		};
		
		//Set normal CellLabelProvider.
		tableViewerColumnSpacecraftId.setLabelProvider(new ObservableMapCellLabelProvider(
				BeanProperties.value(GVCID.FIELD_SPACECRAFT_ID).observeDetail(cp.getKnownElements())
				));

		tableViewerColumnFrameVersion.setLabelProvider(new ObservableMapCellLabelProvider(
				BeanProperties.value(GVCID.FIELD_FRAME_VERSION).observeDetail(cp.getKnownElements())
				));

		tableViewerColumnVcId.setLabelProvider(new ObservableMapCellLabelProvider(
				BeanProperties.value(GVCID.FIELD_VIRTUAL_CHANNEL).observeDetail(cp.getKnownElements())
				));

		tableViewer.setContentProvider(cp);



Later the customize composite has an "input" method to pass the object that has to be represented. When that input is pass the databindings are created and the TableViewer input is set. See related code below:

		IObservableSet observableSet = eclipseObservablesManager.createEclipseObservableSet(this.getDisplay(), serviceConfig.getPermittedGVCIDs(), GVCID.class);
		log.error("observable set size: " + observableSet.size());
		tableViewer.setInput(observableSet);



When i run the application, the table appears empty. however the permittedGVCIDs() set is not empty. If i add or remove items (GVCID) the table show them.

If I close and reopen the part with the composite the table appears empty again.

I am trying to figure out what´s going on but i am running out of ideas.

It seems that the getElements() method of the ObservableSetContentProvider is not called as i do not see the the text I added. I am trying to figureout why the getElements would not be called.

I also do not see any exception thrown. Could it be that an exception is thrown and i am not catching/seeing it?

Any hint would be appreciated.
Re: TableViewer.setInput does not update the table [message #1709593 is a reply to message #1709459] Tue, 29 September 2015 13:06 Go to previous message
Xavipen Mising name is currently offline Xavipen Mising nameFriend
Messages: 57
Registered: March 2011
Member
I have found where the issue was.

I am actually implementing my own ObservableSet that bridges an independant ObservableSet implementation. A wrapper for this independant implementation was extending the AbstractObservableSet class from eclipse and doing the bridge from one type of change notification to the Eclipse fireChange mechanism.

To solve the issue i had to extend the Eclipse class ObservableSet then everything works.

What i do not understand is what is the difference between the two eclipse classes:
- AbstractObservableSet
- ObservableSet

I would had imaging that it should work regardless with one i extend. I can not see any apparent difference between them. Although most likely i must have missed something as the same code works when I extend one (ObservableSet) and not with the other (AbstractObservableSet).

Cheers,
Previous Topic:[Databinding] Relation to ReactiveX?
Next Topic:selectionChanged event not triggered after opening EditPart from TreeView
Goto Forum:
  


Current Time: Thu Sep 20 18:01:47 GMT 2018

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

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

Back to the top