View | Details | Raw Unified | Return to bug 173302 | Differences between
and this patch

Collapse All | Expand All

(-)plugin.xml (-1 / +9 lines)
Lines 536-542 Link Here
536
            name="%PropertyPages.project.reference"
536
            name="%PropertyPages.project.reference"
537
            >
537
            >
538
         <enabledWhen>
538
         <enabledWhen>
539
            <adapt type="org.eclipse.core.resources.IProject"/>
539
            <and>
540
               <test
541
                     args="org.eclipse.ui.propertypages.project.reference"
542
                     property="org.eclipse.core.expressions.notVetoed">
543
               </test>
544
               <adapt
545
                     type="org.eclipse.core.resources.IProject">
546
               </adapt>
547
            </and>
540
         </enabledWhen>
548
         </enabledWhen>
541
      </page>
549
      </page>
542
      <page
550
      <page
(-)plugin.xml (+7 lines)
Lines 13-18 Link Here
13
              properties="product,isBundleInstalled"
13
              properties="product,isBundleInstalled"
14
              class="org.eclipse.core.internal.expressions.propertytester.PlatformPropertyTester">
14
              class="org.eclipse.core.internal.expressions.propertytester.PlatformPropertyTester">
15
        </propertyTester>
15
        </propertyTester>
16
        <propertyTester
17
              class="org.eclipse.core.internal.expressions.EnablementVetoHolderPropertyTester"
18
              id="org.eclipse.core.expressions.EnablementVetoHolderPropertyTester"
19
              namespace="org.eclipse.core.expressions"
20
              properties="notVetoed"
21
              type="java.lang.Object">
22
        </propertyTester>
16
     </extension>
23
     </extension>
17
24
18
</plugin>
25
</plugin>
(-)src/org/eclipse/core/expressions/IEnablementVetoHolder.java (+31 lines)
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.expressions;
12
13
/**
14
 * The org.eclipse.core.expressions.notVetoed test expression allows
15
 * the object being tested to register an Adapter for this interface type.
16
 * 
17
 * If the object being tested can be adapted to this interface type it will
18
 * be given the chance to veto the subexpression it appears in.
19
 * 
20
 * @since 3.3
21
 */
22
public interface IEnablementVetoHolder {
23
	/**
24
	 * Returns whether this veto holder chooses to veto the subexpression
25
	 * it appears in.
26
	 * @param id the id provided in the test expression
27
	 * @return whether this veto holder chooses to veto the subexpression
28
	 * it appears in.
29
	 */
30
	boolean vetoes(String id);
31
}
(-)src/org/eclipse/core/internal/expressions/EnablementVetoHolderPropertyTester.java (+48 lines)
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
}

Return to bug 173302