cbridgha | 68a7415 | 2007-06-07 19:31:19 +0000 | [diff] [blame] | 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2005, 2006 IBM Corporation and others. |
| 3 | * All rights reserved. This program and the accompanying materials |
| 4 | * are made available under the terms of the Eclipse Public License v1.0 |
| 5 | * which accompanies this distribution, and is available at |
| 6 | * http://www.eclipse.org/legal/epl-v10.html |
| 7 | * |
| 8 | * Contributors: |
| 9 | * IBM Corporation - initial API and implementation |
| 10 | *******************************************************************************/ |
jlanuti | b1d8fe2 | 2006-03-02 19:43:27 +0000 | [diff] [blame] | 11 | package org.eclipse.wst.common.internal.emfworkbench; |
| 12 | |
| 13 | import org.eclipse.core.expressions.PropertyTester; |
| 14 | import org.eclipse.emf.ecore.EObject; |
| 15 | |
| 16 | public class EmfPackagePropertyTester extends PropertyTester { |
| 17 | |
| 18 | public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { |
| 19 | if (receiver == null || !(receiver instanceof EObject) || expectedValue == null || !(expectedValue instanceof String)) |
| 20 | return false; |
| 21 | |
| 22 | EObject eObject = (EObject) receiver; |
| 23 | String emfPackage = (String)expectedValue; |
| 24 | return emfPackage.equals(eObject.eClass().getEPackage().getNsURI()); |
| 25 | } |
| 26 | |
| 27 | } |