How do I implement a custom IOProvider?
Note: You will only do this if you are writing a replacement for the NetBeans output window, which is a fairly unusual activity.
You need to extend IOProvider
and override/implement following methods:
import javax.swing.Action;
import org.openide.windows.IOContainer;
import org.openide.windows.IOProvider;
import org.openide.windows.InputOutput;
import org.openide.windows.OutputWriter;
// registration, you can change default instance returned by IOProvider.getDefault() by adjusting position
@org.openide.util.lookup.ServiceProvider(service=org.openide.windows.IOProvider.class, position=200)
public final class MyIOProvider extends IOProvider {
// unique name of your provider
private static final String NAME = "My IO provider"; // NOI18N
public OutputWriter getStdOut() {
// implement
}
public InputOutput getIO(String name, boolean newIO) {
// implement
}
@Override
public InputOutput getIO(String name, Action[] toolbarActions) {
// override
}
@Override
public InputOutput getIO(String name, Action[] additionalActions, IOContainer ioContainer) {
// override
}
@Override
public String getName() {
return NAME;
}
}
Add "OpenIDE-Module-Provides: org.openide.windows.IOProvider" to your module manifest (manifest.mf file) to inform that your module provides IOProvider service.
Then instance of your provider could be obtained by IOProvider.get("My IO provider")
Applies to: NetBeans 6.7 or higher