001    /*
002     *  Licensed to the Apache Software Foundation (ASF) under one
003     *  or more contributor license agreements.  See the NOTICE file
004     *  distributed with this work for additional information
005     *  regarding copyright ownership.  The ASF licenses this file
006     *  to you under the Apache License, Version 2.0 (the
007     *  "License"); you may not use this file except in compliance
008     *  with the License.  You may obtain a copy of the License at
009     *  
010     *    http://www.apache.org/licenses/LICENSE-2.0
011     *  
012     *  Unless required by applicable law or agreed to in writing,
013     *  software distributed under the License is distributed on an
014     *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     *  KIND, either express or implied.  See the License for the
016     *  specific language governing permissions and limitations
017     *  under the License. 
018     *  
019     */
020    
021    package org.apache.directory.studio.apacheds.dialogs;
022    
023    
024    import org.apache.directory.studio.apacheds.model.Server;
025    import org.eclipse.jface.dialogs.IDialogConstants;
026    import org.eclipse.jface.dialogs.MessageDialog;
027    import org.eclipse.osgi.util.NLS;
028    import org.eclipse.swt.widgets.Shell;
029    
030    
031    /**
032     * Dialog that prompts a user to delete server(s) and/or server configuration(s).
033     * 
034     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
035     * @version $Rev$, $Date$
036     */
037    public class DeleteServerDialog extends MessageDialog
038    {
039        protected Server server;
040    
041    
042        /**
043         * Creates a new DeleteServerDialog.
044         * 
045         * @param parentShell a shell
046         * @param server
047         *      the server
048         */
049        public DeleteServerDialog( Shell parentShell, Server server )
050        {
051            super( parentShell, Messages.getString( "DeleteServerDialog.DeleteServer" ), null, null, QUESTION, new String[] //$NON-NLS-1$
052                { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, OK );
053    
054            if ( server == null )
055            {
056                throw new IllegalArgumentException();
057            }
058    
059            this.server = server;
060            message = NLS.bind( Messages.getString( "DeleteServerDialog.SureToDelete" ), server.getName() ); //$NON-NLS-1$
061        }
062    
063    
064        /* (non-Javadoc)
065         * @see org.eclipse.jface.dialogs.MessageDialog#buttonPressed(int)
066         */
067        protected void buttonPressed( int buttonId )
068        {
069            super.buttonPressed( buttonId );
070        }
071    }