Committing more fixes for bug #1839622 RSE Path error. This will clean up php files...
[phpeclipse.git] / net.sourceforge.phpeclipse.externaltools / src / net / sourceforge / phpdt / externaltools / internal / registry / RefreshScopeVariable.java
1 package net.sourceforge.phpdt.externaltools.internal.registry;
2
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
8  �
9  Contributors:
10  **********************************************************************/
11
12 import net.sourceforge.phpdt.externaltools.variable.ExpandVariableContext;
13 import net.sourceforge.phpdt.externaltools.variable.IVariableResourceExpander;
14
15 import org.eclipse.core.resources.IResource;
16 import org.eclipse.core.runtime.IConfigurationElement;
17
18 /**
19  * Represents the variable for a refresh scope.
20  */
21 public final class RefreshScopeVariable extends ExternalToolVariable {
22         private static final DefaultResourceExpander defaultExpander = new DefaultResourceExpander();
23
24         private IVariableResourceExpander expander = null;
25
26         /**
27          * Creates a refresh scope variable
28          * 
29          * @param tag
30          *            the variable tag
31          * @param description
32          *            a short description of what the variable will expand to
33          * @param element
34          *            the configuration element
35          */
36         /* package */RefreshScopeVariable(String tag, String description,
37                         IConfigurationElement element) {
38                 super(tag, description, element);
39         }
40
41         /**
42          * Returns the object that can expand the variable as resources.
43          */
44         public IVariableResourceExpander getExpander() {
45                 if (expander == null) {
46                         expander = (IVariableResourceExpander) createObject(ExternalToolVariableRegistry.TAG_EXPANDER_CLASS);
47                         if (expander == null)
48                                 expander = defaultExpander;
49                 }
50                 return expander;
51         }
52
53         /**
54          * Default variable resource expander implementation which does not expand
55          * variables, but just returns <code>null</code>.
56          */
57         private static final class DefaultResourceExpander implements
58                         IVariableResourceExpander {
59                 /*
60                  * (non-Javadoc) Method declared on IVariableResourceExpander.
61                  */
62                 public IResource[] getResources(String varTag, String varValue,
63                                 ExpandVariableContext context) {
64                         return null;
65                 }
66         }
67 }