Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2005-01-06 21:48:49 +0000
committerDarin Wright2005-01-06 21:48:49 +0000
commita6ba4ef04d3f6d8056eb63ede9a06600518c8c23 (patch)
tree2fe1d94c6e5cb61b75bc7ff8957fb27014934235
parent27cc909f2ca89b789cd63eb12e8796efe6a3bd8d (diff)
downloadeclipse.platform.debug-a6ba4ef04d3f6d8056eb63ede9a06600518c8c23.tar.gz
eclipse.platform.debug-a6ba4ef04d3f6d8056eb63ede9a06600518c8c23.tar.xz
eclipse.platform.debug-a6ba4ef04d3f6d8056eb63ede9a06600518c8c23.zip
console API cleanup
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleInputStream.java36
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleOutputStream.java64
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsole.java9
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsoleStream.java13
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/PatternMatchEvent.java6
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java37
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsolePage.java50
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java56
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePatternMatcher.java10
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePage.java6
10 files changed, 212 insertions, 75 deletions
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleInputStream.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleInputStream.java
index c11fb1e4e..3517c77f7 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleInputStream.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleInputStream.java
@@ -18,9 +18,11 @@ import org.eclipse.swt.graphics.Color;
/**
* InputStream used to read input from an IOConsole.
- * This stream will buffer input that it receives from the console
- * until it has been read.
- *
+ * This stream will buffer input that it receives until it has been read.
+ * <p>
+ * Clients are not intended to instantiate this class directly, instead
+ * use <code>IOConsole.getInputStream()</code>.
+ * </p>
* @since 3.1
*
*/
@@ -73,6 +75,11 @@ public class IOConsoleInputStream extends InputStream {
private int fontStyle = SWT.NORMAL;
+ /**
+ * Constructs a new input stream on the given console.
+ *
+ * @param console I/O console
+ */
IOConsoleInputStream(IOConsole console) {
this.console = console;
}
@@ -129,7 +136,7 @@ public class IOConsoleInputStream extends InputStream {
}
/**
- * blocks until data is available to be read.
+ * Blocks until data is available to be read.
* Ensure that the monitor for this object is obtained before
* calling this method.
*/
@@ -143,8 +150,9 @@ public class IOConsoleInputStream extends InputStream {
}
/**
- * appends data to this input stream's buffer
- * @param text The data to append to the buffer.
+ * Appends text to this input stream's buffer.
+ *
+ * @param text the text to append to the buffer.
*/
public synchronized void appendData(String text) {
byte[] newData = text.getBytes();
@@ -192,16 +200,18 @@ public class IOConsoleInputStream extends InputStream {
}
/**
- * Returns this console's font style.
- * @return The font style used to decorate input in the associated console
+ * Returns this stream's font style.
+ *
+ * @return the font style used to decorate input in the associated console
*/
public int getFontStyle() {
return fontStyle;
}
/**
- * Sets the font style
- * @param newFontStyle The font style to be used to decorate input in the associated console
+ * Sets this stream's font style.
+ *
+ * @param newFontStyle the font style to be used to decorate input in the associated console
*/
public void setFontStyle(int newFontStyle) {
if (newFontStyle != fontStyle) {
@@ -213,7 +223,8 @@ public class IOConsoleInputStream extends InputStream {
/**
* Sets the color to used to decorate input in the associated console.
- * @param newColor The color to used to decorate input in the associated console.
+ *
+ * @param newColor the color to used to decorate input in the associated console.
*/
public void setColor(Color newColor) {
Color old = color;
@@ -225,7 +236,8 @@ public class IOConsoleInputStream extends InputStream {
/**
* Returns the color used to decorate input in the associated console
- * @return The color used to decorate input in the associated console
+ *
+ * @return the color used to decorate input in the associated console
*/
public Color getColor() {
return color;
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleOutputStream.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleOutputStream.java
index 3363aa1af..5bb4323a9 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleOutputStream.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleOutputStream.java
@@ -19,7 +19,10 @@ import org.eclipse.ui.internal.console.IOConsolePartitioner;
/**
* OutputStream used to write to an IOConsole.
- *
+ * <p>
+ * Clients are not intended to instantiate this class directly, instead
+ * use <code>IOConsole.newOutputStream()</code>.
+ * </p>
* @since 3.1
*/
public class IOConsoleOutputStream extends OutputStream {
@@ -57,22 +60,29 @@ public class IOConsoleOutputStream extends OutputStream {
private String fEncoding;
private String fDefaultEncoding = WorkbenchEncoding.getWorkbenchDefaultEncoding();
+ /**
+ * Constructs a new output stream on the given console.
+ *
+ * @param console I/O console
+ */
IOConsoleOutputStream(IOConsole console) {
this.console = console;
this.partitioner = (IOConsolePartitioner) console.getPartitioner();
}
/**
- * Returns the font style used to decorate data written to this stream
- * @return The font style used to decorate data written to this stream
+ * Returns the font style used to decorate data written to this stream.
+ *
+ * @return the font style used to decorate data written to this stream
*/
public int getFontStyle() {
return fontStyle;
}
/**
- * Sets the font style to be used to decorate data written to this stream
- * @param newFontStyle The font style to be used to decorate data written to this stream
+ * Sets the font style to be used to decorate data written to this stream.
+ *
+ * @param newFontStyle the font style to be used to decorate data written to this stream
*/
public void setFontStyle(int newFontStyle) {
if (newFontStyle != fontStyle) {
@@ -83,27 +93,32 @@ public class IOConsoleOutputStream extends OutputStream {
}
/**
- * Returns the value of activateOnWrite
- * @return true if console is activated automatically when data is written to this stream, false if the
- * console is not activated by data being written to this stream.
+ * Returns whether the console this stream is writing to will be activated when this stream
+ * is written to.
+ *
+ * @return whether the console this stream is writing to will be activated when this stream
+ * is written to.
*/
public boolean isActivateOnWrite() {
return activateOnWrite;
}
/**
- * Sets the value of activateOnWrite
- * @param activateOnWrite true if the console should be activated when data is written to this
- * stream, false if it should not be activated.
+ * Sets whether to activate the console this stream is writing to when this stream
+ * is written to.
+ *
+ * @param activateOnWrite whether the console this stream is writing to will be activated when this stream
+ * is written to.
*/
public void setActivateOnWrite(boolean activateOnWrite) {
this.activateOnWrite = activateOnWrite;
}
/**
- * Sets the color of this message stream
+ * Sets the color of this stream. Use <code>null</code> to indicate
+ * the default color.
*
- * @param color color of this message stream, possibly <code>null</code>
+ * @param color color of this stream, or <code>null</code>
*/
public void setColor(Color newColor) {
Color old = color;
@@ -114,24 +129,14 @@ public class IOConsoleOutputStream extends OutputStream {
}
/**
- * Returns the color of this message stream, or <code>null</code>
+ * Returns the color of this stream, or <code>null</code>
* if default.
*
- * @return the color of this message stream, or <code>null</code>
+ * @return the color of this stream, or <code>null</code>
*/
public Color getColor() {
return color;
}
-
-
- /**
- * Returns the console this stream is connected to.
- *
- * @return the console this stream is connected to
- */
- public Object getConsole() {
- return console;
- }
/*
* (non-Javadoc)
@@ -183,8 +188,9 @@ public class IOConsoleOutputStream extends OutputStream {
}
/**
- * Writes a String to the attached console.
- * @param str The string to write to the attached console.
+ * Writes a string to the attached console.
+ *
+ * @param str the string to write to the attached console.
* @throws IOException if the stream is closed.
*/
public synchronized void write(String str) throws IOException {
@@ -208,7 +214,9 @@ public class IOConsoleOutputStream extends OutputStream {
}
/**
- * @param encoding
+ * Sets the character encoding used to interpret characters written to this steam.
+ *
+ * @param encoding endcoding identifier
*/
public void setEncoding(String encoding) {
fEncoding = encoding;
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsole.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsole.java
index f0f1c78a7..ead1be56c 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsole.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsole.java
@@ -26,6 +26,12 @@ import org.eclipse.ui.part.IPageBookViewPage;
*/
public class MessageConsole extends IOConsole {
+ /**
+ * Consturcts a message console with the given name and image.
+ *
+ * @param name console name
+ * @param imageDescriptor console image descriptor or <code>null</code>
+ */
public MessageConsole(String name, ImageDescriptor imageDescriptor) {
this(name, imageDescriptor, true);
}
@@ -34,7 +40,7 @@ public class MessageConsole extends IOConsole {
* Constructs a message console.
*
* @param name console name
- * @param imageDescriptor console image descriptor
+ * @param imageDescriptor console image descriptor or <code>null</code>
* @param autoLifecycle whether lifecycle methods should be called automatically
* when added and removed from the console manager
* @since 3.1
@@ -67,4 +73,5 @@ public class MessageConsole extends IOConsole {
public IOConsoleInputStream getInputStream() {
throw new UnsupportedOperationException("Message Console does not support user input"); //$NON-NLS-1$
}
+
}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsoleStream.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsoleStream.java
index 83b0195ba..9357e2654 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsoleStream.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsoleStream.java
@@ -20,6 +20,9 @@ import java.io.IOException;
* @since 3.0
*/
public class MessageConsoleStream extends IOConsoleOutputStream {
+
+ private MessageConsole fMessageConsole;
+
/**
* Constructs a new stream connected to the given console.
*
@@ -27,6 +30,7 @@ public class MessageConsoleStream extends IOConsoleOutputStream {
*/
public MessageConsoleStream(MessageConsole console) {
super(console);
+ fMessageConsole = console;
}
/**
@@ -64,4 +68,13 @@ public class MessageConsoleStream extends IOConsoleOutputStream {
print(message);
println();
}
+
+ /**
+ * Returns the console this stream is connected to.
+ *
+ * @return the console this stream is connected to
+ */
+ public MessageConsole getConsole() {
+ return fMessageConsole;
+ }
}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/PatternMatchEvent.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/PatternMatchEvent.java
index 4c230294c..139b4871a 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/PatternMatchEvent.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/PatternMatchEvent.java
@@ -13,11 +13,11 @@ package org.eclipse.ui.console;
import java.util.EventObject;
/**
- * An event describing a pattern match in a console. The source of the event
- * is an <code>IOConsole</code>.
+ * An event describing a pattern match in a text console. The source of the event
+ * is a <code>TextConsole</code>.
*
* @see org.eclipse.ui.console.IPatternMatchListener
- * @see org.eclipse.ui.console.IOConsole
+ * @see org.eclipse.ui.console.TextConsole
* @since 3.1
*/
public class PatternMatchEvent extends EventObject {
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java
index 913f96c29..92e97b854 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java
@@ -34,7 +34,7 @@ import org.eclipse.ui.part.IPageBookViewPage;
* <p>
* Pattern match listeners can be registered with a console programmatically
* or via the <code>org.eclipse.ui.console.consolePatternMatchListeners</code>
- * extension point. Listeners are notified of matches in the console.
+ * extension point.
* </p>
* <p>
* Clients may subclass this class. Subclasses must provide a document partitioner.
@@ -164,7 +164,7 @@ public abstract class TextConsole extends AbstractConsole {
}
/**
- * Sets the tab width.
+ * Sets the tab width used in this console.
*
* @param newTabWidth the tab width
*/
@@ -181,9 +181,9 @@ public abstract class TextConsole extends AbstractConsole {
}
/**
- * Returns the tab width.
+ * Returns the tab width used in this console.
*
- * @return tab width
+ * @return tab width used in this console
*/
public int getTabWidth() {
return fTabWidth;
@@ -275,8 +275,8 @@ public abstract class TextConsole extends AbstractConsole {
/**
* Returns the hyperlink at the given offset of <code>null</code> if none.
*
- * @param offset the hyperlink at the given offset of <code>null</code> if none
- * @return
+ * @param offset offset for which a hyperlink is requested
+ * @return the hyperlink at the given offset of <code>null</code> if none
*/
public IHyperlink getHyperlink(int offset) {
try {
@@ -338,7 +338,8 @@ public abstract class TextConsole extends AbstractConsole {
/**
* Adds the given pattern match listener to this console. The listener will
- * be connected and receive match notifications.
+ * be connected and receive match notifications. Has no effect if an identical
+ * listener has already been added.
*
* @param listener the listener to add
*/
@@ -348,9 +349,10 @@ public abstract class TextConsole extends AbstractConsole {
/**
* Removes the given pattern match listener from this console. The listener will be
- * disconnected and will no longer receive match notifications.
+ * disconnected and will no longer receive match notifications. Has no effect
+ * if the listener was not previously added.
*
- * @param listener the pattern match listener to remove.
+ * @param listener the pattern match listener to remove
*/
public void removePatternMatchListener(IPatternMatchListener listener) {
fPatternMatcher.removePatternMatchListener(listener);
@@ -382,15 +384,18 @@ public abstract class TextConsole extends AbstractConsole {
}
/**
+ * Returns a scheduling rule which can be used to prevent jobs from running
+ * while this console's pattern matcher is active.
+ *
* @return a scheduling rule which can be used to prevent jobs from running
- * while the console's pattern matcher is active.
+ * while this console's pattern matcher is active
*/
public ISchedulingRule getSchedulingRule() {
return new MatcherSchedulingRule();
}
/**
- * Partitioners should call this method when they are not expecting any new data
+ * This console's partitioner should call this method when it is not expecting any new data
* to be appended to the document.
*/
public void partitionerFinished() {
@@ -400,10 +405,10 @@ public abstract class TextConsole extends AbstractConsole {
}
/**
- * Called by the Console's Pattern Matcher when matching is complete and all
- * listeners have been notified.
- *
+ * Called by this console's pattern matcher when matching is complete.
+ * <p>
* Clients should not call this method.
+ * <p>
*/
public void matcherFinished() {
fMatcherFinished = true;
@@ -467,7 +472,7 @@ public abstract class TextConsole extends AbstractConsole {
* Returns the attribue associated with the specified key.
*
* @param key attribute key
- * @return Returns the attribue associated with the specified key
+ * @return the attribue associated with the specified key
*/
public Object getAttribute(String key) {
synchronized (fAttributes) {
@@ -476,7 +481,7 @@ public abstract class TextConsole extends AbstractConsole {
}
/**
- * Sets an attribute value.
+ * Sets an attribute value. Intended for client data.
*
* @param key attribute key
* @param value attribute value
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsolePage.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsolePage.java
index ddfb6ef8c..3183e7f5b 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsolePage.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsolePage.java
@@ -98,14 +98,27 @@ public class TextConsolePage implements IPageBookViewPage, IPropertyChangeListen
}
};
+ /**
+ * Constructs a text console page for the given console in the given view.
+ *
+ * @param console text console
+ * @param view console view the page is contained in
+ */
public TextConsolePage(TextConsole console, IConsoleView view) {
fConsole = console;
fConsoleView = view;
}
- protected TextConsoleViewer createViewer(Composite parent, TextConsole console) {
- return new TextConsoleViewer(parent, console);
+ /**
+ * Returns a viewer used to display the contents of this page's console.
+ *
+ * @param parent container for the viewer
+ * @return a viewer used to display the contents of this page's console
+ */
+ protected TextConsoleViewer createViewer(Composite parent) {
+ return new TextConsoleViewer(parent, fConsole);
}
+
/*
* (non-Javadoc)
* @see org.eclipse.ui.part.IPageBookViewPage#getSite()
@@ -122,6 +135,9 @@ public class TextConsolePage implements IPageBookViewPage, IPropertyChangeListen
fSite = pageSite;
}
+ /**
+ * Updates selection dependent actions.
+ */
protected void updateSelectionDependentActions() {
Iterator iterator= fSelectionActions.iterator();
while (iterator.hasNext()) {
@@ -134,7 +150,7 @@ public class TextConsolePage implements IPageBookViewPage, IPropertyChangeListen
* @see org.eclipse.ui.part.IPage#createControl(org.eclipse.swt.widgets.Composite)
*/
public void createControl(Composite parent) {
- fViewer = createViewer(parent, fConsole);
+ fViewer = createViewer(parent);
fViewer.setConsoleWidth(fConsole.getConsoleWidth());
fViewer.setTabWidth(fConsole.getTabWidth());
fConsole.addPropertyChangeListener(this);
@@ -250,6 +266,9 @@ public class TextConsolePage implements IPageBookViewPage, IPropertyChangeListen
}
}
+ /**
+ * Creates actions.
+ */
protected void createActions() {
IActionBars actionBars= getSite().getActionBars();
TextViewerAction action= new TextViewerAction(fViewer, ITextOperationTarget.SELECT_ALL);
@@ -287,6 +306,13 @@ public class TextConsolePage implements IPageBookViewPage, IPropertyChangeListen
actionBars.updateActionBars();
}
+ /**
+ * Configures an action for key bindings.
+ *
+ * @param actionBars action bars for this page
+ * @param actionID action definition id
+ * @param action associated action
+ */
protected void setGlobalAction(IActionBars actionBars, String actionID, IAction action) {
fGlobalActions.put(actionID, action);
actionBars.setGlobalActionHandler(actionID, action);
@@ -306,7 +332,7 @@ public class TextConsolePage implements IPageBookViewPage, IPropertyChangeListen
}
/**
- * Returns the view this page is contained in
+ * Returns the view this page is contained in.
*
* @return the view this page is contained in
*/
@@ -315,7 +341,7 @@ public class TextConsolePage implements IPageBookViewPage, IPropertyChangeListen
}
/**
- * Returns the console this page is displaying
+ * Returns the console this page is displaying.
*
* @return the console this page is displaying
*/
@@ -323,6 +349,11 @@ public class TextConsolePage implements IPageBookViewPage, IPropertyChangeListen
return fConsole;
}
+ /**
+ * Updates the global action with the given id
+ *
+ * @param actionId action definition id
+ */
protected void updateAction(String actionId) {
IAction action= (IAction)fGlobalActions.get(actionId);
if (action instanceof IUpdate) {
@@ -361,13 +392,18 @@ public class TextConsolePage implements IPageBookViewPage, IPropertyChangeListen
/**
- * @return Returns the viewer.
+ * Returns the viewer contained in this page.
+ *
+ * @return the viewer contained in this page
*/
public TextConsoleViewer getViewer() {
return fViewer;
}
+
/**
- * @param viewer The viewer to set.
+ * Sets the viewer contained in this page.
+ *
+ * @param viewer text viewer
*/
public void setViewer(TextConsoleViewer viewer) {
this.fViewer = viewer;
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java
index e8e888928..006c2a595 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java
@@ -49,7 +49,7 @@ import org.eclipse.ui.internal.console.ConsoleDocumentAdapter;
import org.eclipse.ui.internal.console.ConsoleHyperlinkPosition;
/**
- * Viewer used to display a TextConsole
+ * Default viewer used to display a <code>TextConsole</code>.
* <p>
* Clients may subclass this class.
* </p>
@@ -73,6 +73,12 @@ public class TextConsoleViewer extends TextViewer implements LineStyleListener,
private IPropertyChangeListener propertyChangeListener;
+ /**
+ * Constructs a new viewer in the given parent for the specified console.
+ *
+ * @param parent containing widget
+ * @param console text console
+ */
public TextConsoleViewer(Composite parent, TextConsole console) {
super(parent, SWT.H_SCROLL | SWT.V_SCROLL);
this.console = console;
@@ -92,18 +98,31 @@ public class TextConsoleViewer extends TextViewer implements LineStyleListener,
colorRegistry.addListener(propertyChangeListener);
}
+ /**
+ * Sets the tab width used by this viewer.
+ *
+ * @param tabWidth the tab width used by this viewer
+ */
public void setTabWidth(int tabWidth) {
StyledText styledText = getTextWidget();
styledText.setTabs(tabWidth);
styledText.redraw();
}
+ /**
+ * Sets the font used by this viewer.
+ *
+ * @param font the font used by this viewer
+ */
public void setFont(Font font) {
StyledText styledText = getTextWidget();
styledText.setFont(font);
styledText.redraw();
}
+ /**
+ * Positions the cursor at the end of the document.
+ */
protected void revealEndOfDocument() {
StyledText text = getTextWidget();
if (text != null) {
@@ -318,6 +337,11 @@ public class TextConsoleViewer extends TextViewer implements LineStyleListener,
}
}
+ /**
+ * Returns the hand cursor.
+ *
+ * @return the hand cursor
+ */
protected Cursor getHandCursor() {
if (handCursor == null) {
handCursor = new Cursor(ConsolePlugin.getStandardDisplay(), SWT.CURSOR_HAND);
@@ -325,6 +349,11 @@ public class TextConsoleViewer extends TextViewer implements LineStyleListener,
return handCursor;
}
+ /**
+ * Returns the text cursor.
+ *
+ * @return the text cursor
+ */
protected Cursor getTextCursor() {
if (textCursor == null) {
textCursor = new Cursor(ConsolePlugin.getStandardDisplay(), SWT.CURSOR_IBEAM);
@@ -332,6 +361,11 @@ public class TextConsoleViewer extends TextViewer implements LineStyleListener,
return textCursor;
}
+ /**
+ * Notification a hyperlink has been entered.
+ *
+ * @param link the link that was entered
+ */
protected void linkEntered(IHyperlink link) {
Control control = getTextWidget();
control.setRedraw(false);
@@ -346,6 +380,11 @@ public class TextConsoleViewer extends TextViewer implements LineStyleListener,
control.addMouseListener(this);
}
+ /**
+ * Notification a link was exited.
+ *
+ * @param link the link that was exited
+ */
protected void linkExited(IHyperlink link) {
link.linkExited();
hyperlink = null;
@@ -423,14 +462,20 @@ public class TextConsoleViewer extends TextViewer implements LineStyleListener,
}
/**
- * Returns the current value of <code>hyperlink</code> field
+ * Returns the currently active hyperlink or <code>null</code> if none.
*
- * @return The current value of <code>hyperlink</code> field
+ * @return the currently active hyperlink or <code>null</code> if none
*/
public IHyperlink getHyperlink() {
return hyperlink;
}
+ /**
+ * Returns the hyperlink at the specified offset, or <code>null</code> if none.
+ *
+ * @param offset offset at which a hyperlink has been requested
+ * @return hyperlink at the specified offset, or <code>null</code> if none
+ */
public IHyperlink getHyperlink(int offset) {
if (offset >= 0 && console != null) {
return console.getHyperlink(offset);
@@ -483,7 +528,10 @@ public class TextConsoleViewer extends TextViewer implements LineStyleListener,
}
/**
- * @param consoleWidth
+ * Sets the console to have a fixed character width. Use -1 to indicate that a fixed
+ * width should not be used.
+ *
+ * @param consoleWidth fixed characater width of the console, or -1
*/
public void setConsoleWidth(int width) {
consoleWidth = width;
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePatternMatcher.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePatternMatcher.java
index 8145beef0..697f224f1 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePatternMatcher.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePatternMatcher.java
@@ -197,7 +197,15 @@ public class ConsolePatternMatcher implements IDocumentListener {
*/
public void addPatternMatchListener(IPatternMatchListener matchListener) {
synchronized (patterns) {
- // TODO: check for dups
+
+ // check for dups
+ for (Iterator iter = patterns.iterator(); iter.hasNext();) {
+ CompiledPatternMatchListener element = (CompiledPatternMatchListener) iter.next();
+ if (element.listener == matchListener) {
+ return;
+ }
+ }
+
if (matchListener == null || matchListener.getPattern() == null) {
throw new IllegalArgumentException("Pattern cannot be null"); //$NON-NLS-1$
}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePage.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePage.java
index 145a1724e..52c03352c 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePage.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePage.java
@@ -67,8 +67,8 @@ public class IOConsolePage extends TextConsolePage {
* @see org.eclipse.ui.console.TextConsolePage#createViewer(org.eclipse.swt.widgets.Composite,
* org.eclipse.ui.console.TextConsole)
*/
- protected TextConsoleViewer createViewer(Composite parent, TextConsole console) {
- return new IOConsoleViewer(parent, console);
+ protected TextConsoleViewer createViewer(Composite parent) {
+ return new IOConsoleViewer(parent, (TextConsole)getConsole());
}
public void setAutoScroll(boolean scroll) {
@@ -79,7 +79,7 @@ public class IOConsolePage extends TextConsolePage {
}
/**
- * inform the viewer that it's text widget should not be editable.
+ * Informs the viewer that it's text widget should not be editable.
*/
public void setReadOnly() {
fReadOnly = true;

Back to the top