This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 245014
Collapse All | Expand All

(-)a/core.output2/manifest.mf (-1 / +1 lines)
Lines 4-8 Link Here
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/core/output2/Bundle.properties
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/core/output2/Bundle.properties
5
OpenIDE-Module-Provides: org.openide.windows.IOProvider
5
OpenIDE-Module-Provides: org.openide.windows.IOProvider
6
AutoUpdate-Essential-Module: true
6
AutoUpdate-Essential-Module: true
7
OpenIDE-Module-Specification-Version: 1.37
7
OpenIDE-Module-Specification-Version: 1.38
8
8
(-)a/core.output2/nbproject/project.xml (-1 / +10 lines)
Lines 111-117 Link Here
111
                    <build-prerequisite/>
111
                    <build-prerequisite/>
112
                    <compile-dependency/>
112
                    <compile-dependency/>
113
                    <run-dependency>
113
                    <run-dependency>
114
                        <specification-version>1.40</specification-version>
114
                        <specification-version>1.45</specification-version>
115
                    </run-dependency>
116
                </dependency>
117
                <dependency>
118
                    <code-name-base>org.openide.io.base</code-name-base>
119
                    <build-prerequisite/>
120
                    <compile-dependency/>
121
                    <run-dependency>
122
                        <release-version>1</release-version>
123
                        <specification-version>1.0</specification-version>
115
                    </run-dependency>
124
                    </run-dependency>
116
                </dependency>
125
                </dependency>
117
                <dependency>
126
                <dependency>
(-)a/core.output2/src/org/netbeans/core/output2/NbIO.java (-1 / +14 lines)
Lines 54-59 Link Here
54
import java.io.IOException;
54
import java.io.IOException;
55
import java.io.Reader;
55
import java.io.Reader;
56
import org.netbeans.core.output2.options.OutputOptions;
56
import org.netbeans.core.output2.options.OutputOptions;
57
import org.openide.io.base.ExtendableWriter;
58
import org.openide.io.base.InputOutputBase;
57
import org.openide.util.Exceptions;
59
import org.openide.util.Exceptions;
58
import org.openide.util.Lookup;
60
import org.openide.util.Lookup;
59
import org.openide.util.lookup.Lookups;
61
import org.openide.util.lookup.Lookups;
Lines 72-78 Link Here
72
 *
74
 *
73
 * @author  Tim Boudreau
75
 * @author  Tim Boudreau
74
 */
76
 */
75
class NbIO implements InputOutput, Lookup.Provider {
77
class NbIO implements InputOutput, InputOutputBase, Lookup.Provider {
76
78
77
    private Boolean focusTaken = null;
79
    private Boolean focusTaken = null;
78
    private volatile boolean closed = false;
80
    private volatile boolean closed = false;
Lines 248-253 Link Here
248
        return actions;
250
        return actions;
249
    }
251
    }
250
    
252
    
253
    @Override
251
    public void reset() {
254
    public void reset() {
252
        if (Controller.LOG) Controller.log (this + ": reset");
255
        if (Controller.LOG) Controller.log (this + ": reset");
253
        closed = false;
256
        closed = false;
Lines 317-322 Link Here
317
        return lookup;
320
        return lookup;
318
    }
321
    }
319
322
323
    @Override
324
    public ExtendableWriter getExtendableOut() {
325
        return (NbWriter) getOut();
326
    }
327
328
    @Override
329
    public ExtendableWriter getExtandableErr() {
330
        return (NbWriter) getErr();
331
    }
