Moved the code in the "tests" plugin (plural) to the "test" fragment (singular)....
[phpeclipse.git] / net.sourceforge.phpeclipse.externaltools / src / net / sourceforge / phpdt / externaltools / variable / ProjectNameExpander.java
1 package net.sourceforge.phpdt.externaltools.variable;
2
3 import org.eclipse.core.resources.IProject;
4
5 /**
6  * Extracts the project name from a variable context
7  */
8 public class ProjectNameExpander implements IVariableTextExpander {
9
10         /**
11          * Returns the name of the project in the given context or <code>null</code>
12          * if there is no project in the context.
13          */
14         public String getText(String varTag, String varValue,
15                         ExpandVariableContext context) {
16                 IProject project = context.getProject();
17                 if (project != null) {
18                         return project.getName();
19                 }
20                 return null;
21         }
22
23 }