Java Code Examples for org.openide.windows.OutputWriter#print()

The following examples show how to use org.openide.windows.OutputWriter#print() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BridgingInputOutputProvider.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void print(InputOutput io, OutputWriter writer, String text,
        Hyperlink link, OutputColor outputColor, boolean printLineEnd) {

    Color awtColor = outputColorToAwtColor(io, outputColor);
    OutputListener listener = hyperlinkToOutputListener(link);
    boolean listenerImportant = link != null && Hyperlinks.isImportant(link);
    try {
        if (printLineEnd && outputColor == null) {
            writer.println(text, listener, listenerImportant);
        } else if (printLineEnd && IOColorLines.isSupported(io)) {
            IOColorLines.println(io, text, listener, listenerImportant,
                    awtColor);
        } else if (IOColorPrint.isSupported(io)) {
            IOColorPrint.print(io, text, listener, listenerImportant,
                    awtColor);
            if (printLineEnd) {
                writer.println();
            }
        } else if (printLineEnd) {
            writer.println(text);
        } else {
            writer.print(text);
        }
    } catch (IOException ex) {
        LOG.log(Level.FINE, "Cannot print color or hyperlink", ex); //NOI18N
    }
}
 
Example 2
Source File: SimpleIO.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/**
 * Writes a string to the output window
 * 
 * @param s string to be written
 */
public synchronized void write(String s) {
    OutputWriter writer = io.getOut();
    writer.print(s);
    writer.flush();
}
 
Example 3
Source File: SimpleIO.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/**
 * Writes a string to the output window
 * 
 * @param s string to be written
 */
public synchronized void write(String s) {
    OutputWriter writer = io.getOut();
    writer.print(s);
    writer.flush();
}
 
Example 4
Source File: ShowChanges.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void run() {
    String name = NbBundle.getMessage(ShowChanges.class, "ShowChanges.title", build.getDisplayName());
    InputOutput io = IOProvider.getDefault().getIO(name, new Action[0]);
    io.select();
    OutputWriter out = io.getOut();
    OutputWriter err = io.getErr();
    Collection<? extends HudsonJobChangeItem> changes = build.getChanges();
    boolean first = true;
    for (HudsonJobChangeItem item : changes) {
        if (first) {
            first = false;
        } else {
            out.println();
        }
        out.println(item.getUser() + ": " + item.getMessage());
        for (HudsonJobChangeFile file : item.getFiles()) {
            // XXX hyperlink to diff viewer
            switch (file.getEditType()) {
            case edit:
                out.print('±');
                break;
            case add:
                out.print('+');
                break;
            case delete:
                out.print('-');
            }
            out.print(' ');
            OutputListener hyperlink = file.hyperlink();
            if (hyperlink != null) {
                try {
                    out.println(file.getName(), hyperlink);
                } catch (IOException x) {
                    LOG.log(Level.INFO, null, x);
                }
            } else {
                out.println(file.getName());
            }
        }
    }
    if (first) {
        out.println(NbBundle.getMessage(ShowChanges.class, "ShowChanges.no_changes"));
    }
    out.close();
    err.close();
}