From 1cfc12462c471ff9a2c2e962d6f1926614891700 Mon Sep 17 00:00:00 2001
From: khartlage
null
.
+ *
+ * @see IVariableTextExpander#getText(String, String, ExpandVariableContext)
+ */
public String getText(String varTag, String varValue, ExpandVariableContext context) {
- IFile file = PHPeclipsePlugin.getDefault().getLastEditorFile();
- String fileLocation ="";
- if (file != null) {
- fileLocation = file.getLocation().toString();
+ IPath path = getPath(varTag, varValue, context);
+ if (path != null) {
+ return path.toString();
}
- return fileLocation;
+ return null;
}
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/variable/LastPHPUrlExpander.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/variable/LastPHPUrlExpander.java
new file mode 100644
index 0000000..0ee13f2
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/variable/LastPHPUrlExpander.java
@@ -0,0 +1,53 @@
+package net.sourceforge.phpdt.externaltools.variable;
+
+import net.sourceforge.phpeclipse.PHPeclipsePlugin;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+/**
+ * Expands a variable into the last opened PHP file
+ * + * This class is not intended to be extended by clients. + *
+ */ +public class LastPHPUrlExpander extends ResourceExpander { //implements IVariableTextExpander { + + /** + * Create an instance + */ + public LastPHPUrlExpander() { + super(); + } + + /** + * Returns a string representation of the path to a file or directory + * for the given variable tag and value ornull
.
+ *
+ * @see IVariableTextExpander#getText(String, String, ExpandVariableContext)
+ */
+ public String getText(String varTag, String varValue, ExpandVariableContext context) {
+ IPath path = getPath(varTag, varValue, context);
+ if (path != null) {
+ IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
+ String localhostURL = path.toString();
+ String lowerCaseFileName = localhostURL.toLowerCase();
+ // fileName = "http://localhost"+fileName.replaceAll("c:", "");
+ String documentRoot = store.getString(PHPeclipsePlugin.DOCUMENTROOT_PREF);
+ documentRoot = documentRoot.replace('\\', '/');
+ documentRoot = documentRoot.toLowerCase();
+
+ if (lowerCaseFileName.startsWith(documentRoot)) {
+ localhostURL = localhostURL.substring(documentRoot.length());
+ } else {
+ return localhostURL;
+ }
+
+ return store.getString(PHPeclipsePlugin.LOCALHOST_PREF) + localhostURL.replaceAll(documentRoot, "");
+
+ }
+ return null;
+ }
+
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/default-templates.xml b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/default-templates.xml
index e4e9d43..1c6ccfb 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/default-templates.xml
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/default-templates.xml
@@ -395,37 +395,49 @@ ${cursor}
þ
ÿ
-
-
+ #00FFFF
#000000
#0000FF
#A52A2A
#00FFFF
+ #FF00FF
#FFD700
- #808080
+ #808080
#008000
+ #00FF00
#FF00FF
+ #800000
+ #000080
+ #808000
#FFA500
#FFC0CB
#800080
#FF0000
#C0C0C0
+ #008080
#FFFFFF
#FFFF00
+ #00FFFF
#000000
#0000FF
#A52A2A
#00FFFF
+ #FF00FF
#FFD700
- #808080
+ #808080
#008000
+ #00FF00
#FF00FF
+ #800000
+ #000080
+ #808000
#FFA500
#FFC0CB
#800080
#FF0000
#C0C0C0
+ #008080
#FFFFFF
#FFFF00
--
1.7.1