Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to Close a View
How to Close a View [message #449044] Tue, 09 May 2006 09:21 Go to next message
Eclipse UserFriend
Hey guys...

I am new on the RCP programming... so, here is my first question: How do I close a View? I am using the example provided by eclipse rcp tutorial 3 (org.eclipse.ui.tutorials.rcp.part3) ... and i would like to create an action to close the selected view. Is it possible to do?

Many thanks,
Thiago, Brazil
Re: How to Close a View [message #449053 is a reply to message #449044] Tue, 09 May 2006 12:20 Go to previous messageGo to next message
Eclipse UserFriend
Thiago

If you are as new to RCP as a newborn butt I advise you to take it slowly but with firm step.


RCP is very powerful, you can achieve very good apps but it is very complicated.

So, if you are really decided to learn RCP you should do a small investment and by some books.

I firmly recommend:

1. Designing Coding and Packaging Java Applications by Jeff McAffer - Jean Michel Lemieux.

This book teaches you a lot of stuff and gets you going on.

2. If you are new to SWT and JFace, this book is as a bible:

The Definitive Guide to SWT and JFace by Rob Warner - Robert Harris.

Now, comming back to your question, there are several situations and ways for closing a view:

1. Just use the 'X' in the vies tab.
2. Closing it from inside the view:

getViewSite().getPage().hideView(MyView.this);

where MyView is your views class name.

3. From outside the view.

3.1 If your view does not allow multiple instances:

IWorkbenchPage wbp = PlatformUI.getWorkbench()
getActiveWorkbenchWindow().getActivePage();

wbp.hideView(wbp.findView("myViewId"));

where myViewId is the id you assigned to the view.

3.2 If your view allows multiple instances:

IWorkbenchPage wbp = PlatformUI.getWorkbench()
getActiveWorkbenchWindow().getActivePage();

wbp.hideView(wbp.findViewReference("myViewId", "mySecondaryViewId"));

where myViewId is the id you assigned to the view and mySecondaryViewId is the secondary id assigned to the view when opened.

I hope this helps you.

AG
Re: How to Close a View [message #449056 is a reply to message #449053] Tue, 09 May 2006 13:00 Go to previous messageGo to next message
Eclipse UserFriend
Antonio,

Thank you very much for your words. In fact, i am a java developer and nowadays i am studing for my masters. I need to create a software for my thesis and I would like to do this using RCP. To be honest, I have been reading some tutorials and examples about RPC, but not more than this. I realize that RCP is extremely powerful, but in other hands, it is quite dificult to learn due to the framework complexity. I am not finishing my studies here, it was just a question on how to implement an action within the example given by eclipse website in order to learn some tricks about it. I guess I have starting from the beginning, literaly, once creating views, making views comunicate with anothers, everything is new for me, thats why i am experiencing many problems to understant the way it works.

About my application for my thesis, it is supouse to be a rcp app, with database connection (oracle), 4 ou 5 kinds of views (just one instance is allowed)... etc...

Again, thanks for your comments and help!
Re: How to Close a View [message #449057 is a reply to message #449056] Tue, 09 May 2006 13:14 Go to previous messageGo to next message
Eclipse UserFriend
Thiago,

Don't throw away my advice about the books. It is very very hard to learn RCP if you don't have a guide like that.

On the other hand, taking in account I'm not an "expert" in RCP (Have been working it for about 6 months) I'm willing to help you if I can (I have sort of a teacher inclination).

The problem might be the time you have to build your app. The learning curve to RCP if quite high but it is worthwhile.

So, If you have any questions you consider not to post in RCP forum, you can mail me at maguri@epm.net.co and we can both work a solution.

Luck (you need it)
Re: How to Close a View [message #449058 is a reply to message #449057] Tue, 09 May 2006 13:15 Go to previous message
Eclipse UserFriend
I am not throwing away, I have just bought them at amazon.com! :-)
Previous Topic:CoolBar - Unwanted entries
Next Topic:ISelectionListener and an Action
Goto Forum:
  


Current Time: Sun Aug 31 12:46:51 EDT 2025

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

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

Back to the top