Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » 3 Views 1 Model
3 Views 1 Model [message #290758] Wed, 31 August 2005 14:29 Go to next message
Eclipse UserFriend
Originally posted by: kessi.beer.com

Hi there,

i am writing a plugin which displays three views.

The Eclipse Views should all be connected to the same model and show
different "views" onto that model (for example a Graph and Tree View of
that model).

IŽve implemented such a thing before in pure Java Swing but donŽt know how
to get this working within Views (extended from Viewpart) within an
Eclipse plugin. I donŽt know how to connect Viewpart-Views onto a model.

Could you give me a short description on how to do this?
Or point me towards some infos?

IŽve looked for ages but have found nothing.

Greetings
Andreas
Re: 3 Views 1 Model [message #290760 is a reply to message #290758] Wed, 31 August 2005 14:39 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Andreas wrote:
> Hi there,
>
> i am writing a plugin which displays three views.
>
> The Eclipse Views should all be connected to the same model and show
> different "views" onto that model (for example a Graph and Tree View of
> that model).

Check out the MVC patterns in org.eclipse.jface and
org.eclipse.jface.text ... they have a couple of Model classes, like
AbstractConcurrentModel. They have pre-packaged widgets like TreeViewer
and TextViewer which can be embedded in a Workbench IViewPart.

Later,
PW


Re: 3 Views 1 Model [message #290766 is a reply to message #290760] Wed, 31 August 2005 16:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

See the article:

http://www.eclipse.org/articles/viewArticle/ViewArticle2.htm l

It talks about Views, including your question.

--
Thanks,
Rich Kulp
Re: 3 Views 1 Model [message #290767 is a reply to message #290766] Wed, 31 August 2005 16:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: automatic.javalobby.org

Yup, this is a great article. The thing that is probably needed here is that the selection listener needs to be wired up, so that if the selection changes, the view updates appropriately:

... getViewSite().getPage().addSelectionListener(this);
...
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
if (selection instanceof IStructuredSelection) {
Object first = ((IStructuredSelection)selection).getFirstElement();
if (first instanceof Word) {
label.setText(((Word)first).toString());
}
}
}

However, that will only help if the model is essentially static, and that you want to update views when you change the selection. If your model is dynamic, and updating data, then you probably have to use some kind of PropertyChangeEvent, as well as registering/deregistering when the selection changes.
Re: 3 Views 1 Model [message #290802 is a reply to message #290760] Thu, 01 September 2005 14:17 Go to previous message
Eclipse UserFriend
Originally posted by: kessi.beer.com

Hi,

Thanks to you three for your answers.

IŽve looked through everything you told me and also had a look at the
SWT/JFace components and experimented with a View holding a JFace Table.

Actually i have a problem, which class(es) i need additonally to connect
all of the ContentProviders to my inital-base-model and where i should
instantiate all of the ContentProviders and JFace widgets....

Should i instantiate them in the views they are embedded in?
Or should i instantiate them in a "base class" and then try to get the
widgets for the view from this base class?

When i instantiate them in the views, i canŽt connect them to my
base-model, as i need instances of the ContentModels to do so.
When i instantiate them in a "base class", how can i get them (and their
widgets) into the Views?

Do you understand what i mean?
I havenŽt found anything on how to do this.

Would be great if someone could help one more time. I really donŽt know
how to manage this.


Andreas
Previous Topic:Open an editor from within a view
Next Topic:Getting ClassNoFoundDef
Goto Forum:
  


Current Time: Thu Apr 25 12:30:45 GMT 2024

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

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

Back to the top