|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.core.output2; import org.netbeans.core.output2.ui.AbstractOutputPane; import org.netbeans.core.output2.ui.AbstractOutputTab; import org.openide.ErrorManager; import javax.swing.*; import javax.swing.text.Document; import java.awt.*; /** * A component representing one tab in the output window. * */ final class OutputTab extends AbstractOutputTab { private NbIO io; OutputTab (NbIO io) { this.io = io; if (Controller.log) Controller.log ("Created an output component for " + io); OutputDocument doc = new OutputDocument (((NbWriter) io.getOut()).out()); setDocument (doc); } public void addNotify() { super.addNotify(); if (io != null) io.setClosed(false); } public void removeNotify() { if (io != null) io.setClosed(true); super.removeNotify(); } public void setDocument (Document doc) { if (Controller.log) Controller.log ("Set document on " + this + " with " + io); assert SwingUtilities.isEventDispatchThread(); Document old = getDocument(); hasOutputListeners = false; firstNavigableListenerLine = -1; super.setDocument(doc); if (old != null && old instanceof OutputDocument) { ((OutputDocument) old).dispose(); } } public void setIO (NbIO io) { if (Controller.log) Controller.log ("Replacing io on " + this + " with " + io + " out is " + (io != null ? io.getOut() : null)); if (io != null) { setDocument (new OutputDocument(((NbWriter) io.getOut()).out())); io.setClosed(false); } else { if (this.io != null) this.io.setClosed(true); this.io = null; setDocument(null); } } public OutputDocument getDocument() { Document d = getOutputPane().getDocument(); if (d instanceof OutputDocument) { return (OutputDocument) d; } return null; } protected AbstractOutputPane createOutputPane() { return new OutputPane(); } protected void inputSent(String txt) { if (Controller.log) Controller.log("Input sent on OutputTab: " + txt); getOutputPane().lockScroll(); findOutputWindow().inputSent(this, txt); } protected void inputEof() { if (Controller.log) Controller.log ("Input EOF on OutputTab: "); findOutputWindow().inputEof(this); } public void hasSelectionChanged(boolean val) { OutputWindow win = findOutputWindow(); if (win != null) { win.hasSelectionChanged(this, val); } } public NbIO getIO() { return io; } private long timestamp = 0; void updateTimestamp() { timestamp = System.currentTimeMillis(); } long getTimestamp() { return timestamp; } private OutputWindow findOutputWindow() { if (getParent() != null) { return (OutputWindow) SwingUtilities.getAncestorOfClass(OutputWindow.class, this); } else { return (OutputWindow) getClientProperty ("outputWindow"); //NOI18N } } public void lineClicked(int line) { findOutputWindow().lineClicked (this, line); } public void postPopupMenu(Point p, Component src) { findOutputWindow().postPopupMenu(this, p, src); } public void caretEnteredLine(int line) { findOutputWindow().caretEnteredLine(this, line); } private int firstNavigableListenerLine = -1; /** * Okay, this is a bit of a hack - we actually look for the text * [deprecation] and ignore lines that contain it. The goal is to * not unlock the scrollbar unless there is a bona-fide error to * show - deprecation warnings should be ignored. * |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.