Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » how to show a new selection in ComboViewer?
how to show a new selection in ComboViewer? [message #444859] Thu, 21 October 2004 15:00
Eclipse UserFriend
Originally posted by: rbuchli.web.de

Hi
I defined the following ComboViewer:

ortComboViewer = new ComboViewer(standortGroup, SWT.READ_ONLY);
ortComboViewer.setUseHashlookup(true);
ortComboViewer.setSorter(new PlaceSorter());
ortComboViewer.setLabelProvider(new PlaceLabelProvider());
ortComboViewer.setContentProvider(new PlaceContentProvider());
ortComboViewer.addSelectionChangedListener(new ISelectionChangedListener()
{
public void selectionChanged(SelectionChangedEvent event)
{
IStructuredSelection selection =
(IStructuredSelection) event.getSelection();
Place place = (Place)selection.getFirstElement();
// store selected Place in Asset if not set already
if (place != null && asset.getIntFK1OrtID() != place.getPlaceID()) {
asset.setIntFK1OrtID(place.getPlaceID());
asset.setDirtyFlag(true);
MainGUI.getSave_action().setEnabled(true);

// change the input of builing combo viewer
gebaeudeComboViewer.setInput(place);
}
}
});
ortCombo = ortComboViewer.getCombo();
ortCombo.setVisibleItemCount(10);
ortComboViewer.setInput(new PlaceModel(true));
ortCombo.setToolTipText("Standort");

This code shows me the stored places in my datamodel. But when I want to
show an asset that has set a place I use the following code:

PlaceModel placeModel = (PlaceModel)ortComboViewer.getInput();
// fills place with a stored value
Place place = placeModel.getElement(asset.getIntFK1OrtID());
// place now is an element of the input of the viewer.
ortComboViewer.setSelection(new StructuredSelection(place), true);
ortComboViewer.refresh(true);

Problem:
This does not show any place in the ortComboViewer.
Does anyone have an idee what I'm doing wrong?

Thanks.
Previous Topic:Finalize my application
Next Topic:How To Change JSP Editor Colors
Goto Forum:
  


Current Time: Tue Oct 27 16:41:07 GMT 2020

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

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

Back to the top