*** empty log message ***
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / mover / DefaultMover.java
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/mover/DefaultMover.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/mover/DefaultMover.java
new file mode 100644 (file)
index 0000000..b281529
--- /dev/null
@@ -0,0 +1,52 @@
+package net.sourceforge.phpeclipse.mover;
+
+
+import java.io.File;
+
+import net.sourceforge.phpeclipse.views.PHPConsole;
+
+/**
+ * Provides default mover implementation 
+ *
+ */
+abstract public class DefaultMover
+   implements IMover
+{
+   /**
+    * Console for output 
+    * */
+   protected PHPConsole fConsole;
+
+   /**
+    * Creates a DefaultMover 
+    * @param console Console to report errors to
+    */
+   public DefaultMover(PHPConsole console)
+   {
+      this.fConsole = console;
+   }
+
+   /**
+    * compute a file extension
+    * @param file file to compute the extension from
+    * @return the file extension (excluding the .), "" if none
+    */
+   public static String getExtension(File file)
+   {
+      String filename = file.getName();
+      int index = filename.lastIndexOf('.');
+      return index != -1 ? filename.substring(index + 1) : "";
+   }
+
+   /**
+    * compute the filename without the extension
+    * @param file file to compute the extension from
+    * @return the file name without the extension (excluding the .)
+    */
+   public static String getDisplayName(File file)
+   {
+      String filename = file.getName();
+      int index = filename.lastIndexOf('.');
+      return index != -1 ? filename.substring(0,index) : filename;
+   }
+}