Java Code Examples for org.openide.windows.OutputWriter#println()
The following examples show how to use
org.openide.windows.OutputWriter#println() .
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: FtpClient.java From netbeans with Apache License 2.0 | 6 votes |
private void processEvent(ProtocolCommandEvent event) { String message = event.getMessage(); if (message.startsWith("PASS ")) { // NOI18N // hide password message = "PASS ******"; // NOI18N } OutputWriter writer = null; if (event.isReply() && (FTPReply.isNegativeTransient(event.getReplyCode()) || FTPReply.isNegativePermanent(event.getReplyCode()))) { writer = io.getErr(); } else { writer = io.getOut(); } writer.println(message.trim()); writer.flush(); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Command listener: {0}", message.trim()); } }
Example 2
Source File: T3_HardClose_Test.java From netbeans with Apache License 2.0 | 6 votes |
/** * Weak close, hard close,then stream close */ public void testWeakHardStream() { System.out.printf("testWeakHardStream()\r"); OutputWriter ow = io.getOut(); ow.println("Hello to Out\r"); if (IOVisibility.isSupported(io)) IOVisibility.setVisible(io, false); io.closeInputOutput(); ow.close(); // Additional operations should be no-ops ow.println("Should go to bitbucket\r"); io.select(); }
Example 3
Source File: T3_HardClose_Test.java From netbeans with Apache License 2.0 | 6 votes |
/** * Hard close, weak close, then stream close */ public void testHardWeakStream() { System.out.printf("testHardWeakStream()\r"); OutputWriter ow = io.getOut(); ow.println("Hello to Out\r"); io.closeInputOutput(); if (IOVisibility.isSupported(io)) IOVisibility.setVisible(io, false); ow.close(); // Additional operations should be no-ops ow.println("Should go to bitbucket\r"); io.select(); }
Example 4
Source File: JavaHudsonLogger.java From netbeans with Apache License 2.0 | 6 votes |
public boolean handle(String line, OutputWriter stream) { Matcher m = STACK_TRACE.matcher(line); if (!m.matches()) { return false; } String pkg = m.group(1); String filename = m.group(2); String resource = pkg.replace('.', '/') + filename; int lineNumber = Integer.parseInt(m.group(3)); try { stream.println(line, new Hyperlink(resource, lineNumber)); return true; } catch (IOException x) { LOG.log(Level.INFO, null, x); } stream.println(line); return true; }
Example 5
Source File: T3_HardClose_Test.java From netbeans with Apache License 2.0 | 6 votes |
/** * Weak close, stream close, then hard close */ public void testWeakStreamHard() { System.out.printf("testWeakStreamHard()\r"); OutputWriter ow = io.getOut(); ow.println("Hello to Out\r"); if (IOVisibility.isSupported(io)) IOVisibility.setVisible(io, false); ow.close(); io.closeInputOutput(); // redundant hard closes should not cause problems io.closeInputOutput(); // Additional operations should be no-ops ow.println("Should go to bitbucket\r"); io.select(); }
Example 6
Source File: NbBuildLogger.java From netbeans with Apache License 2.0 | 6 votes |
public @Override void println(String message, boolean error, OutputListener listener) { verifyRunning(); LOG.log(Level.FINEST, "println: error={0} listener={1} message={2}", new Object[] {error, listener, message}); OutputWriter ow = error ? err : out; try { if (listener != null) { // Loggers wishing for more control can use getIO and do it themselves. boolean important = StandardLogger.isImportant(message); ow.println(message, listener, important); interestingOutputCallback.run(); } else { ow.println(message); } } catch (IOException e) { LOG.log(Level.WARNING, null, e); } }
Example 7
Source File: SQLExecutionLoggerImpl.java From netbeans with Apache License 2.0 | 6 votes |
@NbBundle.Messages({ "# {0} - line number", "# {1} - column number", "LBL_LineColumn=Line {0}, column {1}"}) private void printLineColumn(OutputWriter writer, SQLExecutionResult result, boolean hyperlink) { int[] errorCoords = result.getRawErrorLocation(); int errLine = errorCoords[0]; int errCol = errorCoords[1]; String lineColumn = " " + LBL_LineColumn(errLine + 1, errCol + 1); try { if (hyperlink) { Hyperlink errLink = new Hyperlink(errLine, errCol); writer.println(lineColumn, errLink); } else { writer.println(lineColumn); } } catch (IOException e) { Exceptions.printStackTrace(e); } }
Example 8
Source File: DebuggerChecker.java From netbeans with Apache License 2.0 | 6 votes |
private String classToSourceURL (FileObject fo, OutputWriter logger) { ClassPath cp = ClassPath.getClassPath (fo, ClassPath.EXECUTE); if (cp == null) { return null; } FileObject root = cp.findOwnerRoot (fo); String resourceName = cp.getResourceName (fo, '/', false); if (resourceName == null) { logger.println("Can not find classpath resource for "+fo+", skipping..."); return null; } int i = resourceName.indexOf ('$'); if (i > 0) { resourceName = resourceName.substring (0, i); } FileObject[] sRoots = SourceForBinaryQuery.findSourceRoots (root.toURL ()).getRoots (); ClassPath sourcePath = ClassPathSupport.createClassPath (sRoots); FileObject rfo = sourcePath.findResource (resourceName + ".java"); if (rfo == null) { return null; } return rfo.toURL ().toExternalForm (); }
Example 9
Source File: DummyBridgeImpl.java From netbeans with Apache License 2.0 | 5 votes |
@Override public boolean run(File buildFile, List<String> targets, InputStream in, OutputWriter out, OutputWriter err, Map<String,String> properties, Set<? extends String> concealedProperties, int verbosity, String displayName, Runnable interestingOutputCallback, ProgressHandle handle, InputOutput io) { err.println(NbBundle.getMessage(DummyBridgeImpl.class, "ERR_cannot_run_target")); problem.printStackTrace(err); return false; }
Example 10
Source File: BridgingInputOutputProvider.java From netbeans with Apache License 2.0 | 5 votes |
@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 11
Source File: XMLJ2eeDataObject.java From netbeans with Apache License 2.0 | 5 votes |
public void displayErrorMessage() { if (error==null) return; if (errorAnnotation==null) errorAnnotation = new org.openide.text.Annotation() { public String getAnnotationType() { return "xml-j2ee-annotation"; // NOI18N } public String getShortDescription() { return NbBundle.getMessage(XMLJ2eeDataObject.class, "HINT_XMLErrorDescription"); } }; if (inOut==null) inOut=org.openide.windows.IOProvider.getDefault().getIO(NbBundle.getMessage(XMLJ2eeDataObject.class, "TXT_parser"), false); inOut.setFocusTaken (false); OutputWriter outputWriter = inOut.getOut(); int line = Math.max(0,error.getErrorLine()); LineCookie cookie = (LineCookie)getCookie(LineCookie.class); // getting Line object Line xline = cookie.getLineSet ().getCurrent(line==0?0:line-1); // attaching Annotation errorAnnotation.attach(xline); try { outputWriter.reset(); // defining of new OutputListener IOCtl outList= new IOCtl(xline); outputWriter.println(this.getOutputStringForInvalidDocument(error),outList); } catch (IOException e) { Logger.getLogger("XMLJ2eeDataObject").log(Level.FINE, "ignored exception", e); //NOI18N } }
Example 12
Source File: SQLExecutionLoggerImpl.java From netbeans with Apache License 2.0 | 5 votes |
@NbBundle.Messages({ "# {0} - error message", "# {1} - exception class", "LBL_ExceptionMessage=[Exception] {1}: {0}"}) private void writeGenericException(Throwable e, OutputWriter writer) { LOG.log(Level.INFO, "Exception in SQL Execution", e); writer.println(LBL_ExceptionMessage( e.getMessage(), e.getClass().getName())); }
Example 13
Source File: Hyperlinker.java From netbeans with Apache License 2.0 | 5 votes |
@Override public HudsonLogSession createSession(HudsonJob job) { return new HudsonLogSession() { @Override public boolean handle(String line, OutputWriter stream) { stream.println(line); return true; } }; }
Example 14
Source File: SQLExecutionLoggerImpl.java From netbeans with Apache License 2.0 | 5 votes |
@NbBundle.Messages({ "# {0} - error code", "# {1} - error sql state", "# {2} - error message", "LBL_WarningCodeStateMessage=[Warning, Error code {0}, SQLState {1}] {2}"}) private void writeSQLWarning(SQLWarning e, OutputWriter writer) { writer.println(LBL_WarningCodeStateMessage( e.getErrorCode(), e.getSQLState(), e.getMessage())); }
Example 15
Source File: RetrieverEngineImpl.java From netbeans with Apache License 2.0 | 5 votes |
private void updateDownloadedInfo(RetrieveEntry rent) { retrievedList.add(rent); OutputWriter opt = getOPOut(); String str = " "+rent.getEffectiveAddress(); opt.println( NbBundle.getMessage(RetrieverEngineImpl.class, "MSG_retrieved_saved_at",str, rent.getSaveFile())); //NOI18N opt.flush(); }
Example 16
Source File: SQLExecutionLoggerImpl.java From netbeans with Apache License 2.0 | 5 votes |
private void startLineColumn(OutputWriter writer, SQLExecutionResult result, String message) { int line = result.getStatementInfo().getStartLine(); int col = result.getStatementInfo().getStartColumn(); String text = String.format("[%d:%d] %s", line + 1, col + 1, message); Hyperlink link = new Hyperlink(line, col); try { writer.println(text, link); } catch (IOException e) { Exceptions.printStackTrace(e); } }
Example 17
Source File: AbstractOutputHandler.java From netbeans with Apache License 2.0 | 5 votes |
protected final void processEnd(String id, OutputWriter writer) { checkSleepiness(); visitor.resetVisitor(); Iterator<OutputProcessor> it = currentProcessors.iterator(); while (it.hasNext()) { OutputProcessor proc = it.next(); proc.sequenceEnd(id, visitor); if (proc instanceof NotifyFinishOutputProcessor) { toFinishProcessors.add((NotifyFinishOutputProcessor)proc); } } if (visitor.getLine() != null) { if (visitor.getOutputListener() != null) { try { writer.println(visitor.getLine(), visitor.getOutputListener(), visitor.isImportant()); } catch (IOException ex) { ex.printStackTrace(); } } else { writer.println(visitor.getLine()); } } Set set = processors.get(id); if (set != null) { //TODO a bulletproof way would be to keep a list of currently started // sections and compare to the list of getRegisteredOutputSequences fo each of the // processors in set.. currentProcessors.removeAll(set); } }
Example 18
Source File: Manager.java From netbeans with Apache License 2.0 | 4 votes |
public void handleLine(OutputWriter out, String text) { out.println(text); }
Example 19
Source File: RemoteCommand.java From netbeans with Apache License 2.0 | 4 votes |
private static void printError(OutputWriter writer, int maxRelativePath, TransferFile file, String reason) { String msg = String.format("%-" + MAX_TYPE_SIZE + "s %-" + maxRelativePath + "s %s", getFileTypeLabel(file), file.getRemotePath(), reason); writer.println(msg); }
Example 20
Source File: AbstractOutputHandler.java From netbeans with Apache License 2.0 | 4 votes |
protected final void processLine(String input, OutputWriter writer, Level level) { checkSleepiness(); visitor.resetVisitor(); for (OutputProcessor proc : currentProcessors) { proc.processLine(input, visitor); } if (!visitor.isLineSkipped()) { String line = visitor.getLine() == null ? input : visitor.getLine(); if (visitor.getColor(getIO()) == null && visitor.getOutputListener() == null) { switch (level) { case DEBUG: visitor.setOutputType(IOColors.OutputType.LOG_DEBUG); break; case WARNING: visitor.setOutputType(IOColors.OutputType.LOG_WARNING); break; case ERROR: case FATAL: visitor.setOutputType(IOColors.OutputType.LOG_FAILURE); break; } } try { if (visitor.getOutputListener() != null) { if (visitor.getColor(getIO()) != null && IOColorPrint.isSupported(getIO())) { IOColorPrint.print(getIO(), line + "\n", visitor.getOutputListener(), visitor.isImportant(), visitor.getColor(getIO())); } else { writer.println(line, visitor.getOutputListener(), visitor.isImportant()); } } else { if (level.compareTo(Level.ERROR) >= 0 && IOColorPrint.isSupported(getIO())) { IOColorPrint.print(getIO(), line + "\n", null, true, visitor.getColor(getIO())); } else if (visitor.getColor(getIO()) != null && IOColorLines.isSupported(getIO())) { IOColorLines.println(getIO(), line, visitor.getColor(getIO())); } else { writer.println(line); } } } catch (IOException x) { x.printStackTrace(); writer.println(line); // fallback } } }