1 /******************************************************************************* 2 * Copyright (c) 2005 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 ******************************************************************************/ 11 12 package org.eclipse.ui; 13 14 import java.util.Map; 15 16 /** 17 * <p> 18 * A listener to changes in a particular source of information. This listener is 19 * notified as the source changes. Typically, workbench services will implement 20 * this interface, and register themselves as listeners to the 21 * <code>ISourceProvider</code> instances that are registered with them. 22 * </p> 23 * 24 * @since 3.1 25 * @see org.eclipse.ui.ISources 26 * @see org.eclipse.ui.ISourceProvider 27 */ 28 public interface ISourceProviderListener { 29 30 /** 31 * Handles a change to multiple sources. The source priority should be a bit 32 * mask indicating the sources. The map will be used to construct the 33 * variables on an <code>IEvaluationContext</code> 34 * 35 * @param sourcePriority 36 * A bit mask of all the source priorities that have changed. 37 * @param sourceValuesByName 38 * A mapping of the source names (<code>String</code>) to the 39 * source values (<code>Object</code>). The names should 40 * never be <code>null</code>, but the values may be. The map 41 * must not be <code>null</code>, and should contain at least 42 * two elements (one for each source). 43 * @see org.eclipse.core.expressions.IEvaluationContext 44 * @see ISources 45 */ 46 public void sourceChanged(final int sourcePriority, 47 final Map sourceValuesByName); 48 49 /** 50 * Handles a change to one source. The source priority should indicate the 51 * source, and the name-value pair will be used to create an 52 * <code>IEvaluationContext</code> with a single variable. 53 * 54 * @param sourcePriority 55 * A bit mask of all the source priorities that have changed. 56 * @param sourceName 57 * The name of the source that changed; must not be 58 * <code>null</code>. 59 * @param sourceValue 60 * The new value for that source; may be <code>null</code>. 61 * @see org.eclipse.core.expressions.IEvaluationContext 62 * @see ISources 63 */ 64 public void sourceChanged(final int sourcePriority, 65 final String sourceName, final Object sourceValue); 66 } 67