added a php external tools launcher
[phpeclipse.git] / net.sourceforge.phpeclipse / 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
12          * <code>null</code> if there is no project in the context.
13          */
14         public String getText(String varTag, String varValue, ExpandVariableContext context) {
15                 IProject project= context.getProject();
16                 if (project != null) {
17                         return project.getName();
18                 }
19                 return null;
20         }
21
22 }