Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Check if a view in a stack is visible.
Check if a view in a stack is visible. [message #560146] Tue, 21 September 2010 10:58 Go to next message
Sebastian  is currently offline Sebastian Friend
Messages: 22
Registered: September 2010
Junior Member
Hey,

I am facing a major problem checking whether or not a view is visible or not.

Here is the problem:

For a view which is located in a stack of views I want to know if it is currently on top of the stack - hence visible - or not.

Upon clicking a different area of the workbench (e.g. an editor or another stack of views), the view is still visible, but the call to page.isPartVisisble returns false and the approach using the IPartListener didn't work either.

I am sure there is a super simple solution to this.

Thanks for help Smile
Re: Check if a view in a stack is visible. [message #560196 is a reply to message #560146] Tue, 21 September 2010 14:07 Go to previous messageGo to next message
eshvar60  is currently offline eshvar60 Friend
Messages: 51
Registered: March 2010
Member
He Sebastian,

I actually had a similar problem where I need to see if a view is visible not just active(to test if a view is active just use the activePart from the Command Core Expressions).

I resolved this issue by using contexts. Essentially I put listeners on my views to activate and deactive certain contexts when the view was hidden or became visible. Then when I had items that need to be shown/hidden based on the views I used a custom PropertyTester combined with the activeContexts expression from the Command Core Expression to see if the context I needed was active.

I know its a bit confusing and I would love to hear better solutions from other people. If you need help implementing my solution just let me know.
Re: Check if a view in a stack is visible. [message #656488 is a reply to message #560146] Fri, 25 February 2011 21:24 Go to previous message
fran81 Missing name is currently offline fran81 Missing nameFriend
Messages: 27
Registered: November 2010
Junior Member
I;ve just had this problem, there may be better ways, but this worked for me:

1. assign a title to your view in the plugin.xml file
2. in the class with your view implement IPartListener
3. public void createPartCOntrol (Composite parent) {
getSite().getPage().addPartListener(this)
}

4. add the implemented methods for IPartListener

public void partActivated(IWorkbenchPArt part) {
//everytime you switch from one view to the other in the stack this method will be called for both views in the stack, so:
if (part.getTitle().equals("yourviewtitle") {
//set visibility
}
}
Previous Topic:org.eclipse.osgi problem with porting from 32bit to 64bit
Next Topic:Help about JFace TableViewer usage
Goto Forum:
  


Current Time: Sat Apr 27 01:16:07 GMT 2024

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

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

Back to the top