1 /******************************************************************************* 2 * Copyright (c) 2000, 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 package org.eclipse.core.variables; 12 13 import org.eclipse.core.runtime.CoreException; 14 15 /** 16 * A dynamic variable is a variable whose value is computed dynamically 17 * by a resolver at the time a string substitution is performed. A dynamic 18 * variable is contributed by an extension. 19 * <p> 20 * The following is a definition of a dynamic variable that resolves to the name of the selected resource: 21 * <pre> 22 * <extension point="org.eclipse.core.variables.dynamicVariables"> 23 * <variable 24 * name="resource_name" 25 * resolver="com.example.ResourceNameResolver" 26 * description="The name of the selected resource" 27 * supportsArgument="false"> 28 * </variable> 29 * </extension> 30 * </pre> 31 * </p> 32 * <p> 33 * Clients are not intended to implement this interface. Instead, clients contributing 34 * a dynamic variable provide an implementation of {@link org.eclipse.core.variables.IDynamicVariableResolver}. 35 * </p> 36 * @since 3.0 37 */ 38 public interface IDynamicVariable extends IStringVariable { 39 40 /** 41 * Returns the value of this variable when referenced with the given 42 * argument, possibly <code>null</code>. 43 * 44 * @param argument argument present in variable expression or <code>null</code> 45 * if none 46 * @return value of this variable when referenced with the given argument, possibly 47 * <code>null</code> 48 * @throws CoreException if unable to resolve a value for this variable 49 */ 50 public String getValue(String argument) throws CoreException; 51 52 /** 53 * Returns whether this variable supports an argument, as specified 54 * by this variable's extension definition in plug-in XML. 55 * 56 * @return whether this variable supports an argument 57 */ 58 public boolean supportsArgument(); 59 } 60