source: trunk/gsdl3/src/java/org/greenstone/admin/gui/DeleteLogFilePrompt.java@ 10929

Last change on this file since 10929 was 10929, checked in by kjdon, 18 years ago

merged Chi's admin stuff from ant install branch into main repository

  • Property svn:keywords set to Author Date Id Revision
File size: 4.5 KB
Line 
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 */
38package org.greenstone.admin.gui;
39
40import java.awt.*;
41import java.awt.event.*;
42import java.io.*;
43import java.net.*;
44import javax.swing.*;
45import javax.swing.event.*;
46import org.greenstone.core.Configuration;
47import org.greenstone.core.DebugStream;
48
49/*import org.greenstone.gatherer.Dictionary;
50import org.greenstone.gatherer.Gatherer;
51import org.greenstone.gatherer.LocalLibraryServer;
52import org.greenstone.gatherer.collection.BasicCollectionConfiguration;
53import org.greenstone.gatherer.file.WorkspaceTree; // !!! Don't like this here
54import org.greenstone.gatherer.util.ArrayTools;
55import org.greenstone.gatherer.util.StaticStrings;*/
56
57//import org.greenstone.gatherer.core.Utility;
58
59/** This class provides the functionality to delete current collections from the
60 ** GSDLHOME/collect/ directory. The user chooses the collection from a list, where
61 ** each entry also displays details about itself, confirms the delete of a collection
62 ** by checking a checkbox then presses the ok button to actually delete the collection.
63 * @author Chi-Yu Huang, Greenstone Digital Library, University of Waikato
64 * @version 1.0
65 */
66public class DeleteLogFilePrompt
67 extends JDialog {
68
69 /** A reference to ourself so any inner-classes can dispose of us. */
70 private DeleteLogFilePrompt prompt = null;
71 private File log_file = null;
72
73 //A flag showing the deleting status
74 private boolean current_logfile_deleted = false;
75
76 /** The size of the delete prompt screen. */
77 static final Dimension SIZE = new Dimension(500, 500);
78
79 // Constructor.
80 public DeleteLogFilePrompt() {
81 super();
82 prompt = this;
83 }
84
85 /** Destructor. */
86 public void destroy() {
87 prompt = null;
88 }
89
90 /** This method causes the Delete Confirmation Dialog to be displayed.
91 * returns true if it has deleted the log file that is currently open */
92 public boolean display(File log_file) {
93 int result = JOptionPane.showConfirmDialog((Component) null, "Do you really want to delete this log file", "Delete Confirmation", JOptionPane.YES_NO_OPTION);
94 if ( result == JOptionPane.YES_OPTION) {
95 log_file.delete();
96 current_logfile_deleted = true;
97 JOptionPane.showMessageDialog(prompt,log_file.getPath() + " log file has been deleted. You have to restart the action to create the log file");
98 } else if (result == JOptionPane.NO_OPTION) {
99 current_logfile_deleted = false;
100 JOptionPane.showMessageDialog(prompt, "Cancel deleting the " + log_file.getPath() +" log file");
101 prompt.dispose();
102 }
103 return current_logfile_deleted;
104 }
105
106
107 /** Shows a delete complete prompt.
108 * @param success A <strong>boolean</strong> indicating if the collection was successfully deleted.
109 * @see org.greenstone.gatherer.collection.Collection
110 */
111 /*public void resultPrompt(boolean success) {
112 if (success) {
113 JOptionPane.showMessageDialog(prompt,"Selected log file has been deleted. You have to restart the action to create the log file");
114 } else {
115 JOptionPane.showMessageDialog(prompt, "Cancel deleting the log file");
116 }
117 }*/
118
119 /** Any implementation of ActionListener requires this method so that when an
120 **action is performed the appropriate effect can occur.*/
121 public void actionPerformed(ActionEvent event) {
122 }
123}
Note: See TracBrowser for help on using the repository browser.