Added
Link Here
|
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2007 Symbian Software Systems 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 |
* Andrew Ferguson (Symbian) - Initial implementation |
10 |
*******************************************************************************/ |
11 |
package org.eclipse.core.internal.expressions; |
12 |
|
13 |
import org.eclipse.core.runtime.Platform; |
14 |
|
15 |
import org.eclipse.core.expressions.IEnablementVetoHolder; |
16 |
import org.eclipse.core.expressions.PropertyTester; |
17 |
|
18 |
/** |
19 |
* Tests whether the object under test |
20 |
* <ul> |
21 |
* <li> can be Adapted to an IEnablementVetoHolder |
22 |
* <li> does not veto any of the property IDs passed to it |
23 |
* </ul> |
24 |
* |
25 |
* @since 3.3 |
26 |
*/ |
27 |
public class EnablementVetoHolderPropertyTester extends PropertyTester { |
28 |
public EnablementVetoHolderPropertyTester() {} |
29 |
|
30 |
public boolean test(Object receiver, |
31 |
String property, |
32 |
Object[] args, |
33 |
Object expectedValue) { |
34 |
if(property.equals("notVetoed")) { //$NON-NLS-1$ |
35 |
IEnablementVetoHolder evh; |
36 |
evh= (IEnablementVetoHolder) Platform.getAdapterManager().getAdapter(receiver, IEnablementVetoHolder.class); |
37 |
if(evh!=null) { |
38 |
for(int i=0; i<args.length; i++) { |
39 |
String vetoCandidateID = (String) args[i]; |
40 |
if(evh.vetoes(vetoCandidateID)) { |
41 |
return false; |
42 |
} |
43 |
} |
44 |
} |
45 |
} |
46 |
return true; |
47 |
} |
48 |
} |