Changeset 8041


Ignore:
Timestamp:
2004-08-24T16:09:45+12:00 (20 years ago)
Author:
mdewsnip
Message:

Moved undo/UndoManager.java to file/RecycleBin.java.

Location:
trunk/gli/src/org/greenstone/gatherer
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/file/FileManager.java

    r7647 r8041  
    4343import org.greenstone.gatherer.file.FileNode;
    4444import org.greenstone.gatherer.file.FileQueue;
     45import org.greenstone.gatherer.file.RecycleBin;
    4546import org.greenstone.gatherer.gui.LongProgressBar;
    4647import org.greenstone.gatherer.gui.NewFolderPrompt;
    4748import org.greenstone.gatherer.gui.tree.DragTree;
    48 import org.greenstone.gatherer.undo.UndoManager;
    4949import org.greenstone.gatherer.util.DragComponent;
    5050import org.greenstone.gatherer.util.SynchronizedTreeModelTools;
     
    8787    // If source and target are different
    8888    else {
    89         // If target is the UndoManager, we're deleting
    90         if(target instanceof UndoManager) {
    91         // If the source is the workspace then display an error message. Workspace is read only.
    92 
    93         // ...except for files from the "Downloaded Files" folder
     89        // If target is the RecycleBin, we're deleting
     90        if (target instanceof RecycleBin) {
     91        // The workspace tree is read only.
     92        // ... except for files from the "Downloaded Files" folder
    9493        boolean from_downloaded_files_folder = false;
    9594        if (source_nodes != null) {
  • trunk/gli/src/org/greenstone/gatherer/file/FileQueue.java

    r8022 r8041  
    3939import org.greenstone.gatherer.gui.LongProgressBar;
    4040import org.greenstone.gatherer.gui.tree.DragTree;
    41 import org.greenstone.gatherer.undo.UndoManager;
    4241import org.greenstone.gatherer.util.ArrayTools;
    4342import org.greenstone.gatherer.util.DragComponent;
     
    196195     * @see org.greenstone.gatherer.file.FileNode
    197196     * @see org.greenstone.gatherer.gui.LongProgressBar
    198      * @see org.greenstone.gatherer.undo.UndoManager
    199197     * @see org.greenstone.gatherer.util.Utility
    200198     */
     
    373371                        if(job.type == FileJob.COPY) {
    374372                        // A copy is undone with a delete, so it doesn't really matter where the file originally came from (we're not moving it back there, but into the recycle bin). You may also notice we don't make use of the target parent record. This is because no undo action needs this information, and even if it did it could simply ask for records parent!
    375                         Gatherer.c_man.undo.addUndo(job.ID(), UndoManager.FILE_COPY, null, null, job.target, new_record, job.undo);
     373                        // Gatherer.c_man.undo.addUndo(job.ID(), UndoManager.FILE_COPY, null, null, job.target, new_record, job.undo);
    376374                        }
    377375                        else {
    378376                        // Movements however do need a source and source parent so the file can be moved back to the correct place.
    379                         Gatherer.c_man.undo.addUndo(job.ID(), UndoManager.FILE_MOVE, job.source, (FileNode)origin_node.getParent(), job.target, new_record, job.undo);
     377                        // Gatherer.c_man.undo.addUndo(job.ID(), UndoManager.FILE_MOVE, job.source, (FileNode)origin_node.getParent(), job.target, new_record, job.undo);
    380378                        }
    381379                    }
     
    400398                        if(job.type == FileJob.COPY) {
    401399                        // A copy is undone with a delete, so it doesn't really matter where the file originally came from (we're not moving it back there, but into the recycle bin). You may also notice we don't make use of the target parent record. This is because no undo action needs this information, and even if it did it could simply ask for records parent!
    402                         Gatherer.c_man.undo.addUndo(job.ID(), UndoManager.FILE_COPY, null, null, job.target, directory_record, job.undo);
     400                        // Gatherer.c_man.undo.addUndo(job.ID(), UndoManager.FILE_COPY, null, null, job.target, directory_record, job.undo);
    403401                        }
    404402                        else {
    405403                        // Movements however do need a source and source parent so the file can be moved back to the correct place.
    406                         Gatherer.c_man.undo.addUndo(job.ID(), UndoManager.FILE_MOVE, job.source, (FileNode)origin_node.getParent(), job.target, directory_record, job.undo);
     404                        // Gatherer.c_man.undo.addUndo(job.ID(), UndoManager.FILE_MOVE, job.source, (FileNode)origin_node.getParent(), job.target, directory_record, job.undo);
    407405                        }
    408406                    }
     
    453451                    }
    454452                // If it came from the recycle bin retrieve the metadata from there, once again remembering to account for inherited metadata
    455                     else if (job.source.toString().equals("Undo")) {
    456                     // Retrieve metadata from the recycle bin
    457                     ArrayList existing_metadata = Gatherer.c_man.undo.getMetadata(source_file);
    458                     // then assign this remainder to the new folder.
    459                     Gatherer.c_man.getCollection().gdm.addMetadata(new_node, existing_metadata);
    460                     existing_metadata = null;
    461                     }
     453//                      else if (job.source.toString().equals("Undo")) {
     454//                      // Retrieve metadata from the recycle bin
     455//                      ArrayList existing_metadata = Gatherer.c_man.undo.getMetadata(source_file);
     456//                      // then assign this remainder to the new folder.
     457//                      Gatherer.c_man.getCollection().gdm.addMetadata(new_node, existing_metadata);
     458//                      existing_metadata = null;
     459//                      }
    462460                // Otherwise if it came from the workspace use the MSMs parsers to search for folder level metadata (such as metadata.xml or marc records).
    463461                    else if (job.source.toString().equals("Workspace")) {
     
    497495                // Remove its metadata
    498496                ArrayList metadatum = null;
    499                 if(job.source == Gatherer.c_man.undo) {
    500                 Gatherer.c_man.undo.addMetadata(target_file, metadatum);
    501                 }
    502                 else {
    503                 metadatum = Gatherer.c_man.getCollection().gdm.removeMetadata(origin_node.getFile());
    504                 }
     497//                  if(job.source == Gatherer.c_man.undo) {
     498//                  Gatherer.c_man.undo.addMetadata(target_file, metadatum);
     499//                  }
     500//                  else {
     501                metadatum = Gatherer.c_man.getCollection().gdm.removeMetadata(origin_node.getFile());
     502                // }
    505503                // determine its parent node
    506504                FileNode parent_record = (FileNode)origin_node.getParent();
  • trunk/gli/src/org/greenstone/gatherer/gui/GatherPane.java

    r7499 r8041  
    5151import org.greenstone.gatherer.file.FileQueue;
    5252import org.greenstone.gatherer.file.FileSystemModel;
     53import org.greenstone.gatherer.file.RecycleBin;
    5354import org.greenstone.gatherer.gui.Filter;
    5455import org.greenstone.gatherer.gui.GComboBox;
     
    5657import org.greenstone.gatherer.gui.tree.DragTree;
    5758import org.greenstone.gatherer.gui.tree.WorkspaceTree;
    58 import org.greenstone.gatherer.undo.UndoManager;
    5959import org.greenstone.gatherer.util.DragComponent;
    6060import org.greenstone.gatherer.util.DragGroup;
     
    110110    private TreeSynchronizer collection_tree_sync = null;
    111111    /** The button used to delete files, which also doubles as a drop target for files from the Trees. */
    112     private UndoManager bin_button          =  null;
     112    private RecycleBin bin_button           =  null;
    113113    /** The default size of a special mapping dialog. */
    114114    static final Dimension DIALOG_SIZE = new Dimension(400, 120);
     
    364364    JPanel button_pane = new JPanel();
    365365
    366     bin_button = Gatherer.c_man.undo;
     366    bin_button = new RecycleBin();
    367367    bin_button.addActionListener(this);
    368368    bin_button.setEnabled(false);
Note: See TracChangeset for help on using the changeset viewer.