alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 * StartStopInstanceAction.java
 *
 * Created on September 26, 2003, 2:57 PM
 */

package org.netbeans.modules.j2ee.deployment.impl.ui.actions;

import org.netbeans.modules.j2ee.deployment.impl.*;
import org.netbeans.modules.j2ee.deployment.impl.ui.*;
import org.openide.util.HelpCtx;
import org.openide.util.RequestProcessor;
import org.openide.util.NbBundle;

/**
 *
 * @author  nn136682
 */
public class StopServerAction extends org.openide.util.actions.NodeAction {
    
    /** Creates a new instance of StartStopInstanceAction */
    public StopServerAction() {
    }
    
    protected boolean enable(org.openide.nodes.Node[] activatedNodes) {
        return true;
    }
    
    public HelpCtx getHelpCtx() {
        return HelpCtx.DEFAULT_HELP;
    }
    
    public String getName() {
        return NbBundle.getMessage (StopServerAction.class, "LBL_StopName");
    }
    
    protected void performAction(org.openide.nodes.Node[] activatedNodes) {
        final ServerInstance si = (ServerInstance) activatedNodes[0].getCookie(ServerInstance.class);
        final String title = NbBundle.getMessage(StartServerAction.class, "LBL_StopServer", si.getDisplayName());
        if (si != null) {
            RequestProcessor.getDefault().post(new Runnable() {
                public void run() {
                    ServerStatusBar ui = new ServerStatusBar(title);
                    ui.startProgressUI(3);
                    si.stop(ui);
                    ui.recordWork(3);
                }
            });
        }
    }

    protected boolean asynchronous() { return false; }
    
}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.