1 11 12 package org.eclipse.ui.internal; 13 14 import org.eclipse.core.expressions.PropertyTester; 15 import org.eclipse.ui.IPerspectiveDescriptor; 16 import org.eclipse.ui.IWorkbenchPage; 17 18 24 public class OpenPerspectivePropertyTester extends PropertyTester { 25 private static final String PROPERTY_IS_PERSPECTIVE_OPEN = "isPerspectiveOpen"; 27 33 public boolean test(Object receiver, String property, Object [] args, 34 Object expectedValue) { 35 if (args.length == 0 && receiver instanceof WorkbenchWindow) { 36 final WorkbenchWindow window = (WorkbenchWindow) receiver; 37 if (PROPERTY_IS_PERSPECTIVE_OPEN.equals(property)) { 38 IWorkbenchPage page = window.getActivePage(); 39 if (page != null) { 40 IPerspectiveDescriptor persp = page.getPerspective(); 41 if (persp != null) { 42 return true; 43 } 44 } 45 } 46 } 47 return false; 48 } 49 50 } 51 | Popular Tags |