/******************************************************************************* * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Wind River Systems - initial API and implementation *******************************************************************************/ package org.eclipse.tm.te.ui.terminals.internal; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.tm.te.ui.terminals.launcher.LauncherDelegateManager; /** * Terminals property tester implementation. */ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester { /* (non-Javadoc) * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object) */ @Override public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { if ("hasApplicableLauncherDelegates".equals(property)) { //$NON-NLS-1$ ISelection selection = receiver instanceof ISelection ? (ISelection)receiver : new StructuredSelection(receiver); return expectedValue.equals(Boolean.valueOf(LauncherDelegateManager.getInstance().getApplicableLauncherDelegates(selection).length > 0)); } return false; } }