Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » Grid - using the Selection Service
Grid - using the Selection Service [message #500894] Mon, 30 November 2009 08:05 Go to next message
Michael Lindner is currently offline Michael LindnerFriend
Messages: 10
Registered: November 2009
Junior Member
Hello,

I'm new to Nebula and RCP and my problem is that I don't know how to use the Grid with the RCP Selection Service.
In my RCP Application i have a view with a grid - but how can i get the current selection of the grid so i can use it in my command handlers?
Re: Grid - using the Selection Service [message #500946 is a reply to message #500894] Mon, 30 November 2009 12:15 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5487
Registered: July 2009
Senior Member
You need to use a GridViewer and register it in the selection service.

Tom

Michael Lindner schrieb:
> Hello,
>
> I'm new to Nebula and RCP and my problem is that I don't know how to use
> the Grid with the RCP Selection Service.
> In my RCP Application i have a view with a grid - but how can i get the
> current selection of the grid so i can use it in my command handlers?
Re: Grid - using the Selection Service [message #500993 is a reply to message #500894] Mon, 30 November 2009 15:48 Go to previous messageGo to next message
Michael Lindner is currently offline Michael LindnerFriend
Messages: 10
Registered: November 2009
Junior Member
Ok I tried to use a GridTreeViewer and my view looks like this:

viewer = new GridTreeViewer(parent, SWT.MULTI | SWT.H_SCROLL
				| SWT.V_SCROLL);
		GridColumn column = new GridColumn(viewer,SWT.NONE);
		column.setWidth(200);
		column.setText("foo");
		column.setTree(true);
		GridColumn column2 = new GridColumn(viewer,SWT.None);
		column2.setWidth(200);
		column2.setText("bar");

		viewer.setContentProvider(new MyContentProvider());
		viewer.getGrid().setHeaderVisible(true);


Now I add GridItems to the viewer
GridItem item1 = new GridItem(viewer.getGrid(),SWT.NONE);
GridItem item2 = new GridItem(item1,SWT.NONE);


When I run the application the Rootelement(item1) is displayed with a plus, but when I klick on the plus nothing happens...
Re: Grid - using the Selection Service [message #501098 is a reply to message #500993] Tue, 01 December 2009 01:59 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5487
Registered: July 2009
Senior Member
Whenever using a viewer you should not interface with the underlying
control but using LabelProvider and ContentProviders.

You need to get familiar with JFace concepts.

Tom

Michael Lindner schrieb:
> Ok I tried to use a GridTreeViewer and my view looks like this:
>
> viewer = new GridTreeViewer(parent, SWT.MULTI | SWT.H_SCROLL
> | SWT.V_SCROLL);
> GridColumn column = new GridColumn(viewer,SWT.NONE);
> column.setWidth(200);
> column.setText("foo");
> column.setTree(true);
> GridColumn column2 = new GridColumn(viewer,SWT.None);
> column2.setWidth(200);
> column2.setText("bar");
>
> viewer.setContentProvider(new MyContentProvider());
> viewer.getGrid().setHeaderVisible(true);
>
> Now I add GridItems to the viewer
>
> GridItem item1 = new GridItem(viewer.getGrid(),SWT.NONE);
> GridItem item2 = new GridItem(item1,SWT.NONE);
>
>
> When I run the application the Rootelement(item1) is displayed with a
> plus, but when I klick on the plus nothing happens...
Re: Grid - using the Selection Service [message #501208 is a reply to message #500894] Tue, 01 December 2009 14:31 Go to previous message
Michael Lindner is currently offline Michael LindnerFriend
Messages: 10
Registered: November 2009
Junior Member
Thank you for your help

I think I understand the concepts of the JFace viewer so far, but I don't want to create my own DomainObjects but instead use the standard GridItems.
Or are they not supported by the GridTreeViewer?
It is clear now that I have to use the setInput() Method instead of interfacing with the underlying control.

Michael
Re: Grid - using the Selection Service [message #598725 is a reply to message #500993] Tue, 01 December 2009 01:59 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5487
Registered: July 2009
Senior Member
Whenever using a viewer you should not interface with the underlying
control but using LabelProvider and ContentProviders.

You need to get familiar with JFace concepts.

Tom

Michael Lindner schrieb:
> Ok I tried to use a GridTreeViewer and my view looks like this:
>
> viewer = new GridTreeViewer(parent, SWT.MULTI | SWT.H_SCROLL
> | SWT.V_SCROLL);
> GridColumn column = new GridColumn(viewer,SWT.NONE);
> column.setWidth(200);
> column.setText("foo");
> column.setTree(true);
> GridColumn column2 = new GridColumn(viewer,SWT.None);
> column2.setWidth(200);
> column2.setText("bar");
>
> viewer.setContentProvider(new MyContentProvider());
> viewer.getGrid().setHeaderVisible(true);
>
> Now I add GridItems to the viewer
>
> GridItem item1 = new GridItem(viewer.getGrid(),SWT.NONE);
> GridItem item2 = new GridItem(item1,SWT.NONE);
>
>
> When I run the application the Rootelement(item1) is displayed with a
> plus, but when I klick on the plus nothing happens...
Previous Topic:Listener for resize and moving of columns in grid view
Next Topic:Grid - using the Selection Service
Goto Forum:
  


Current Time: Sun Dec 21 15:55:27 GMT 2014

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

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