UnconfigureDialog.java revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* ident "%Z%%M% %I% %E% SMI"
*
* Copyright 1998-2002 by Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/**
* A dialog to confirm the user's request to unconfigure the service.
*/
public class UnconfigureDialog extends MultipleOperationDialog {
private int networkCount = 0;
public UnconfigureDialog(Frame f) {
// No reset button for us
super(f, false);
}
}
protected JPanel getMainPanel() {
if (!DhcpmgrApplet.modeIsRelay) {
deleteTables = new JCheckBox(
deleteHosts = new JCheckBox(
deleteHosts.setEnabled(false);
public void actionPerformed(ActionEvent e) {
if (!deleteTables.isSelected()) {
deleteHosts.setEnabled(false);
return;
}
// If the host resource is set in the configuration
// file (or we can't tell), then enable the deleteHosts
// checkbox.
try {
deleteHosts.setEnabled(true);
}
} catch (BridgeException ex) {
// Assume set
deleteHosts.setEnabled(true);
}
}
});
} else {
}
buttonPanel.setOkEnabled(true);
return mainPanel;
}
protected String getProgressMessage() {
}
protected int getProgressLength() {
// Initialize to number of ops required even if only a relay
int length = 2;
if (!DhcpmgrApplet.modeIsRelay) {
// Add one for deleting defaults file, and one for deleting macro
length += 2;
if (deleteTables.isSelected()) {
try {
} catch (Throwable t) {
// Ignore
}
}
}
return length;
}
protected String getErrorHeading() {
}
protected Thread getOperationThread() {
return new Thread() {
public void run() {
int checkpoint = 0;
// Shut down the server
try {
} catch (Throwable e) {
e.getMessage());
}
try {
"unconfigure_server_shutdown"));
} catch (InterruptedException e) {
closeDialog();
return;
}
// If this was a relay we're done
if (!DhcpmgrApplet.modeIsRelay) {
// Remove the server macro
try {
false);
} catch (Throwable e) {
"unconfigure_error_macro"),
e.getMessage());
}
try {
"unconfigure_macro_deleted"));
} catch (InterruptedException e) {
closeDialog();
return;
}
// Delete all the network tables and the dhcptab
if (deleteTables.isSelected()) {
"unconfigure_error_network"));
"unconfigure_network_progress"));
try {
deleteNetwork(netString, true,
} catch (Throwable e) {
e.getMessage());
}
try {
} catch (InterruptedException e) {
closeDialog();
return;
}
}
}
try {
} catch (Throwable e) {
"unconfigure_error_dhcptab"),
e.getMessage());
}
try {
"unconfigure_dhcptab_deleted"));
} catch (InterruptedException e) {
closeDialog();
return;
}
}
}
// Remove the defaults file last, else stuff above may fail.
try {
} catch (Throwable e) {
"unconfigure_error_defaults"), e.getMessage());
}
try {
"unconfigure_defaults_deleted"));
} catch (InterruptedException e) {
closeDialog();
return;
}
if (errorsOccurred()) {
"unconfigure_error_messages"));
}
closeDialog();
}
};
}
protected String getHelpKey() {
if (DhcpmgrApplet.modeIsRelay) {
return "unconfigure_relay";
} else {
return "unconfigure_server";
}
}
protected void fireActionPerformed() {
}
}