Ignore:
Timestamp:
11/12/19 15:39:05 (5 years ago)
Author:
bnemhaus
Message:

When deleting a picture on a expedite frame; if shift is held down, then the associated image file is now moved to the trash directory (FrameIO.TRASH_PATH).
When undoing the deletion of a picture, the associated image file is restored.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gui/Frame.java

    r1445 r1448  
    2020
    2121import java.io.File;
     22import java.io.IOException;
     23import java.nio.file.Files;
     24import java.nio.file.Path;
    2225import java.nio.file.Paths;
     26import java.nio.file.StandardCopyOption;
    2327import java.sql.Time;
    2428import java.util.ArrayList;
     
    10961100                        _redo.push(undo);
    10971101                for(Item i : undo.items) {
     1102                        if (i instanceof org.expeditee.items.Picture) {
     1103                                String destination = ((org.expeditee.items.Picture) i).getPath();
     1104                                Path destinationPath = Paths.get(destination);
     1105                                Path sourcePath = Paths.get(FrameIO.TRASH_PATH).resolve(destinationPath.getFileName());
     1106                                try {
     1107                                                Files.move(sourcePath, destinationPath, StandardCopyOption.ATOMIC_MOVE);
     1108                                        } catch (IOException e) {
     1109                                                MessageBay.displayMessage("Unable to restore image file from trash, not undoing deletion of image.");
     1110                                                continue;
     1111                                        }
     1112                        }
    10981113                        this.addItem(i);
    10991114                                reparse |= i.hasOverlay();
Note: See TracChangeset for help on using the changeset viewer.