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.IVariableLocationExpander;
15 import org.eclipse.core.runtime.IConfigurationElement;
16 import org.eclipse.core.runtime.IPath;
19 * Represents the variable for the path location
21 public final class PathLocationVariable extends ExternalToolVariable {
22 private static final DefaultLocationExpander defaultExpander = new DefaultLocationExpander();
24 private IVariableLocationExpander expander = null;
27 * Creates a path location variable
32 * a short description of what the variable will expand to
34 * the configuration element
36 /* package */PathLocationVariable(String tag, String description,
37 IConfigurationElement element) {
38 super(tag, description, element);
42 * Returns the object that can expand the variable into a path location.
44 public IVariableLocationExpander getExpander() {
45 if (expander == null) {
46 expander = (IVariableLocationExpander) createObject(ExternalToolVariableRegistry.TAG_EXPANDER_CLASS);
48 expander = defaultExpander;
54 * Default variable location implementation which does not expand variables,
55 * but just returns <code>null</code>.
57 private static final class DefaultLocationExpander implements
58 IVariableLocationExpander {
60 * (non-Javadoc) Method declared on IVariableLocationExpander.
62 public IPath getPath(String varTag, String varValue,
63 ExpandVariableContext context) {