first version of external tools
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / externaltools / variable / LastPHPFileExpander.java
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/variable/LastPHPFileExpander.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/variable/LastPHPFileExpander.java
new file mode 100644 (file)
index 0000000..0801ca4
--- /dev/null
@@ -0,0 +1,24 @@
+package net.sourceforge.phpdt.externaltools.variable;
+
+import net.sourceforge.phpeclipse.PHPeclipsePlugin;
+
+import org.eclipse.core.resources.IFile;
+
+/**
+ * Expands a variable into the last opened PHP file 
+ * <p>
+ * This class is not intended to be extended by clients.
+ * </p>
+ */
+public class LastPHPFileExpander implements IVariableTextExpander {
+
+  public String getText(String varTag, String varValue, ExpandVariableContext context) {
+    IFile file = PHPeclipsePlugin.getDefault().getLastEditorFile();
+    String fileLocation ="";
+    if (file != null) {
+      fileLocation = file.getLocation().toString();
+    }
+    return fileLocation;
+  }
+
+}