Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Warning

This is a very draft version.

 

In the following it is explained how you can initialisation you module during the start-up phase of the application or if you need to clean up some allocated resources when you module is shutdown.

import org.openide.modules.OnStart;
import org.openide.modules.OnStop;
import org.openide.windows.OnShowing;

import java.util.concurrent.Callable;

public class Module {

    private Module() {
    }

    @OnStart
    public static class StartOp implements Runnable {

        @Override
        public void run() {

        }
    }

    @OnShowing()
    public static class ShowingOp implements Runnable {

        @Override
        public void run() {

        }
    }

	@OnStop
	public static class MaybeStopOp implements Callable {

    	@Override
	    public Boolean call() {
    	    return Boolean.TRUE;
	}
  
    @OnStop
	public static class StopOp implements Runnable {

    	@Override
    	public void run() {

    }

}

In your maven pom file you will need the following NetBeans dependencies

<dependency>
	// needed for the @OnStart and @OnStop annotations
    <groupId>org.netbeans.api</groupId>
    <artifactId>org-openide-modules</artifactId>
    <version>RELEASE802</version>
</dependency>
<dependency>
	// needed for the @OnShowing annotation
    <groupId>org.netbeans.api</groupId>
    <artifactId>org-openide-windows</artifactId>
    <version>RELEASE802</version>
</dependency>

  • No labels