1 package net.sourceforge.phpdt.externaltools.internal.registry;
3 /**********************************************************************
4 Copyright (c) 2002 IBM Corp. and others. All rights reserved.
5 This file is made available under the terms of the Common Public License v1.0
6 which accompanies this distribution, and is available at
7 http://www.eclipse.org/legal/cpl-v10.html
10 **********************************************************************/
12 import net.sourceforge.phpdt.externaltools.variable.ExpandVariableContext;
13 import net.sourceforge.phpdt.externaltools.variable.IVariableTextExpander;
15 import org.eclipse.core.runtime.IConfigurationElement;
18 * Represents the variable for the argument
20 public final class ArgumentVariable extends ExternalToolVariable {
21 private static final DefaultTextExpander defaultExpander = new DefaultTextExpander();
23 private IVariableTextExpander expander = null;
26 * Creates an argument variable
28 * @param tag the variable tag
29 * @param description a short description of what the variable will expand to
30 * @param element the configuration element
32 /*package*/ ArgumentVariable(String tag, String description, IConfigurationElement element) {
33 super(tag, description, element);
37 * Returns the object that can expand the variable
40 public IVariableTextExpander getExpander() {
41 if (expander == null) {
43 expander = (IVariableTextExpander) createObject(ExternalToolVariableRegistry.TAG_EXPANDER_CLASS);
44 } catch (ClassCastException exception) {
46 if (expander == null) {
47 expander = defaultExpander;
55 * Default variable text expander implementation which does
56 * not expand variables, but just returns <code>null</code>.
58 private static final class DefaultTextExpander implements IVariableTextExpander {
60 * Method declared on IVariableTextExpander.
62 public String getText(String varTag, String varValue, ExpandVariableContext context) {