Making the plug-in compatible with Java 1.4
[phpeclipse.git] / net.sourceforge.phpeclipse.externaltools / src / net / sourceforge / phpdt / externaltools / variable / FileExpander.java
1 package net.sourceforge.phpdt.externaltools.variable;
2
3 import org.eclipse.core.runtime.IPath;
4
5 /**
6  * Expands a variable into the last opened PHP file
7  * <p>
8  * This class is not intended to be extended by clients.
9  * </p>
10  */
11 public class FileExpander extends ResourceExpander { // implements
12                                                                                                                 // IVariableTextExpander
13                                                                                                                 // {
14
15         /**
16          * Create an instance
17          */
18         public FileExpander() {
19                 super();
20         }
21
22         /**
23          * Returns a string representation of the path to a file or directory for
24          * the given variable tag and value or <code>null</code>.
25          * 
26          * @see IVariableTextExpander#getText(String, String, ExpandVariableContext)
27          */
28         public String getText(String varTag, String varValue,
29                         ExpandVariableContext context) {
30                 IPath path = getPath(varTag, varValue, context);
31                 if (path != null) {
32                         return path.toString();
33                 }
34                 return "<no file selected>";
35         }
36
37 }