1 | /**
|
---|
2 | *#########################################################################
|
---|
3 | *
|
---|
4 | * A component of the GAI application, part of the Greenstone digital
|
---|
5 | * library suite from the New Zealand Digital Library Project at the
|
---|
6 | * University of Waikato, New Zealand.
|
---|
7 | *
|
---|
8 | * <BR><BR>
|
---|
9 | *
|
---|
10 | * Author: John Thompson, Greenstone Digital Library, University of Waikato
|
---|
11 | * Modified by: Chi-Yu Huang
|
---|
12 | *
|
---|
13 | * <BR><BR>
|
---|
14 | *
|
---|
15 | * Copyright (C) 1999 New Zealand Digital Library Project
|
---|
16 | *
|
---|
17 | * <BR><BR>
|
---|
18 | *
|
---|
19 | * This program is free software; you can redistribute it and/or modify
|
---|
20 | * it under the terms of the GNU General Public License as published by
|
---|
21 | * the Free Software Foundation; either version 2 of the License, or
|
---|
22 | * (at your option) any later version.
|
---|
23 | *
|
---|
24 | * <BR><BR>
|
---|
25 | *
|
---|
26 | * This program is distributed in the hope that it will be useful,
|
---|
27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
29 | * GNU General Public License for more details.
|
---|
30 | *
|
---|
31 | * <BR><BR>
|
---|
32 | *
|
---|
33 | * You should have received a copy of the GNU General Public License
|
---|
34 | * along with this program; if not, write to the Free Software
|
---|
35 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
36 | *########################################################################
|
---|
37 | */
|
---|
38 | package org.greenstone.admin.gui;
|
---|
39 |
|
---|
40 | import java.awt.*;
|
---|
41 | import java.awt.event.*;
|
---|
42 | import java.io.*;
|
---|
43 | import java.net.*;
|
---|
44 | import javax.swing.*;
|
---|
45 | import javax.swing.event.*;
|
---|
46 |
|
---|
47 | /*
|
---|
48 | import org.greenstone.gatherer.Gatherer;
|
---|
49 | import org.greenstone.gatherer.LocalLibraryServer;
|
---|
50 | import org.greenstone.gatherer.collection.BasicCollectionConfiguration;
|
---|
51 | import org.greenstone.gatherer.file.WorkspaceTree; // !!! Don't like this here
|
---|
52 | import org.greenstone.gatherer.util.ArrayTools;
|
---|
53 | import org.greenstone.gatherer.util.StaticStrings;*/
|
---|
54 |
|
---|
55 |
|
---|
56 | /** This class provides the functionality to delete current collections from the
|
---|
57 | ** GSDLHOME/collect/ directory. The user chooses the collection from a list, where
|
---|
58 | ** each entry also displays details about itself, confirms the delete of a collection
|
---|
59 | ** by checking a checkbox then presses the ok button to actually delete the collection.
|
---|
60 | * @author Chi-Yu Huang, Greenstone Digital Library, University of Waikato
|
---|
61 | * @version 1.0
|
---|
62 | */
|
---|
63 | public class DeleteLogFilePrompt
|
---|
64 | extends JDialog {
|
---|
65 |
|
---|
66 | /** A reference to ourself so any inner-classes can dispose of us. */
|
---|
67 | private DeleteLogFilePrompt prompt = null;
|
---|
68 | private File log_file = null;
|
---|
69 |
|
---|
70 | //A flag showing the deleting status
|
---|
71 | private boolean current_logfile_deleted = false;
|
---|
72 |
|
---|
73 | /** The size of the delete prompt screen. */
|
---|
74 | static final Dimension SIZE = new Dimension(500, 500);
|
---|
75 |
|
---|
76 | // Constructor.
|
---|
77 | public DeleteLogFilePrompt() {
|
---|
78 | super();
|
---|
79 | prompt = this;
|
---|
80 | }
|
---|
81 |
|
---|
82 | /** Destructor. */
|
---|
83 | public void destroy() {
|
---|
84 | prompt = null;
|
---|
85 | }
|
---|
86 |
|
---|
87 | /** This method causes the Delete Confirmation Dialog to be displayed.
|
---|
88 | * returns true if it has deleted the log file that is currently open */
|
---|
89 | public boolean display(File log_file) {
|
---|
90 | int result = JOptionPane.showConfirmDialog((Component) null, "Do you really want to delete this log file", "Delete Confirmation", JOptionPane.YES_NO_OPTION);
|
---|
91 | if ( result == JOptionPane.YES_OPTION) {
|
---|
92 | log_file.delete();
|
---|
93 | current_logfile_deleted = true;
|
---|
94 | JOptionPane.showMessageDialog(prompt,log_file.getPath() + " log file has been deleted. You have to restart the action to create the log file");
|
---|
95 | } else if (result == JOptionPane.NO_OPTION) {
|
---|
96 | current_logfile_deleted = false;
|
---|
97 | JOptionPane.showMessageDialog(prompt, "Cancel deleting the " + log_file.getPath() +" log file");
|
---|
98 | prompt.dispose();
|
---|
99 | }
|
---|
100 | return current_logfile_deleted;
|
---|
101 | }
|
---|
102 |
|
---|
103 |
|
---|
104 | /** Shows a delete complete prompt.
|
---|
105 | * @param success A <strong>boolean</strong> indicating if the collection was successfully deleted.
|
---|
106 | * @see org.greenstone.gatherer.collection.Collection
|
---|
107 | */
|
---|
108 | /*public void resultPrompt(boolean success) {
|
---|
109 | if (success) {
|
---|
110 | JOptionPane.showMessageDialog(prompt,"Selected log file has been deleted. You have to restart the action to create the log file");
|
---|
111 | } else {
|
---|
112 | JOptionPane.showMessageDialog(prompt, "Cancel deleting the log file");
|
---|
113 | }
|
---|
114 | }*/
|
---|
115 |
|
---|
116 | /** Any implementation of ActionListener requires this method so that when an
|
---|
117 | **action is performed the appropriate effect can occur.*/
|
---|
118 | public void actionPerformed(ActionEvent event) {
|
---|
119 | }
|
---|
120 | }
|
---|