1 package net.sourceforge.phpeclipse.mover;
6 import net.sourceforge.phpeclipse.views.PHPConsole;
9 * Provides default mover implementation
12 abstract public class DefaultMover
18 protected PHPConsole fConsole;
21 * Creates a DefaultMover
22 * @param console Console to report errors to
24 public DefaultMover(PHPConsole console)
26 this.fConsole = console;
30 * compute a file extension
31 * @param file file to compute the extension from
32 * @return the file extension (excluding the .), "" if none
34 public static String getExtension(File file)
36 String filename = file.getName();
37 int index = filename.lastIndexOf('.');
38 return index != -1 ? filename.substring(index + 1) : "";
42 * compute the filename without the extension
43 * @param file file to compute the extension from
44 * @return the file name without the extension (excluding the .)
46 public static String getDisplayName(File file)
48 String filename = file.getName();
49 int index = filename.lastIndexOf('.');
50 return index != -1 ? filename.substring(0,index) : filename;