Apache NetBeans Wiki Index

Note: These pages are being reviewed.

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") <hr/> Applies to: NetBeans 6.7 or higher

Apache Migration Information

The content in this page was kindly donated by Oracle Corp. to the Apache Software Foundation.

This page was exported from http://wiki.netbeans.org/DevFaqCustomIOProvider , that was last modified by NetBeans user Jhavlin on 2011-12-12T13:12:12Z.

NOTE: This document was automatically converted to the AsciiDoc format on 2018-02-07, and needs to be reviewed.