Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Using CommonViewer in dialogs
Using CommonViewer in dialogs [message #331215] Thu, 28 August 2008 13:18 Go to next message
Eclipse UserFriend
Hello.

I want to know if it is possible to use CommonViewer (which is used in
CommonNavigator) as a part of a dialog? To create a view I can use
extension points on "org.eclipse.ui.navigator.viewer", but how can I use
the same functionality in my dialog windows?

Is there a sample for this case?

Thanks.
Re: Using CommonViewer in dialogs [message #331243 is a reply to message #331215] Thu, 28 August 2008 15:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mario.winterer.gmx.net

I think this could work if you instatiate a CommonViewer with a unique
viewer id. This viewer id can be used in the
"org.eclipse.ui.navigator.viewer" extension point to bind some viewer
content to your viewer.

CommonViewer viewer = new CommonViewer("my.unique.viewer.id", parent,
SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
viewer.setSorter(new CommonViewerSorter());
viewer.setInput(myInput);


But I think for a full featured viewer, similar to the common navigator,
you have to do some additional configuration of the viewer. Have a look
how it is done in CommonNavigator.createPartControl(...).


Mario


Mikhail Kadan schrieb:

> Hello.
>
> I want to know if it is possible to use CommonViewer (which is used in
> CommonNavigator) as a part of a dialog? To create a view I can use
> extension points on "org.eclipse.ui.navigator.viewer", but how can I use
> the same functionality in my dialog windows?
>
> Is there a sample for this case?
>
> Thanks.
>
Re: Using CommonViewer in dialogs [message #331268 is a reply to message #331215] Thu, 28 August 2008 17:18 Go to previous message
Eclipse UserFriend
Originally posted by: x_raajes.ugs.com

A while back, I had investigated this and posted in one of the posts here
(see the posts after the article):
http://rcpquickstart.com/2007/04/25/common-navigator-tutoria l-1-hello-world/

Here is the content from that post:

1) Create your dialog - whichever way it is instantiated. In my case, I used
the menus/commands/handlers mechanism in 3.3 to create a menu entry in the
view's local pull down menu, and then added a handler for it, which creates
the dialog. My dialog just extends from the JFace Dialog class.

2) In the createDialogArea( Composite parent ) method, instantiate the
CommonViewer with a specific ID, as below:

CommonViewer commonViewer = new CommonViewer( ID, composite, SWT.BORDER );

(where ID is some string like "com.rbk.xyz")

3) Next, add the lines below, before returning the "parent" composite in
this createDialogArea() method:

INavigatorContentService contentService =
NavigatorContentServiceFactory.INSTANCE
..createContentService(ID, commonViewer);

contentService.createCommonContentProvider();
contentService.createCommonLabelProvider();

commonViewer.setInput( new NavigatorRoot() );

(where NavigatorRoot is an object similar to the one described in the
tutorial on this page).

4) Now, in the extension points (plugin.xml), add a "viewer" extension
specifying the common viewer ID used in the code above, similar to what is
done for the view in this tutorial.

5) Add a "viewerContentBinding" element, just as it is done for the view in
this tutorial, but use the common viewer ID that is used in this code
instead. The only difference is that the ID of the common viewer used in the
code here will become the viewer ID in the content binding.

6) That's it. The viewer should show up in the dialog. It binds to the
extension points for the content and label providers through the navigator
content service.





"Mikhail Kadan" <mkadan@gmail.com> wrote in message
news:8a208794b217189bc1308924e5c09d86$1@www.eclipse.org...
> Hello.
>
> I want to know if it is possible to use CommonViewer (which is used in
> CommonNavigator) as a part of a dialog? To create a view I can use
> extension points on "org.eclipse.ui.navigator.viewer", but how can I use
> the same functionality in my dialog windows?
>
> Is there a sample for this case?
>
> Thanks.
>
Previous Topic:InfoCenter Exception
Next Topic:Loading ready event
Goto Forum:
  


Current Time: Sat Feb 08 07:36:09 GMT 2025

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

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

Back to the top