package edu.chl.proton.model;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.List;


/**
 * @author Stina Werme
 * Created by stinawerme on 01/05/17.
 */
public class File extends FileSystemEntity {

    private boolean isSaved;


    public File(String name) {
        this.setName(name);
    }

    protected void setIsSaved(boolean state) {
        isSaved = state;
    }

    protected boolean isSaved() {
        return isSaved;
    }

    protected void save(List<String> text) throws IOException {
        try {

            java.io.File file = new java.io.File(this.getPath());
            BufferedWriter out = new BufferedWriter(new FileWriter(file));
            System.out.println("hej");
            for(String line : text) {
                out.write(line);
                out.newLine();
            }
            out.close();
            setIsSaved(true);
        } catch (IOException e) {

        }
    }

    // TODO
    protected String lastEdited() {
        return "";
    }

    // TODO
    protected void remove() {
        this.getFile().delete();
    }
}
@@ -133,16 +133,51 @@
 l.List;%0A
+import java.text.SimpleDateFormat;%0A
 %0A%0A/**%0A *
@@ -1052,32 +1052,33 @@
 tEdited() %7B%0A
+%0A
         
 return %22%22;%0A 
@@ -1069,37 +1069,182 @@
     
-return %22%22;
+File file = new File(%22C:%5C%5CMyfile.txt%22);%0A
 %0A    
-%7D%0A%0A
     
-// TODO
+SimpleDateFormat sdf = new SimpleDateFormat(%22MM/dd/yyyy HH:mm:ss%22);%0A%0A        return %22sdf.format(file.lastModified())%22;%0A    %7D%0A
 %0A   

Fix lastEdited