DevFaqCustomIOProvider

(Difference between revisions)
(How to implement custom IOProvider)
(How to implement custom IOProvider)
Line 1: Line 1:
__NOTOC__
__NOTOC__
-
==How to implement custom IOProvider==
+
==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 <tt>IOProvider</tt> and override/implement following methods:
You need to extend <tt>IOProvider</tt> and override/implement following methods:

Revision as of 18:22, 24 January 2010

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:

// registration, you can change default instance returned by IOProvider.getDefault() by adjusting position
@org.openide.util.lookup.ServiceProvider(service=org.xxx.MyIOProvider.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

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo