blob: 738e100e4df84a155b843f1fbf0c22ca53501781 [file] [log] [blame]
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
//
= DevFaqCustomIOProvider
:jbake-type: wiki
:jbake-tags: wiki, devfaq, needsreview
:jbake-status: published
:keywords: Apache NetBeans wiki DevFaqCustomIOProvider
:description: Apache NetBeans wiki DevFaqCustomIOProvider
:toc: left
:toc-title:
:syntax: true
== 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:
[source,java]
----
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 link:http://wiki.netbeans.org/DevFaqCustomIOProvider[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.