Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to access a view from another view?
How to access a view from another view? [message #467149] Sun, 29 April 2007 06:02 Go to next message
Eclipse UserFriend
Originally posted by: moutaz.ahmed.gmail.com

hii

i want to set the action of a listViewer in a certain view to Reflects something in another view (as the propertyView for example).
Re: How to access a view from another view? [message #467164 is a reply to message #467149] Mon, 30 April 2007 03:17 Go to previous messageGo to next message
Eclipse UserFriend
By using WorkbechWindow's SelectionService u can acces view's selection from another View.

Step1: First u have to set the ListViewer as ViewSite's Selection Provider.
eg: getSite.setSelectionProvider(ListViewer);

step2: In the view, in which the selection of ListViewer to be reflected, u have to write one listener (ISelectionListener)..
eg: private ISelectionListener selectionListener = new ISelectionListener() {
public void selectionChanged(IWorkbenchPart sourcepart, ISelection selection){
if (sourcepart instanceof SOURCEVIEW){
if (selection instanceof IStructuredSelection){
IStructuredSelection ss = (IStructuredSelection) selection;
...
...
Re: How to access a view from another view? [message #467170 is a reply to message #467149] Mon, 30 April 2007 04:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: moutaz.ahmed.gmail.com

thank you for ur great help

Another case:

if i want to listen to doubleClick not for a selection (Singleclick) like that:

if i doubleClick at an item in ListViewer (in acertain view),
then an action must happen at another View.
Re: How to access a view from another view? [message #467172 is a reply to message #467170] Mon, 30 April 2007 05:39 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

I'd solve this using the Command-Handler-Service:

1. Register Command in plugin.xml
2. View 2 adds his self as a listener to the command
3. View 1 listens for DD and executes the command

There's been a resent thread where I posted a lot of code you can use to
make this happen for you. The name of the thread was "Design-Question
regarding Actions and th UI".

Tom

Moutaz schrieb:
> thank you for ur great help
>
> Another case:
>
> if i want to listen to doubleClick not for a selection (Singleclick) like that:
>
> if i doubleClick at an item in ListViewer (in acertain view),
> then an action must happen at another View.
Re: How to access a view from another view? [message #467211 is a reply to message #467172] Tue, 01 May 2007 01:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: moutaz.ahmed.gmail.com

Thank u so much for ur great help.
i will read it now, and it seems to be great.
i think that it will solve many questions

thanks again
Re: How to access a view from another view? [message #467283 is a reply to message #467211] Wed, 02 May 2007 08:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: moutaz.ahmed.gmail.com

thx Tom for ur freat help

but i have an error in these two packages:

import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;

i can't get them, can u help me where i can download this jars ?
Re: How to access a view from another view? [message #467290 is a reply to message #467283] Wed, 02 May 2007 09:24 Go to previous messageGo to next message
Eclipse UserFriend
this is Eclipse 3.3 code you need to get the last M-build or wait 'til
next week when m7 is out.

Tom

Moutaz schrieb:
> thx Tom for ur freat help
>
> but i have an error in these two packages:
>
> import org.eclipse.equinox.app.IApplication;
> import org.eclipse.equinox.app.IApplicationContext;
>
> i can't get them, can u help me where i can download this jars ?
Re: How to access a view from another view? [message #467297 is a reply to message #467283] Wed, 02 May 2007 09:48 Go to previous messageGo to next message
Eclipse UserFriend
Those are in Eclipse 3.3M6, but not in Eclipse 3.2. What version are you developing against?

Alex.
Re: How to access a view from another view? [message #467320 is a reply to message #467297] Thu, 03 May 2007 01:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: moutaz.ahmed.gmail.com

i am developing with eclipse 3.2.1


so the solution is to develope with eclipse 3.3
Re: How to access a view from another view? [message #467333 is a reply to message #467320] Thu, 03 May 2007 05:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: moutaz.ahmed.gmail.com

hii

i faces some problems in downloading Eclipse 3.3 , so is there is any option.

as i want to when an action happened in a certain view, another view will refresh its contents and draw again ?
Re: How to access a view from another view? [message #467341 is a reply to message #467333] Thu, 03 May 2007 06:35 Go to previous message
Eclipse UserFriend
Refreshing a view works in 3.2; you just can't rely on those packages and IApplication class. But you can have a PlatformRunnable and launch with -application; you just use the older code.

In short; I don't know where you got the IApplication idea from, but that's for 3.3 only. Get rid of that, and use the PlatformRunnable as described in the Eclipse 3.2 help, and you'll be sorted.

Alex.
Previous Topic:Cheat sheet menu item "not currently available"
Next Topic:communicating to a hidden view
Goto Forum:
  


Current Time: Fri May 16 02:05:52 EDT 2025

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

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

Back to the top