332
320
    class IOReader extends Reader {
333
    class IOReader extends Reader {
321
        private boolean pristine = true;
334
        private boolean pristine = true;
322
        IOReader() {
335
        IOReader() {
(-)a/core.output2/src/org/netbeans/core/output2/NbIOProvider.java (-51 / +17 lines)
Lines 45-51 Link Here
45
package org.netbeans.core.output2;
45
package org.netbeans.core.output2;
46
46
47
import java.io.IOException;
47
import java.io.IOException;
48
import java.util.WeakHashMap;
49
import javax.swing.Action;
48
import javax.swing.Action;
50
import org.openide.util.Exceptions;
49
import org.openide.util.Exceptions;
51
import org.openide.util.NbBundle;
50
import org.openide.util.NbBundle;
Lines 55-73 Link Here
55
import org.openide.windows.OutputWriter;
54
import org.openide.windows.OutputWriter;
56
55
57
/**
56
/**
58
 * Supplies Output Window implementation through Lookup.
57
 * Supplies Output Window implementation through Lookup. Provider of I/O
58
 * instances for the org.openide.io (package org.openide.windows) API.
59
 *
59
 * @author Jesse Glick, Tim Boudreau
60
 * @author Jesse Glick, Tim Boudreau
60
 */
61
 */
61
@org.openide.util.lookup.ServiceProvider(service=org.openide.windows.IOProvider.class, position=100)
62
@org.openide.util.lookup.ServiceProvider(service=org.openide.windows.IOProvider.class, position=100)
62
public final class NbIOProvider extends IOProvider {
63
public final class NbIOProvider extends IOProvider {
63
    private static final WeakHashMap<IOContainer, PairMap> containerPairMaps =
64
            new WeakHashMap<IOContainer, PairMap>();
65
64
66
    private static final String STDOUT = NbBundle.getMessage(NbIOProvider.class,
65
    private static final String STDOUT = NbBundle.getMessage(NbIOProvider.class,
67
        "LBL_STDOUT"); //NOI18N
66
        "LBL_STDOUT"); //NOI18N
68
67
69
    private static final String NAME = "output2"; // NOI18N
68
    @Override
70
    
69
    public String getName() {
70
        return SharedProvider.getInstance().getName();
71
    }
72
73
    @Override
71
    public OutputWriter getStdOut() {
74
    public OutputWriter getStdOut() {
72
        if (Controller.LOG) {
75
        if (Controller.LOG) {
73
            Controller.log("NbIOProvider.getStdOut");
76
            Controller.log("NbIOProvider.getStdOut");
Lines 93-98 Link Here
93
    }
96
    }
94
    
97
    
95
    
98
    
99
    @Override
96
    public InputOutput getIO(String name, boolean newIO) {
100
    public InputOutput getIO(String name, boolean newIO) {
97
        return getIO (name, newIO, new Action[0], null);
101
        return getIO (name, newIO, new Action[0], null);
98
    }
102
    }
Lines 108-160 Link Here
108
    }
112
    }
109
113
110
    @Override
114
    @Override
111
    public String getName() {
115
    public InputOutput getIO(String name, boolean newIO, Action[] actions,
112
        return NAME;
116
            IOContainer ioContainer) {
117
118
        return SharedProvider.getInstance().getIO(name, newIO, actions,
119
                ioContainer);
113
    }
120
    }
114
121
115
    @Override
122
    static void dispose(NbIO io) {
116
    public InputOutput getIO(String name, boolean newIO,
123
        SharedProvider.dispose(io);
117
            Action[] toolbarActions, IOContainer ioContainer) {
118
        if (Controller.LOG) {
119
            Controller.log("GETIO: " + name + " new:" + newIO);
120
        }
121
        IOContainer realIoContainer = ioContainer == null
122
                ? IOContainer.getDefault() : ioContainer;
123
        NbIO result;
124
        synchronized (containerPairMaps) {
125
            PairMap namesToIos = containerPairMaps.get(realIoContainer);
126
            result = namesToIos != null ? namesToIos.get(name) : null;
127
        }
128
        if (result == null || newIO) {
129
            result = new NbIO(name, toolbarActions, realIoContainer);
130
            synchronized (containerPairMaps) {
131
                PairMap namesToIos = containerPairMaps.get(realIoContainer);
132
                if (namesToIos == null) {
133
                    namesToIos = new PairMap();
134
                    containerPairMaps.put(realIoContainer, namesToIos);
135
                }
136
                namesToIos.add(name, result);
137
            }
138
            NbIO.post(new IOEvent(result, IOEvent.CMD_CREATE, newIO));
139
        }
140
        return result;
141
    }
142
    
143
    
144
    static void dispose (NbIO io) {
145
        IOContainer ioContainer = io.getIOContainer();
146
        if (ioContainer == null) {
147
            ioContainer = IOContainer.getDefault();
148
        }
149
        synchronized (containerPairMaps) {
150
            PairMap namesToIos = containerPairMaps.get(ioContainer);
151
            if (namesToIos != null) {
152
                namesToIos.remove(io);
153
                if (namesToIos.isEmpty()) {
154
                    containerPairMaps.remove(ioContainer);
155
                }
156
            }
157
        }
158
    }
124
    }
159
}
125
}
160
126
(-)a/core.output2/src/org/netbeans/core/output2/NbIOProviderBase.java (+67 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2014 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.core.output2;
43
44
import javax.swing.Action;
45
import org.openide.io.base.IOProviderBase;
46
import org.openide.io.base.InputOutputBase;
47
import org.openide.util.lookup.ServiceProvider;
48
49
/**
50
 * Provider of I/O instances for the org.openide.io.base API.
51
 *
52
 * @author jhavlin
53
 */
54
@ServiceProvider(service = IOProviderBase.class, position = 100)
55
public class NbIOProviderBase extends IOProviderBase {
56
57
    @Override
58
    public String getName() {
59
        return SharedProvider.getInstance().getName();
60
    }
61
62
    @Override
63
    public InputOutputBase getIO(String name, boolean newIO) {
64
        return SharedProvider.getInstance().getIO(name, newIO, new Action[0],
65
                null);
66
    }
67
}
(-)a/core.output2/src/org/netbeans/core/output2/NbWriter.java (-1 / +64 lines)
Lines 47-53 Link Here
47
import org.openide.windows.OutputWriter;
47
import org.openide.windows.OutputWriter;
48
import org.openide.windows.OutputListener;
48
import org.openide.windows.OutputListener;
49
import java.io.IOException;
49
import java.io.IOException;
50
import java.util.Collections;
51
import java.util.Set;
52
import org.openide.io.base.ExtendableWriter;
53
import org.openide.io.base.InputOutputBase;
54
import org.openide.io.base.OutputEventBase;
55
import org.openide.io.base.OutputListenerBase;
50
import org.openide.util.Exceptions;
56
import org.openide.util.Exceptions;
57
import org.openide.util.Lookup;
58
import org.openide.windows.InputOutput;
59
import org.openide.windows.OutputEvent;
51
60
52
61
53
/**
62
/**
Lines 57-63 Link Here
57
 * which it replaces when reset() is called;  an OutputDocument is implemented directly over an 
66
 * which it replaces when reset() is called;  an OutputDocument is implemented directly over an 
58
 * OutWriter, so the immutable OutWriter lasts until the OutputDocument is destroyed.
67
 * OutWriter, so the immutable OutWriter lasts until the OutputDocument is destroyed.
59
 */
68
 */
60
class NbWriter extends OutputWriter {
69
class NbWriter extends OutputWriter implements ExtendableWriter {
61
    private final NbIO owner;
70
    private final NbIO owner;
62
    /**
71
    /**
63
     * Make an output writer.
72
     * Make an output writer.
Lines 165-168 Link Here
165
            ((OutWriter) out).println(s);
174
            ((OutWriter) out).println(s);
166
        }
175
        }
167
    }
176
    }
177
178
    @Override
179
    public Set<Class<?>> getExtendingTypes() {
180
        return Collections.<Class<?>>singleton(OutputListenerBase.class);
181
    }
182
183
    @Override
184
    public void println(String s, Lookup extendingInfo) throws IOException {
185
        println(s, extendingInfo, false);
186
    }
187
188
    @Override
189
    public void println(String s, Lookup extendingInfo, boolean important)
190
            throws IOException {
191
        OutputListenerBase olb = extendingInfo.lookup(OutputListenerBase.class);
192
        if (olb != null) {
193
            OutputListener ol = convertToOutputListener(olb);
194
            println(s, ol, important);
195
        } else {
196
            println(s);
197
        }
198
    }
199
200
    private OutputListener convertToOutputListener(final OutputListenerBase l) {
201
        return new OutputListener() {
202
203
            @Override
204
            public void outputLineSelected(OutputEvent ev) {
205
                l.outputLineSelected(convertToOutputEventBase(ev));
206
            }
207
208
            @Override
209
            public void outputLineAction(OutputEvent ev) {
210
                l.outputLineAction(convertToOutputEventBase(ev));
211
            }
212
213
            @Override
214
            public void outputLineCleared(OutputEvent ev) {
215
                l.outputLineCleared(convertToOutputEventBase(ev));
216
            }
217
        };
218
    }
219
220
    private OutputEventBase convertToOutputEventBase(final OutputEvent e) {
221
        InputOutput origIO = e.getInputOutput();
222
        InputOutputBase src = origIO instanceof InputOutputBase
223
                ? (InputOutputBase) origIO : owner;
224
        return new OutputEventBase(src) {
225
            @Override
226
            public String getLine() {
227
                return e.getLine();
228
            }
229
        };
230
    }
168
}
231
}
(-)a/core.output2/src/org/netbeans/core/output2/SharedProvider.java (+119 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2014 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.core.output2;
43
44
import java.util.WeakHashMap;
45
import javax.swing.Action;
46
import org.openide.windows.IOContainer;
47
48
/**
49
 * Shared provider for both the original (org.openide.io/org.openide.windows)
50
 * and the base (org.openide.io.base) APIs.
51
 *
52
 * @author jhavlin
53
 */
54
public class SharedProvider {
55
56
    private static final WeakHashMap<IOContainer, PairMap> containerPairMaps
57
            = new WeakHashMap<IOContainer, PairMap>();
58
    private static final String NAME = "output2"; // NOI18N
59
60
    private static class SingletonHolder {
61
62
        static SharedProvider INSTANCE = new SharedProvider();
63
    }
64
65
    public static SharedProvider getInstance() {
66
        return SingletonHolder.INSTANCE;
67
    }
68
69
    private SharedProvider() {
70
        System.out.println("x");
71
    }
72
73
    public String getName() {
74
        return NAME;
75
    }
76
77
    NbIO getIO(String name, boolean newIO,
78
            Action[] toolbarActions, IOContainer ioContainer) {
79
        if (Controller.LOG) {
80
            Controller.log("GETIO: " + name + " new:" + newIO);
81
        }
82
        IOContainer realIoContainer = ioContainer == null
83
                ? IOContainer.getDefault() : ioContainer;
84
        NbIO result;
85
        synchronized (containerPairMaps) {
86
            PairMap namesToIos = containerPairMaps.get(realIoContainer);
87
            result = namesToIos != null ? namesToIos.get(name) : null;
88
        }
89
        if (result == null || newIO) {
90
            result = new NbIO(name, toolbarActions, realIoContainer);
91
            synchronized (containerPairMaps) {
92
                PairMap namesToIos = containerPairMaps.get(realIoContainer);
93
                if (namesToIos == null) {
94
                    namesToIos = new PairMap();
95
                    containerPairMaps.put(realIoContainer, namesToIos);
96
                }
97
                namesToIos.add(name, result);
98
            }
99
            NbIO.post(new IOEvent(result, IOEvent.CMD_CREATE, newIO));
100
        }
101
        return result;
102
    }
103
104
    static void dispose(NbIO io) {
105
        IOContainer ioContainer = io.getIOContainer();
106
        if (ioContainer == null) {
107
            ioContainer = IOContainer.getDefault();
108
        }
109
        synchronized (containerPairMaps) {
110
            PairMap namesToIos = containerPairMaps.get(ioContainer);
111
            if (namesToIos != null) {
112
                namesToIos.remove(io);
113
                if (namesToIos.isEmpty()) {
114
                    containerPairMaps.remove(ioContainer);
115
                }
116
            }
117
        }
118
    }
119
}
(-)a/nbbuild/build.properties (+1 lines)
Lines 176-181 Link Here
176
    core.netigso,\
176
    core.netigso,\
177
    o.n.swing.outline,\
177
    o.n.swing.outline,\
178
    o.n.swing.tabcontrol,\
178
    o.n.swing.tabcontrol,\
179
    openide.io.base,\
179
    editor.indent,\
180
    editor.indent,\
180
    editor.bracesmatching,\
181
    editor.bracesmatching,\
181
    j2ee.metadata,\
182
    j2ee.metadata,\
(-)a/nbbuild/cluster.properties (+1 lines)
Lines 250-255 Link Here
250
        openide.filesystems.compat8,\
250
        openide.filesystems.compat8,\
251
        openide.filesystems.nb,\
251
        openide.filesystems.nb,\
252
        openide.io,\
252
        openide.io,\
253
	openide.io.base,\
253
        openide.loaders,\
254
        openide.loaders,\
254
        openide.nodes,\
255
        openide.nodes,\
255
        openide.options,\
256
        openide.options,\
(-)a/openide.io.base/apichanges.xml (+139 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!--
3
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4
5
Copyright 2014 Oracle and/or its affiliates. All rights reserved.
6
7
Oracle and Java are registered trademarks of Oracle and/or its affiliates.
8
Other names may be trademarks of their respective owners.
9
10
The contents of this file are subject to the terms of either the GNU
11
General Public License Version 2 only ("GPL") or the Common
12
Development and Distribution License("CDDL") (collectively, the
13
"License"). You may not use this file except in compliance with the
14
License. You can obtain a copy of the License at
15
http://www.netbeans.org/cddl-gplv2.html
16
or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
17
specific language governing permissions and limitations under the
18
License.  When distributing the software, include this License Header
19
Notice in each file and include the License file at
20
nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
21
particular file as subject to the "Classpath" exception as provided
22
by Oracle in the GPL Version 2 section of the License file that
23
accompanied this code. If applicable, add the following below the
24
License Header, with the fields enclosed by brackets [] replaced by
25
your own identifying information:
26
"Portions Copyrighted [year] [name of copyright owner]"
27
28
If you wish your version of this file to be governed by only the CDDL
29
or only the GPL Version 2, indicate your decision by adding
30
"[Contributor] elects to include this software in this distribution
31
under the [CDDL or GPL Version 2] license." If you do not indicate a
32
single choice of license, a recipient has the option to distribute
33
your version of this file under either the CDDL, the GPL Version 2 or
34
to extend the choice of license to its licensees as provided above.
35
However, if you add GPL Version 2 code and therefore, elected the GPL
36
Version 2 license, then the option applies only if the new code is
37
made subject to such option by the copyright holder.
38
39
Contributor(s):
40
41
Portions Copyrighted 2014 Sun Microsystems, Inc.
42
-->
43
44
<?xml-stylesheet type="text/xml" href="../nbbuild/javadoctools/apichanges.xsl"?>
45
<!DOCTYPE apichanges PUBLIC "-//NetBeans//DTD API changes list 1.0//EN" "../nbbuild/javadoctools/apichanges.dtd">
46
47
<!--
48
49
INFO FOR PEOPLE ADDING CHANGES:
50
51
Check the DTD (apichanges.dtd) for details on the syntax. You do not
52
need to regenerate the HTML, as this is part of Javadoc generation; just
53
change the XML. Rough syntax of a change (several parts optional):
54
55
<change>
56
    <api name="compiler"/>
57
    <summary>Some brief description here, can use <b>XHTML</b></summary>
58
    <version major="1" minor="99"/>
59
    <date day="13" month="6" year="2001"/>
60
    <author login="jrhacker"/>
61
    <compatibility addition="yes"/>
62
    <description>
63
        The main description of the change here.
64
        Again can use full <b>XHTML</b> as needed.
65
    </description>
66
    <class package="org.openide.compiler" name="DoWhatIWantCompiler"/>
67
    <issue number="14309"/>
68
</change>
69
70
Also permitted elements: <package>, <branch>. <version> is API spec
71
version, recommended for all new changes. <compatibility> should say
72
if things were added/modified/deprecated/etc. and give all information
73
related to upgrading old code. List affected top-level classes and
74
link to issue numbers if applicable. See the DTD for more details.
75
76
Changes need not be in any particular order, they are sorted in various
77
ways by the stylesheet anyway.
78
79
Dates are assumed to mean "on the trunk". If you *also* make the same
80
change on a stabilization branch, use the <branch> tag to indicate this
81
and explain why the change was made on a branch in the <description>.
82
83
Please only change this file on the trunk! Rather: you can change it
84
on branches if you want, but these changes will be ignored; only the
85
trunk version of this file is important.
86
87
Deprecations do not count as incompatible, assuming that code using the
88
deprecated calls continues to see their documented behavior. But do
89
specify deprecation="yes" in <compatibility>.
90
91
This file is not a replacement for Javadoc: it is intended to list changes,
92
not describe the complete current behavior, for which ordinary documentation
93
is the proper place.
94
95
-->
96
97
<apichanges>
98
99
    <!-- First, a list of API names you may use: -->
100
    <apidefs>
101
        <apidef name="io.base">Base I/O APIs</apidef>
102
        <!-- etc. -->
103
    </apidefs>
104
105
    <!-- ACTUAL CHANGES BEGIN HERE: -->
106
107
    <changes>
108
109
        <!-- Start here... -->
110
111
    </changes>
112
113
    <!-- Now the surrounding HTML text and document structure: -->
114
115
    <htmlcontents>
116
<!-- Generated from apichanges.xml -->
117
    <head>
118
      <title>Change History for the Base I/O APIs</title>
119
      <link rel="stylesheet" href="prose.css" type="text/css"/>
120
    </head>
121
    <body>
122
123
<p class="overviewlink"><a href="@TOP@/overview-summary.html">Overview</a></p>
124
125
<h1>Introduction</h1>
126
127
<p>This document lists changes made to the <a href="@TOP@/overview-summary.html">Base I/O APIs</a>.</p>
128
129
<!-- The actual lists of changes, as summaries and details: -->
130
      <hr/>
131
      <standard-changelists module-code-name="org.openide.io.base/1"/>
132
133
      <hr/><p>@FOOTER@</p>
134
135
    </body>
136
  </htmlcontents>
137
138
</apichanges>
139
(-)a/openide.io.base/arch.xml (+1115 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE api-answers PUBLIC "-//NetBeans//DTD Arch Answers//EN" "../nbbuild/antsrc/org/netbeans/nbbuild/Arch.dtd" [
3
  <!ENTITY api-questions SYSTEM "../nbbuild/antsrc/org/netbeans/nbbuild/Arch-api-questions.xml">
4
]>
5
6
<api-answers
7
  question-version="1.29"
8
  author="yourname@netbeans.org"
9
>
10
11
  &api-questions;
12
13
14
<!--
15
        <question id="arch-overall" when="init">
16
            Describe the overall architecture.
17
            <hint>
18
            What will be API for
19
            <a href="http://wiki.netbeans.org/API_Design#Separate_API_for_clients_from_support_API">
20
                clients and what support API</a>?
21
            What parts will be pluggable?
22
            How will plug-ins be registered? Please use <code>&lt;api type="export"/&gt;</code>
23
            to describe your general APIs and specify their
24
            <a href="http://wiki.netbeans.org/API_Stability#Private">
25
            stability categories</a>.
26
            If possible please provide simple diagrams.
27
            </hint>
28
        </question>
29
-->
30
 <answer id="arch-overall">
31
      <api
32
        name="BaseInputOutputAPI"
33
        group="java"
34
        type="export"
35
        category="devel"
36
        url="@org-openide-io-base@/org/openide/io/base/package-summary.html"
37
    >
38
        <p>
39
            Just a base API/SPI for defining the output window.
40
        </p>
41
    </api>
42
 </answer>
43
44
45
46
<!--
47
        <question id="arch-quality" when="init">
48
            How will the <a href="http://www.netbeans.org/community/guidelines/q-evangelism.html">quality</a>
49
            of your code be tested and
50
            how are future regressions going to be prevented?
51
            <hint>
52
            What kind of testing do
53
            you want to use? How much functionality, in which areas,
54
            should be covered by the tests? How you find out that your
55
            project was successful?
56
            </hint>
57
        </question>
58
-->
59
 <answer id="arch-quality">
60
  <p>
61
   Too little code to test.
62
  </p>
63
 </answer>
64
65
66
67
<!--
68
        <question id="arch-time" when="init">
69
            What are the time estimates of the work?
70
            <hint>
71
            Please express your estimates of how long the design, implementation,
72
            stabilization are likely to last. How many people will be needed to
73
            implement this and what is the expected milestone by which the work should be
74
            ready?
75
            </hint>
76
        </question>
77
-->
78
 <answer id="arch-time">
79
  <p>
80
   Done.
81
  </p>
82
 </answer>
83
84
85
86
<!--
87
        <question id="arch-usecases" when="init">
88
            <hint>
89
                Content of this answer will be displayed as part of page at
90
                http://www.netbeans.org/download/dev/javadoc/usecases.html
91
                You can use tags &lt;usecase name="name&gt; regular html description &lt;/usecase&gt;
92
                and if you want to use an URL you can prefix if with @TOP@ to begin
93
                at the root of your javadoc
94
            </hint>
95
96
            Describe the main <a href="http://wiki.netbeans.org/API_Design#The_Importance_of_Being_Use_Case_Oriented">
97
            use cases</a> of the new API. Who will use it under
98
            what circumstances? What kind of code would typically need to be written
99
            to use the module?
100
        </question>
101
-->
102
 <answer id="arch-usecases">
103
    <p>There is an SPI but additional implementations are not expected. The API is most important.</p>
104
    <p>
105
     Simple usage example:
106
    </p>
107
  <pre>
108
  <span class="type">InputOutput</span> <span class="variable-name">io</span> = IOProviderBase.getDefault().getIO(<span class="string">"My Window"</span>, true);
109
  io.select();
110
  <span class="type">OutputWriter</span> <span class="variable-name">w</span> = io.getOut();
111
  w.println(<span class="string">"Line of plain text."</span>);
112
  <span class="type">OutputListenerBase</span> <span class="variable-name">listener</span> = <span class="keyword">new</span> <span class="type">OutputListenerBase</span>() {
113
      <span class="keyword">public</span> <span class="type">void</span> <span class="function-name">outputLineAction</span>(<span class="type">OutputEventBase</span> <span class="variable-name">ev</span>) {
114
          StatusDisplayer.getDefault().setStatusText(<span class="string">"Hyperlink clicked!"</span>);
115
      }
116
      <span class="keyword">public</span> <span class="type">void</span> <span class="function-name">outputLineSelected</span>(<span class="type">OutputEventBase</span> <span class="variable-name">ev</span>) {
117
          <span class="comment">// Let's not do anything special.
118
  </span>    }
119
      <span class="keyword">public</span> <span class="type">void</span> <span class="function-name">outputLineCleared</span>(<span class="type">OutputEventBase</span> <span class="variable-name">ev</span>) {
120
          <span class="comment">// Leave it blank, no state to remove.
121
  </span>    }
122
  };
123
  InstanceContent ic = new InstanceContent();
124
  if (ow.getExtendingTypes().contains(OutputListenerBase.class)) {
125
    ic.add(istener);
126
  }
127
  w.println(<span class="string">"Line of hyperlinked text."</span>, new AbstractLookup(ic), true);
128
  </pre>
129
 </answer>
130
131
132
133
<!--
134
        <question id="arch-what" when="init">
135
            What is this project good for?
136
            <hint>
137
            Please provide here a few lines describing the project,
138
            what problem it should solve, provide links to documentation,
139
            specifications, etc.
140
            </hint>
141
        </question>
142
-->
143
 <answer id="arch-what">
144
  <p>
145
   The Base Input/Output APIs is a small API module
146
   which contains <code>InputOutputBase</code> and related interfaces used in
147
   driving the Output Window. The normal implementation is
148
   <code>org.netbeans.core.output2</code>.
149
  </p>
150
  <p>
151
   The API was extracted from module openide.io, which depends on some
152
   GUI-related classes. This module has no such dependencies.
153
  </p>
154
 </answer>
155
156
157
158
<!--
159
        <question id="arch-where" when="impl">
160
            Where one can find sources for your module?
161
            <hint>
162
                Please provide link to the Hg web client at
163
                http://hg.netbeans.org/
164
                or just use tag defaultanswer generate='here'
165
            </hint>
166
        </question>
167
-->
168
 <answer id="arch-where">
169
  <defaultanswer generate='here' />
170
 </answer>
171
172
173
174
<!--
175
        <question id="compat-deprecation" when="init">
176
            How the introduction of your project influences functionality
177
            provided by previous version of the product?
178
            <hint>
179
            If you are planning to deprecate/remove/change any existing APIs,
180
            list them here accompanied with the reason explaining why you
181
            are doing so.
182
            </hint>
183
        </question>
184
-->
185
 <answer id="compat-deprecation">
186
  <p>
187
   This module is an alternative for org.openide.io, it has similar goals, but
188
   less dependencies.
189
  </p>
190
 </answer>
191
192
193
194
<!--
195
        <question id="compat-i18n" when="impl">
196
            Is your module correctly internationalized?
197
            <hint>
198
            Correct internationalization means that it obeys instructions
199
            at <a href="http://www.netbeans.org/download/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/i18n-branding.html">
200
            NetBeans I18N pages</a>.
201
            </hint>
202
        </question>
203
-->
204
 <answer id="compat-i18n">
205
  <p>
206
   Yes.
207
  </p>
208
 </answer>
209
210
211
212
<!--
213
        <question id="compat-standards" when="init">
214
            Does the module implement or define any standards? Is the
215
            implementation exact or does it deviate somehow?
216
        </question>
217
-->
218
 <answer id="compat-standards">
219
  <p>
220
   The module defines an API.
221
  </p>
222
 </answer>
223
224
225
226
<!--
227
        <question id="compat-version" when="impl">
228
            Can your module coexist with earlier and future
229
            versions of itself? Can you correctly read all old settings? Will future
230
            versions be able to read your current settings? Can you read
231
            or politely ignore settings stored by a future version?
232
233
            <hint>
234
            Very helpful for reading settings is to store version number
235
            there, so future versions can decide whether how to read/convert
236
            the settings and older versions can ignore the new ones.
237
            </hint>
238
        </question>
239
-->
240
 <answer id="compat-version">
241
  <p>
242
   N/A
243
  </p>
244
 </answer>
245
246
247
248
<!--
249
        <question id="dep-jre" when="final">
250
            Which version of JRE do you need (1.2, 1.3, 1.4, etc.)?
251
            <hint>
252
            It is expected that if your module runs on 1.x that it will run
253
            on 1.x+1 if no, state that please. Also describe here cases where
254
            you run different code on different versions of JRE and why.
255
            </hint>
256
        </question>
257
-->
258
 <answer id="dep-jre">
259
  <p>
260
   1.7
261
  </p>
262
 </answer>
263
264
265
266
<!--
267
        <question id="dep-jrejdk" when="final">
268
            Do you require the JDK or is the JRE enough?
269
        </question>
270
-->
271
 <answer id="dep-jrejdk">
272
  <p>
273
   JRE
274
  </p>
275
 </answer>
276
277
278
279
<!--
280
        <question id="dep-nb" when="init">
281
            What other NetBeans projects and modules does this one depend on?
282
            <hint>
283
            Depending on other NetBeans projects influnces the ability of
284
            users of your work to customize their own branded version of
285
            NetBeans by enabling and disabling some modules. Too
286
            much dependencies restrict this kind of customization. If that
287
            is your case, then you may want to split your functionality into
288
            pieces of autoload, eager and regular modules which can be
289
            enabled independently. Usually the answer to this question
290
            is generated from your <code>project.xml</code> file, but
291
            if it is not guessed correctly, you can suppress it by
292
            specifying &lt;defaultanswer generate="none"/&gt; and
293
            write here your own. Please describe such projects as imported APIs using
294
            the <code>&lt;api name="identification" type="import or export" category="stable" url="where is the description" /&gt;</code>.
295
            By doing this information gets listed in the summary page of your
296
            javadoc.
297
            </hint>
298
        </question>
299
-->
300
 <answer id="dep-nb">
301
  <defaultanswer generate='here' />
302
 </answer>
303
304
305
306
<!--
307
        <question id="dep-non-nb" when="init">
308
            What other projects outside NetBeans does this one depend on?
309
310
            <hint>
311
            Depending on 3rd party libraries is always problematic,
312
            especially if they are not open source, as that complicates
313
            the licensing scheme of NetBeans. Please enumerate your
314
            external dependencies here, so it is correctly understood since
315
            the begining what are the legal implications of your project.
316
            Also please note that
317
            some non-NetBeans projects are packaged as NetBeans modules
318
            (see <a href="http://libs.netbeans.org/">libraries</a>) and
319
            it is preferred to use this approach when more modules may
320
            depend and share such third-party libraries.
321
            </hint>
322
        </question>
323
-->
324
 <answer id="dep-non-nb">
325
  <p>
326
   None.
327
  </p>
328
 </answer>
329
330
331
332
<!--
333
        <question id="dep-platform" when="init">
334
            On which platforms does your module run? Does it run in the same
335
            way on each?
336
            <hint>
337
            If you plan any dependency on OS or any usage of native code,
338
            please describe why you are doing so and describe how you envision
339
            to enforce the portability of your code.
340
            Please note that there is a support for <a href="http://www.netbeans.org/download/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/api.html#how-os-specific">OS conditionally
341
            enabled modules</a> which together with autoload/eager modules
342
            can allow you to enable to provide the best OS aware support
343
            on certain OSes while providing compatibility bridge on the not
344
            supported ones.
345
            Also please list the supported
346
            OSes/HW platforms and mentioned the lovest version of JDK required
347
            for your project to run on. Also state whether JRE is enough or
348
            you really need JDK.
349
            </hint>
350
        </question>
351
-->
352
 <answer id="dep-platform">
353
  <p>
354
   Any
355
  </p>
356
 </answer>
357
358
359
360
<!--
361
        <question id="deploy-dependencies" when="final">
362
            What do other modules need to do to declare a dependency on this one,
363
            in addition to or instead of the normal module dependency declaration
364
            (e.g. tokens to require)?
365
            <hint>
366
                Provide a sample of the actual lines you would add to a module manifest
367
                to declare a dependency, for example OpenIDE-Module-Requires: some.token.
368
                If other modules should not depend on this module, or should just use a
369
                simple regular module dependency, you can just answer "nothing". If you
370
                intentionally expose a semistable API to clients using implementation
371
                dependencies, you should mention that here (but there is no need to give
372
                an example of usage).
373
            </hint>
374
        </question>
375
-->
376
 <answer id="deploy-dependencies">
377
  <p>
378
   You will very likely also want to declare
379
  </p>
380
  <pre>OpenIDE-Module-Requires: org.openide.io.base.IOProviderBase</pre>
381
  <p>to ensure that an Output Window implementation is in fact enabled.</p>
382
 </answer>
383
384
385
386
<!--
387
        <question id="deploy-jar" when="impl">
388
            Do you deploy just module JAR file(s) or other files as well?
389
            <hint>
390
            Usually a module consist of one JAR file (perhaps with Class-Path
391
            extensions) and also a configuration file that enables it. If you
392
            have any other files, use
393
            &lt;api group="java.io.File" name="yourname" type="export" category="friend"&gt;...&lt;/api&gt;
394
            to define the location, name and stability of your files (of course
395
            changing "yourname" and "friend" to suit your needs).
396
397
            If it uses more than one JAR, describe where they are located, how
398
            they refer to each other.
399
            If it consist of module JAR(s) and other files, please describe
400
            what is their purpose, why other files are necessary. Please
401
            make sure that installation/uninstallation leaves the system
402
            in state as it was before installation.
403
            </hint>
404
        </question>
405
-->
406
 <answer id="deploy-jar">
407
  <p>
408
   Just the module JAR.
409
  </p>
410
 </answer>
411
412
413
414
<!--
415
        <question id="deploy-nbm" when="impl">
416
            Can you deploy an NBM via the Update Center?
417
            <hint>
418
            If not why?
419
            </hint>
420
        </question>
421
-->
422
 <answer id="deploy-nbm">
423
  <p>
424
   Yes
425
  </p>
426
 </answer>
427
428
429
430
<!--
431
        <question id="deploy-packages" when="init">
432
            Are packages of your module made inaccessible by not declaring them
433
            public?
434
435
            <hint>
436
            By default NetBeans build harness treats all packages are private.
437
            If you export some of them - either as public or friend packages,
438
            you should have a reason. If the reason is described elsewhere
439
            in this document, you can ignore this question.
440
            </hint>
441
        </question>
442
-->
443
 <answer id="deploy-packages">
444
  <p>
445
   No; only API classes are public.
446
  </p>
447
 </answer>
448
449
450
451
<!--
452
        <question id="deploy-shared" when="final">
453
            Do you need to be installed in the shared location only, or in the user directory only,
454
            or can your module be installed anywhere?
455
            <hint>
456
            Installation location shall not matter, if it does explain why.
457
            Consider also whether <code>InstalledFileLocator</code> can help.
458
            </hint>
459
        </question>
460
-->
461
 <answer id="deploy-shared">
462
  <p>
463
   Anywhere
464
  </p>
465
 </answer>
466
467
468
469
<!--
470
        <question id="exec-ant-tasks" when="impl">
471
            Do you define or register any ant tasks that other can use?
472
473
            <hint>
474
            If you provide an ant task that users can use, you need to be very
475
            careful about its syntax and behaviour, as it most likely forms an
476
	          API for end users and as there is a lot of end users, their reaction
477
            when such API gets broken can be pretty strong.
478
            </hint>
479
        </question>
480
-->
481
 <answer id="exec-ant-tasks">
482
  <p>
483
   No
484
  </p>
485
 </answer>
486
487
488
489
<!--
490
        <question id="exec-classloader" when="impl">
491
            Does your code create its own class loader(s)?
492
            <hint>
493
            A bit unusual. Please explain why and what for.
494
            </hint>
495
        </question>
496
-->
497
 <answer id="exec-classloader">
498
  <p>
499
   No
500
  </p>
501
 </answer>
502
503
504
505
<!--
506
        <question id="exec-component" when="impl">
507
            Is execution of your code influenced by any (string) property
508
            of any of your components?
509
510
            <hint>
511
            Often <code>JComponent.getClientProperty</code>, <code>Action.getValue</code>
512
            or <code>PropertyDescriptor.getValue</code>, etc. are used to influence
513
            a behavior of some code. This of course forms an interface that should
514
            be documented. Also if one depends on some interface that an object
515
            implements (<code>component instanceof Runnable</code>) that forms an
516
            API as well.
517
            </hint>
518
        </question>
519
-->
520
 <answer id="exec-component">
521
  <p>
522
   No
523
  </p>
524
 </answer>
525
526
527
528
<!--
529
        <question id="exec-introspection" when="impl">
530
            Does your module use any kind of runtime type information (<code>instanceof</code>,
531
            work with <code>java.lang.Class</code>, etc.)?
532
            <hint>
533
            Check for cases when you have an object of type A and you also
534
            expect it to (possibly) be of type B and do some special action. That
535
            should be documented. The same applies on operations in meta-level
536
            (Class.isInstance(...), Class.isAssignableFrom(...), etc.).
537
            </hint>
538
        </question>
539
-->
540
 <answer id="exec-introspection">
541
  <p>
542
   No
543
  </p>
544
 </answer>
545
546
547
548
<!--
549
        <question id="exec-privateaccess" when="final">
550
            Are you aware of any other parts of the system calling some of 
551
            your methods by reflection?
552
            <hint>
553
            If so, describe the "contract" as an API. Likely private or friend one, but
554
            still API and consider rewrite of it.
555
            </hint>
556
        </question>
557
-->
558
 <answer id="exec-privateaccess">
559
  <p>
560
   No
561
  </p>
562
 </answer>
563
564
565
566
<!--
567
        <question id="exec-process" when="impl">
568
            Do you execute an external process from your module? How do you ensure
569
            that the result is the same on different platforms? Do you parse output?
570
            Do you depend on result code?
571
            <hint>
572
            If you feed an input, parse the output please declare that as an API.
573
            </hint>
574
        </question>
575
-->
576
 <answer id="exec-process">
577
  <p>
578
   No
579
  </p>
580
 </answer>
581
582
583
584
<!--
585
        <question id="exec-property" when="impl">
586
            Is execution of your code influenced by any environment or
587
            Java system (<code>System.getProperty</code>) property?
588
            On a similar note, is there something interesting that you
589
            pass to <code>java.util.logging.Logger</code>? Or do you observe
590
            what others log?
591
            <hint>
592
            If there is a property that can change the behavior of your 
593
            code, somebody will likely use it. You should describe what it does 
594
            and the <a href="http://wiki.netbeans.org/API_Stability">stability category</a>
595
            of this API. You may use
596
            <pre>
597
                &lt;api type="export" group="property" name="id" category="private" url="http://..."&gt;
598
                    description of the property, where it is used, what it influence, etc.
599
                &lt;/api&gt;
600
            </pre>
601
            </hint>
602
        </question>
603
-->
604
 <answer id="exec-property">
605
  <p>
606
   No
607
  </p>
608
 </answer>
609
610
611
612
<!--
613
        <question id="exec-reflection" when="impl">
614
            Does your code use Java Reflection to execute other code?
615
            <hint>
616
            This usually indicates a missing or insufficient API in the other
617
            part of the system. If the other side is not aware of your dependency
618
            this contract can be easily broken.
619
            </hint>
620
        </question>
621
-->
622
 <answer id="exec-reflection">
623
  <p>
624
   No
625
  </p>
626
 </answer>
627
628
629
630
<!--
631
        <question id="exec-threading" when="init">
632
            What threading models, if any, does your module adhere to? How the
633
            project behaves with respect to threading?
634
            <hint>
635
                Is your API threadsafe? Can it be accessed from any threads or
636
                just from some dedicated ones? Any special relation to AWT and
637
                its Event Dispatch thread? Also
638
                if your module calls foreign APIs which have a specific threading model,
639
                indicate how you comply with the requirements for multithreaded access
640
                (synchronization, mutexes, etc.) applicable to those APIs.
641
                If your module defines any APIs, or has complex internal structures
642
                that might be used from multiple threads, declare how you protect
643
                data against concurrent access, race conditions, deadlocks, etc.,
644
                and whether such rules are enforced by runtime warnings, errors, assertions, etc.
645
                Examples: a class might be non-thread-safe (like Java Collections); might
646
                be fully thread-safe (internal locking); might require access through a mutex
647
                (and may or may not automatically acquire that mutex on behalf of a client method);
648
                might be able to run only in the event queue; etc.
649
                Also describe when any events are fired: synchronously, asynchronously, etc.
650
                Ideas: <a href="http://core.netbeans.org/proposals/threading/index.html#recommendations">Threading Recommendations</a> (in progress)
651
            </hint>
652
        </question>
653
-->
654
 <answer id="exec-threading">
655
  <p>
656
   Should be thread safe.
657
  </p>
658
 </answer>
659
660
661
662
<!--
663
        <question id="format-clipboard" when="impl">
664
            Which data flavors (if any) does your code read from or insert to
665
            the clipboard (by access to clipboard on means calling methods on <code>java.awt.datatransfer.Transferable</code>?
666
667
            <hint>
668
            Often Node's deal with clipboard by usage of <code>Node.clipboardCopy, Node.clipboardCut and Node.pasteTypes</code>.
669
            Check your code for overriding these methods.
670
            </hint>
671
        </question>
672
-->
673
 <answer id="format-clipboard">
674
  <p>
675
   Plain Unicode text only.
676
  </p>
677
 </answer>
678
679
680
681
<!--
682
        <question id="format-dnd" when="impl">
683
            Which protocols (if any) does your code understand during Drag &amp; Drop?
684
            <hint>
685
            Often Node's deal with clipboard by usage of <code>Node.drag, Node.getDropType</code>.
686
            Check your code for overriding these methods. Btw. if they are not overridden, they
687
            by default delegate to <code>Node.clipboardCopy, Node.clipboardCut and Node.pasteTypes</code>.
688
            </hint>
689
        </question>
690
-->
691
 <answer id="format-dnd">
692
  <p>
693
   N/A
694
  </p>
695
 </answer>
696
697
698
699
<!--
700
        <question id="format-types" when="impl">
701
            Which protocols and file formats (if any) does your module read or write on disk,
702
            or transmit or receive over the network? Do you generate an ant build script?
703
            Can it be edited and modified?
704
705
            <hint>
706
            <p>
707
            Files can be read and written by other programs, modules and users. If they influence
708
            your behaviour, make sure you either document the format or claim that it is a private
709
            api (using the &lt;api&gt; tag).
710
            </p>
711
712
            <p>
713
            If you generate an ant build file, this is very likely going to be seen by end users and
714
            they will be attempted to edit it. You should be ready for that and provide here a link
715
            to documentation that you have for such purposes and also describe how you are going to
716
            understand such files during next release, when you (very likely) slightly change the
717
            format.
718
            </p>
719
            </hint>
720
        </question>
721
-->
722
 <answer id="format-types">
723
  <p>
724
   None
725
  </p>
726
 </answer>
727
728
729
730
<!--
731
        <question id="lookup-lookup" when="init">
732
            Does your module use <code>org.openide.util.Lookup</code>
733
            or any similar technology to find any components to communicate with? Which ones?
734
735
            <hint>
736
            NetBeans is build around a generic registry of services called
737
            lookup. It is preferable to use it for registration and discovery
738
            if possible. See
739
            <a href="http://www.netbeans.org/download/dev/javadoc/org-openide-util/org/openide/util/lookup/doc-files/index.html">
740
            The Solution to Comunication Between Components
741
            </a>. If you do not plan to use lookup and insist usage
742
            of other solution, then please describe why it is not working for
743
            you.
744
            <br/>
745
            When filling the final version of your arch document, please
746
            describe the interfaces you are searching for, where
747
            are defined, whether you are searching for just one or more of them,
748
            if the order is important, etc. Also classify the stability of such
749
            API contract. Use &lt;api group=&amp;lookup&amp; /&gt; tag, so
750
            your information gets listed in the summary page of your javadoc.
751
            </hint>
752
        </question>
753
-->
754
 <answer id="lookup-lookup">
755
  <code>IOProviderBase.getDefault()</code> asks lookup for the first instance
756
  of itself. This is normally provided by <code>org.netbeans.core.output2</code>.
757
 </answer>
758
759
760
761
<!--
762
        <question id="lookup-register" when="final">
763
            Do you register anything into lookup for other code to find?
764
            <hint>
765
            Do you register using layer file or using a declarative annotation such as <code>@ServiceProvider</code>?
766
            Who is supposed to find your component?
767
            </hint>
768
        </question>
769
-->
770
 <answer id="lookup-register">
771
  <p>
772
   No
773
  </p>
774
 </answer>
775
776
777
778
<!--
779
        <question id="lookup-remove" when="final">
780
            Do you remove entries of other modules from lookup?
781
            <hint>
782
            Why? Of course, that is possible, but it can be dangerous. Is the module
783
            your are masking resource from aware of what you are doing?
784
            </hint>
785
        </question>
786
-->
787
 <answer id="lookup-remove">
788
  <p>
789
   No
790
  </p>
791
 </answer>
792
793
794
795
<!--
796
        <question id="perf-exit" when="final">
797
            Does your module run any code on exit?
798
        </question>
799
-->
800
 <answer id="perf-exit">
801
  <p>
802
   No
803
  </p>
804
 </answer>
805
806
807
808
<!--
809
        <question id="perf-huge_dialogs" when="final">
810
            Does your module contain any dialogs or wizards with a large number of
811
            GUI controls such as combo boxes, lists, trees, or text areas?
812
        </question>
813
-->
814
 <answer id="perf-huge_dialogs">
815
  <p>
816
   No
817
  </p>
818
 </answer>
819
820
821
822
<!--
823
        <question id="perf-limit" when="init">
824
            Are there any hard-coded or practical limits in the number or size of
825
            elements your code can handle?
826
            <hint>
827
                Most of algorithms have increasing memory and speed complexity
828
                with respect to size of data they operate on. What is the critical
829
                part of your project that can be seen as a bottleneck with
830
                respect to speed or required memory? What are the practical
831
                sizes of data you tested your project with? What is your estimate
832
                of potential size of data that would cause visible performance
833
                problems? Is there some kind of check to detect such situation
834
                and prevent "hard" crashes - for example the CloneableEditorSupport
835
                checks for size of a file to be opened in editor
836
                and if it is larger than 1Mb it shows a dialog giving the
837
                user the right to decide - e.g. to cancel or commit suicide.
838
            </hint>
839
        </question>
840
-->
841
 <answer id="perf-limit">
842
  <p>
843
   No
844
  </p>
845
 </answer>
846
847
848
849
<!--
850
        <question id="perf-mem" when="final">
851
            How much memory does your component consume? Estimate
852
            with a relation to the number of windows, etc.
853
        </question>
854
-->
855
 <answer id="perf-mem">
856
  <p>
857
   N/A
858
  </p>
859
 </answer>
860
861
862
863
<!--
864
        <question id="perf-menus" when="final">
865
            Does your module use dynamically updated context menus, or
866
            context-sensitive actions with complicated and slow enablement logic?
867
            <hint>
868
                If you do a lot of tricks when adding actions to regular or context menus, you can significantly
869
                slow down display of the menu, even when the user is not using your action. Pay attention to
870
                actions you add to the main menu bar, and to context menus of foreign nodes or components. If
871
                the action is conditionally enabled, or changes its display dynamically, you need to check the
872
                impact on performance. In some cases it may be more appropriate to make a simple action that is
873
                always enabled but does more detailed checks in a dialog if it is actually run.
874
            </hint>
875
        </question>
876
-->
877
 <answer id="perf-menus">
878
  <p>
879
   No
880
  </p>
881
 </answer>
882
883
884
885
<!--
886
        <question id="perf-progress" when="final">
887
            Does your module execute any long-running tasks?
888
889
            <hint>Long running tasks should never block
890
            AWT thread as it badly hurts the UI
891
            <a href="http://performance.netbeans.org/responsiveness/issues.html">
892
            responsiveness</a>.
893
            Tasks like connecting over
894
            network, computing huge amount of data, compilation
895
            be done asynchronously (for example
896
            using <code>RequestProcessor</code>), definitively it should
897
            not block AWT thread.
898
            </hint>
899
        </question>
900
-->
901
 <answer id="perf-progress">
902
  <p>
903
   No
904
  </p>
905
 </answer>
906
907
908
909
<!--
910
        <question id="perf-scale" when="init">
911
            Which external criteria influence the performance of your
912
            program (size of file in editor, number of files in menu,
913
            in source directory, etc.) and how well your code scales?
914
            <hint>
915
            Please include some estimates, there are other more detailed
916
            questions to answer in later phases of implementation.
917
            </hint>
918
        </question>
919
-->
920
 <answer id="perf-scale">
921
  <p>
922
    Scalability in GUI speed and memory consumption is probably limited only
923
    by the Output Window implementation.
924
  </p>
925
 </answer>
926
927
928
929
<!--
930
        <question id="perf-spi" when="init">
931
            How the performance of the plugged in code will be enforced?
932
            <hint>
933
            If you allow foreign code to be plugged into your own module, how
934
            do you enforce that it will behave correctly and quickly and will not
935
            negatively influence the performance of your own module?
936
            </hint>
937
        </question>
938
-->
939
 <answer id="perf-spi">
940
  <p>
941
   No special behavior.
942
  </p>
943
 </answer>
944
945
946
947
<!--
948
        <question id="perf-startup" when="final">
949
            Does your module run any code on startup?
950
        </question>
951
-->
952
 <answer id="perf-startup">
953
  <p>
954
   No
955
  </p>
956
 </answer>
957
958
959
960
<!--
961
        <question id="perf-wakeup" when="final">
962
            Does any piece of your code wake up periodically and do something
963
            even when the system is otherwise idle (no user interaction)?
964
        </question>
965
-->
966
 <answer id="perf-wakeup">
967
  <p>
968
   No
969
  </p>
970
 </answer>
971
972
973
974
<!--
975
        <question id="resources-file" when="final">
976
            Does your module use <code>java.io.File</code> directly?
977
978
            <hint>
979
            NetBeans provide a logical wrapper over plain files called
980
            <code>org.openide.filesystems.FileObject</code> that
981
            provides uniform access to such resources and is the preferred
982
            way that should be used. But of course there can be situations when
983
            this is not suitable.
984
            </hint>
985
        </question>
986
-->
987
 <answer id="resources-file">
988
   <p>No, but the implementation may.</p>
989
 </answer>
990
991
992
993
<!--
994
        <question id="resources-layer" when="final">
995
            Does your module provide own layer? Does it create any files or
996
            folders in it? What it is trying to communicate by that and with which
997
            components?
998
999
            <hint>
1000
            NetBeans allows automatic and declarative installation of resources
1001
            by module layers. Module register files into appropriate places
1002
            and other components use that information to perform their task
1003
            (build menu, toolbar, window layout, list of templates, set of
1004
            options, etc.).
1005
            </hint>
1006
        </question>
1007
-->
1008
 <answer id="resources-layer">
1009
  <p>
1010
   No
1011
  </p>
1012
 </answer>
1013
1014
1015
1016
<!--
1017
        <question id="resources-mask" when="final">
1018
            Does your module mask/hide/override any resources provided by other modules in
1019
            their layers?
1020
1021
            <hint>
1022
            If you mask a file provided by another module, you probably depend
1023
            on that and do not want the other module to (for example) change
1024
            the file's name. That module shall thus make that file available as an API
1025
            of some stability category.
1026
            </hint>
1027
        </question>
1028
-->
1029
 <answer id="resources-mask">
1030
  <p>
1031
   No
1032
  </p>
1033
 </answer>
1034
1035
1036
1037
<!--
1038
        <question id="resources-preferences" when="final">
1039
            Does your module uses preferences via Preferences API? Does your module use NbPreferences or
1040
            or regular JDK Preferences ? Does it read, write or both ?
1041
            Does it share preferences with other modules ? If so, then why ?
1042
            <hint>
1043
                You may use
1044
                    &lt;api type="export" group="preferences"
1045
                    name="preference node name" category="private"&gt;
1046
                    description of individual keys, where it is used, what it
1047
                    influences, whether the module reads/write it, etc.
1048
                    &lt;/api&gt;
1049
                Due to XML ID restrictions, rather than /org/netbeans/modules/foo give the "name" as org.netbeans.modules.foo.
1050
                Note that if you use NbPreferences this name will then be the same as the code name base of the module.
1051
            </hint>
1052
        </question>
1053
-->
1054
 <answer id="resources-preferences">
1055
  <p>
1056
   No
1057
  </p>
1058
 </answer>
1059
1060
1061
1062
<!--
1063
        <question id="resources-read" when="final">
1064
            Does your module read any resources from layers? For what purpose?
1065
1066
            <hint>
1067
            As this is some kind of intermodule dependency, it is a kind of API.
1068
            Please describe it and classify according to
1069
            <a href="http://wiki.netbeans.org/API_Design#What_is_an_API.3F">
1070
            common stability categories</a>.
1071
            </hint>
1072
        </question>
1073
-->
1074
 <answer id="resources-read">
1075
  <p>
1076
   No
1077
  </p>
1078
 </answer>
1079
1080
1081
1082
<!--
1083
        <question id="security-grant" when="final">
1084
            Does your code grant additional rights to some other code?
1085
            <hint>Avoid using a class loader that adds extra
1086
            permissions to loaded code unless really necessary.
1087
            Also note that your API implementation
1088
            can also expose unneeded permissions to enemy code by
1089
            calling AccessController.doPrivileged().</hint>
1090
        </question>
1091
-->
1092
 <answer id="security-grant">
1093
  <p>
1094
   No
1095
  </p>
1096
 </answer>
1097
1098
1099
1100
<!--
1101
        <question id="security-policy" when="final">
1102
            Does your functionality require modifications to the standard policy file?
1103
            <hint>Your code might pass control to third-party code not
1104
            coming from trusted domains. This could be code downloaded over the
1105
            network or code coming from libraries that are not bundled
1106
            with NetBeans. Which permissions need to be granted to which domains?</hint>
1107
        </question>
1108
-->
1109
 <answer id="security-policy">
1110
  <p>
1111
   No
1112
  </p>
1113
 </answer>
1114
1115
</api-answers>
(-)a/openide.io.base/build.xml (+5 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project basedir="." default="netbeans" name="openide.io.base">
3
    <description>Builds, tests, and runs the project org.openide.io.base</description>
4
    <import file="../nbbuild/templates/projectized.xml"/>
5
</project>
(-)a/openide.io.base/manifest.mf (+5 lines)
Line 0 Link Here
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.openide.io.base/1
3
OpenIDE-Module-Localizing-Bundle: org/openide/io/base/Bundle.properties
4
OpenIDE-Module-Specification-Version: 1.0
5
(-)a/openide.io.base/nbproject/project.properties (+4 lines)
Line 0 Link Here
1
is.autoload=true
2
javac.source=1.6
3
javac.compilerargs=-Xlint -Xlint:-serial
4
javadoc.arch=${basedir}/arch.xml
(-)a/openide.io.base/nbproject/project.xml (+30 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project xmlns="http://www.netbeans.org/ns/project/1">
3
    <type>org.netbeans.modules.apisupport.project</type>
4
    <configuration>
5
        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
6
            <code-name-base>org.openide.io.base</code-name-base>
7
            <module-dependencies>
8
                <dependency>
9
                    <code-name-base>org.openide.util.base</code-name-base>
10
                    <build-prerequisite/>
11
                    <compile-dependency/>
12
                    <run-dependency>
13
                        <specification-version>9.1</specification-version>
14
                    </run-dependency>
15
                </dependency>
16
                <dependency>
17
                    <code-name-base>org.openide.util.lookup</code-name-base>
18
                    <build-prerequisite/>
19
                    <compile-dependency/>
20
                    <run-dependency>
21
                        <specification-version>8.25</specification-version>
22
                    </run-dependency>
23
                </dependency>
24
            </module-dependencies>
25
            <public-packages>
26
                <package>org.openide.io.base</package>
27
            </public-packages>
28
        </data>
29
    </configuration>
30
</project>
(-)a/openide.io.base/src/org/openide/io/base/Bundle.properties (+1 lines)
Line 0 Link Here
1
OpenIDE-Module-Name=Base I/O APIs
(-)a/openide.io.base/src/org/openide/io/base/ExtendableWriter.java (+95 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2014 Sun Microsystems, Inc.
41
 */
42
package org.openide.io.base;
43
44
import java.io.IOException;
45
import java.util.Set;
46
import org.openide.util.Lookup;
47
48
/**
49
 * Complementary API to {@link @PrintWriter} for support of printing lines
50
 * extended by listeners or tags.
51
 *
52
 * @author jhavlin
53
 */
54
public interface ExtendableWriter {
55
56
    /**
57
     * Set of classes or interfaces that are supported by this implementation of
58
     * OutputWriterBase and which can be put to the lookup passed to
59
     * {@link #println(String, Lookup)} or
60
     * {@link #println(String, Lookup, boolean)}.
61
     *
62
     * @return Set of supported classes and interfaces. Can be empty, never
63
     * null.
64
     */
65
    Set<Class<?>> getExtendingTypes();
66
67
    /**
68
     * Print a line which will be displayed as a hyperlink, calling the action
69
     * specifided in the {@link Lookup} object if it is clicked, if the caret
70
     * enters it, or if the enter key is pressed over it.
71
     *
72
     * @param s a string to print to the tab
73
     * @param extendingInfo lookup containing extending info for the text, e.g.
74
     * an output listener and/or an output tag.
75
     * @throws IOException if the string could not be printed
76
     */
77
    void println(String s, Lookup extendingInfo) throws
78
            IOException;
79
80
    /**
81
     * Print a line which will be displayed as a hyperlink, calling the action
82
     * specifided in the {@link Lookup} object if it is clicked, if the caret
83
     * enters it, or if the enter key is pressed over it.
84
     *
85
     * @param s a string to print to the tab
86
     * @param extendingInfo lookup containing extending info for the text, e.g.
87
     * an output listener and/or an output tag.
88
     * @param important mark the line as important. Makes the UI respond
89
     * appropriately, eg. stop the automatic scrolling or highlight the
90
     * hyperlink.
91
     * @throws IOException if the string could not be printed
92
     */
93
    void println(String s, Lookup extendingInfo,
94
            boolean important) throws IOException;
95
}
(-)a/openide.io.base/src/org/openide/io/base/IOProviderBase.java (+342 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2014 Sun Microsystems, Inc.
41
 */
42
package org.openide.io.base;
43
44
import java.io.BufferedReader;
45
import java.io.IOException;
46
import java.io.InputStreamReader;
47
import java.io.PrintStream;
48
import java.io.PrintWriter;
49
import java.io.Reader;
50
import java.io.StringWriter;
51
import java.util.Collection;
52
import java.util.Collections;
53
import java.util.Set;
54
import org.openide.util.Lookup;
55
56
/**
57
 * A factory for IO tabs. To create a new tab to write to, call e.g.
58
 * <code>IOProvider.getDefault().getIO("MyTab", false)</code> (pass true if
59
 * there may be an existing tab with the same name and you want to write to a
60
 * new tab).
61
 *
62
 * @author jhavlin
63
 */
64
public abstract class IOProviderBase {
65
66
    public static IOProviderBase getDefault() {
67
        IOProviderBase iopb = Lookup.getDefault().lookup(IOProviderBase.class);
68
        if (iopb == null) {
69
            iopb = new Trivial();
70
        }
71
        return iopb;
72
    }
73
74
    /**
75
     * Gets IOProviderBase of selected name or delegates to getDefault() if none
76
     * was found.
77
     *
78
     * @param name ID of provider
79
     * @return the instance corresponding to provided name or default instance
80
     * if not found
81
     */
82
    public static IOProviderBase get(String name) {
83
        Collection<? extends IOProviderBase> res = Lookup.getDefault().lookupAll(
84
                IOProviderBase.class);
85
        for (IOProviderBase iop : res) {
86
            if (iop.getName().equals(name)) {
87
                return iop;
88
            }
89
        }
90
        return getDefault();
91
    }
92
93
    /**
94
     * Gets name (ID) of provider
95
     *
96
     * @return name of provider
97
     */
98
    public abstract String getName();
99
100
    /**
101
     * Get a named instance of InputOutput, which represents an output tab in
102
     * the output window. Streams for reading/writing can be accessed via
103
     * getters on the returned instance.
104
     *
105
     * @param name A localised display name for the tab
106
     * @param newIO if <tt>true</tt>, a new <code>InputOutput</code> is
107
     * returned, else an existing <code>InputOutput</code> of the same name may
108
     * be returned
109
     * @return an <code>InputOutput</code> instance for accessing the new tab
110
     * @see InputOutputBase
111
     */
112
    public abstract InputOutputBase getIO(String name, boolean newIO);
113
114
    /**
115
     * Fallback implementation.
116
     */
117
    private static final class Trivial extends IOProviderBase {
118
119
        private static final Reader in = new BufferedReader(
120
                new InputStreamReader(System.in));
121
        private static final PrintStream out = System.out;
122
        private static final PrintStream err = System.err;
123
124
        public Trivial() {
125
        }
126
127
        @Override
128
        public String getName() {
129
            return "Trivial";                                           //NOI18N
130
        }
131
132
        @Override
133
        public InputOutputBase getIO(String name, boolean newIO) {
134
            return new TrivialIO(name);
135
        }
136
137
        @SuppressWarnings("deprecation")
138
        private final class TrivialIO implements InputOutputBase {
139
140
            private final String name;
141
142
            public TrivialIO(String name) {
143
                this.name = name;
144
            }
145
146
            @Override
147
            public Reader getIn() {
148
                return in;
149
            }
150
151
            @Override
152
            public PrintWriter getOut() {
153
                return new TrivialOW(out, name);
154
            }
155
156
            @Override
157
            public PrintWriter getErr() {
158
                return new TrivialOW(err, name);
159
            }
160
161
            public Reader flushReader() {
162
                return getIn();
163
            }
164
165
            @Override
166
            public boolean isClosed() {
167
                return false;
168
            }
169
170
            @Override
171
            public void closeInputOutput() {
172
            }
173
174
            @Override
175
            public void select() {
176
            }
177
178
            @Override
179
            public void reset() {
180
            }
181
182
            @Override
183
            public ExtendableWriter getExtendableOut() {
184
                return new TrivialExtendableWriter(getOut());
185
            }
186
187
            @Override
188
            public ExtendableWriter getExtandableErr() {
189
                return new TrivialExtendableWriter(getErr());
190
            }
191
192
            @Override
193
            public Lookup getLookup() {
194
                return Lookup.EMPTY;
195
            }
196
        }
197
198
        private static final class TrivialOW extends PrintWriter {
199
200
            private static int count = 0;
201
            private final String name;
202
            private final PrintStream stream;
203
204
            @SuppressWarnings("ValueOfIncrementOrDecrementUsed")
205
            public TrivialOW(PrintStream stream, String name) {
206
                // XXX using super(new PrintWriter(stream)) does not seem to work for some reason!
207
                super(new StringWriter());
208
                this.stream = stream;
209
                if (name != null) {
210
                    this.name = name;
211
                } else {
212
                    this.name = "anon-" + ++count; // NOI18N
213
                }
214
            }
215
216
            private void prefix(boolean hyperlink) {
217
                if (hyperlink) {
218
                    stream.print("[" + name + "]* "); // NOI18N
219
                } else {
220
                    stream.print("[" + name + "]  "); // NOI18N
221
                }
222
            }
223
224
            @Override
225
            public void println(float x) {
226
                prefix(false);
227
                stream.println(x);
228
            }
229
230
            @Override
231
            public void println(double x) {
232
                prefix(false);
233
                stream.println(x);
234
            }
235
236
            @Override
237
            public void println() {
238
                prefix(false);
239
                stream.println();
240
            }
241
242
            @Override
243
            public void println(Object x) {
244
                prefix(false);
245
                stream.println(x);
246
            }
247
248
            @Override
249
            public void println(int x) {
250
                prefix(false);
251
                stream.println(x);
252
            }
253
254
            @Override
255
            public void println(char x) {
256
                prefix(false);
257
                stream.println(x);
258
            }
259
260
            @Override
261
            public void println(long x) {
262
                prefix(false);
263
                stream.println(x);
264
            }
265
266
            @Override
267
            @SuppressWarnings("ImplicitArrayToString")
268
            public void println(char[] x) {
269
                prefix(false);
270
                stream.println(x);
271
            }
272
273
            @Override
274
            public void println(boolean x) {
275
                prefix(false);
276
                stream.println(x);
277
            }
278
279
            @Override
280
            public void println(String x) {
281
                prefix(false);
282
                stream.println(x);
283
            }
284
285
            @Override
286
            public void write(int c) {
287
                stream.write(c);
288
            }
289
290
            @Override
291
            public void write(char[] buf, int off, int len) {
292
                String s = new String(buf, off, len);
293
                if (s.endsWith("\n")) {
294
                    println(s.substring(0, s.length() - 1));
295
                } else {
296
                    try {
297
                        stream.write(s.getBytes());
298
                    } catch (IOException x) {
299
                    }
300
                }
301
            }
302
303
            @Override
304
            public void write(String s, int off, int len) {
305
                String sub = s.substring(off, off + len);
306
                if (sub.endsWith("\n")) {
307
                    println(sub.substring(0, sub.length() - 1));
308
                } else {
309
                    try {
310
                        stream.write(sub.getBytes());
311
                    } catch (IOException x) {
312
                    }
313
                }
314
            }
315
        }
316
317
        public static class TrivialExtendableWriter implements ExtendableWriter {
318
            private final PrintWriter printWriter;
319
320
            public TrivialExtendableWriter(PrintWriter printWriter) {
321
                this.printWriter = printWriter;
322
            }
323
324
            @Override
325
            public Set<Class<?>> getExtendingTypes() {
326
                return Collections.emptySet();
327
            }
328
329
            @Override
330
            public void println(String s, Lookup extendingInfo) throws
331
                    IOException {
332
                printWriter.println(s);
333
            }
334
335
            @Override
336
            public void println(String s, Lookup extendingInfo,
337
                    boolean important) throws IOException {
338
                printWriter.println(s);
339
            }
340
        }
341
    }
342
}
(-)a/openide.io.base/src/org/openide/io/base/InputOutputBase.java (+134 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2014 Sun Microsystems, Inc.
41
 */
42
package org.openide.io.base;
43
44
import java.io.IOException;
45
import java.io.PrintWriter;
46
import java.io.Reader;
47
import org.openide.util.Lookup;
48
49
/**
50
 * An I/O connection to one tab on the Output Window. To acquire an instance to
51
 * write to, call, e.g.,
52
 * <code>IOProviderBase.getDefault().getIO("someName", false)</code>. To get
53
 * actual streams to write to, call <code>getOut()</code> or <code>
54
 * getErr()</code> on the returned instance.
55
 * <p>
56
 * Generally it is preferable not to hold a reference to an instance of
57
 * {@link org.openide.io.base.InputOutputBase}, but rather to fetch it by name
58
 * from {@link org.openide.io.base.IOProviderBase} as needed.
59
 * </p>
60
 *
61
 * @see ExtendableWriter
62
 * @author Ian Formanek, Jaroslav Tulach, Petr Hamernik, Ales Novak, Jan
63
 * Jancura, Jaroslav Havlin
64
 */
65
public interface InputOutputBase extends Lookup.Provider {
66
67
    /**
68
     * Acquire an output writer to write to the tab. This is the usual use of a
69
     * tab--it writes to the main output pane.
70
     *
71
     * @return the writer
72
     */
73
    public PrintWriter getOut();
74
75
    /**
76
     * Get a reader to read from the tab. If a reader is ever requested, an
77
     * input line is added to the tab and used to read one line at a time.
78
     *
79
     * @return the reader
80
     */
81
    public Reader getIn();
82
83
    /**
84
     * Get an output writer to write to the tab in error mode. This might show
85
     * up in a different color than the regular output, e.g., or appear in a
86
     * separate pane.
87
     *
88
     * @return the writer
89
     */
90
    public PrintWriter getErr();
91
92
    /**
93
     * Get extension for standard output that can be used for printing lines
94
     * with output listeners or tags.
95
     *
96
     * @return Writer as an
97
     */
98
    public ExtendableWriter getExtendableOut();
99
100
    /**
101
     * Get extension for error output that can be used for printing lines with
102
     * output listeners or tags.
103
     *
104
     * @return Writer as an
105
     */
106
    public ExtendableWriter getExtandableErr();
107
108
    /**
109
     * Closes this tab. The effect of calling any method on an instance of
110
     * InputOutput after calling <code>closeInputOutput()</code> on it is
111
     * undefined.
112
     */
113
    public void closeInputOutput();
114
115
    /**
116
     * Test whether this tab has been closed, either by a call to
117
     * <code>closeInputOutput()</code> or by the user closing the tab in the UI.
118
     *
119
     * @see #closeInputOutput
120
     * @return <code>true</code> if it is closed
121
     */
122
    public boolean isClosed();
123
124
    /**
125
     * Ensure this pane is visible.
126
     */
127
    public void select();
128
129
    /**
130
     * Clean the output area.
131
     * @throws java.io.IOException
132
     */
133
    void reset() throws IOException;
134
}
(-)a/openide.io.base/src/org/openide/io/base/OutputEventBase.java (+70 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2014 Sun Microsystems, Inc.
41
 */
42
package org.openide.io.base;
43
44
/**
45
 * Event fired when something happens to a line in the Output Window.
46
 *
47
 * @author Jaroslav Tulach, Petr Hamernik, Jaroslav Havlin
48
 */
49
public abstract class OutputEventBase extends java.util.EventObject {
50
    /** generated Serialized Version UID */
51
    static final long serialVersionUID = 4809584286971828815L;
52
    /** Create an event.
53
    * @param src the tab in question
54
    */
55
    public OutputEventBase (InputOutputBase src) {
56
        super (src);
57
    }
58
59
    /** Get the text on the line.
60
    * @return the text
61
    */
62
    public abstract String getLine ();
63
64
    /** Get the Output Window tab in question.
65
    * @return the tab
66
    */
67
    public InputOutputBase getInputOutput() {
68
        return (InputOutputBase) getSource();
69
    }
70
}
(-)a/openide.io.base/src/org/openide/io/base/OutputListenerBase.java (+72 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2014 Sun Microsystems, Inc.
41
 */
42
package org.openide.io.base;
43
44
/**
45
 * Listener to actions taken on a line in the Output Window.
46
 *
47
 * @author Jaroslav Tulach
48
 * @version 0.11 Dec 01, 1997
49
 */
50
public interface OutputListenerBase extends java.util.EventListener {
51
52
    /**
53
     * Called when a line is selected.
54
     *
55
     * @param ev the event describing the line
56
     */
57
    void outputLineSelected(OutputEventBase ev);
58
59
    /**
60
     * Called when some sort of action is performed on a line.
61
     *
62
     * @param ev the event describing the line
63
     */
64
    void outputLineAction(OutputEventBase ev);
65
66
    /**
67
     * Called when a line is cleared from the buffer of known lines.
68
     *
69
     * @param ev the event describing the line
70
     */
71
    void outputLineCleared(OutputEventBase ev);
72
}
(-)a/openide.io.base/src/org/openide/io/base/OutputTagBase.java (+76 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2014 Sun Microsystems, Inc.
41
 */
42
package org.openide.io.base;
43
44
import java.util.Set;
45
46
/**
47
 * Base class for adding tagging information to output text.
48
 *
49
 * @author jhavlin
50
 */
51
public interface OutputTagBase {
52
53
    /**
54
     * Get type of this tag.
55
     *
56
     * @return Type of the tag.
57
     */
58
    String getType();
59
60
    /**
61
     * Get value of an attribute specified by name.
62
     *
63
     * @param attributeName Name of the attribute.
64
     * @return Value of the attribute, or null if it is not available.
65
     * @throws IllegalArgumentException If tag of this type should not be
66
     * queried for attribute of name {@code  attributeName}.
67
     */
68
    Object getAttribute(String attributeName);
69
70
    /**
71
     * Get set of names of available attributes.
72
     *
73
     * @return Set of attribute names.
74
     */
75
    Set<String> getAttributeNames();
76
}

Return to bug 245014