Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » propertyTester for perspective in visibleWhen expression
propertyTester for perspective in visibleWhen expression [message #834912] Mon, 02 April 2012 14:47 Go to next message
Christian Pontesegger is currently offline Christian PonteseggerFriend
Messages: 250
Registered: July 2009
Location: Graz, Austria
Senior Member
I was playing around with the expression framework as this is a topic I avoided to touch for too long. I tried to find a very simple example. Therefore I added a toolbar with some sample commands. One uses following visibleWhen expression:

            <command
                  commandId="org.eclipse.ui.file.exit"
                  label="Test4"
                  style="push">
               <visibleWhen
                     checkEnabled="false">
                  <with
                        variable="activeWorkbenchWindow">
                     <test
                           property="org.eclipse.ui.workbenchWindow.isPerspectiveOpen">
                     </test>
                  </with>
               </visibleWhen>
            </command>


I thought this will hide the button when no perspective is open. Unfortunately it doesn't. The button remains visible after closing the last open perspective. Am I facing a bug here or am I using the expression in a wrong way?

thanks
Re: propertyTester for perspective in visibleWhen expression [message #835449 is a reply to message #834912] Tue, 03 April 2012 08:27 Go to previous message
Libor Jelinek is currently offline Libor JelinekFriend
Messages: 143
Registered: January 2012
Location: Prague, Czech Rep.
Senior Member

Hello Christian,
your code looks like valid but try bellow if it helps:

1) Remove checkEnabled="false". I've never used it before and not sure what is true purpose of it.

2) Rewrite condition from test to equals
<with variable="activeWorkbenchWindowActivePerspectiveName">
   <equals value=""/>
      
   <!-- or if you -->
   
   <not>
      <equals value="id.of.your.only.perspective"/>
   </not>
   
</with>


See ISources.ACTIVE_WORKBENCH_WINDOW_ACTIVE_PERSPECTIVE_NAME

3) If everything else failed, turn on tracing options

Hope that helps!
Previous Topic:[org.eclipse.ui.navigator.viewer] doesn't work in PackageExplorer
Next Topic:Eclipse crash on startup
Goto Forum:
  


Current Time: Fri Apr 26 00:33:33 GMT 2024

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

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

Back to the top