Adding a vertical line in text control [message #448042] |
Tue, 28 December 2004 10:31  |
Eclipse User |
|
|
|
I am working on the Subversion plugin for Eclipse. We have a commit
dialog with a Text control on it to enter a commit message. I would
like to draw a vertical line within the control at column 80 as an
assist to the user to enter line breaks in their commit message. The
Java editor in JDT has a feature similar to this. I was wondering
whether there is some relatively "easy" way to do this?
Thanks
|
|
|
Re: Adding a vertical line in text control [message #448060 is a reply to message #448042] |
Wed, 29 December 2004 19:03  |
Eclipse User |
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="serif">The JDT editor uses the StyledText widget. This is
not a native widget, but a subclass of Canvas which uses certain
methods and objects to access information like fonts, colors, carets,
and line width. It's not a terribly complex widget, but a very good
example of SWT widget emulation. The JDT editor vertical line (and all
the other features such as line highlighting and error underlining) are
all implemented through subclassing. Yes, I know, you're not supposed
to subclass widgets. However, StyledText is an emulated widget and as
such is safe for subclassing. It sounds like you're going to have to
use a StyledText widget instead of a simple Text widget and subclass it
to draw the line. Alternatively, you can use a straight StyledText
widget and add a PaintListener to it which computes the column width
and paints the line accordingly. Either way, it's a hack, but it works.<br>
<br>
Daniel<br>
</font><br>
Mark Phippard wrote:
<blockquote cite="midcqru86$br2$1@www.eclipse.org" type="cite">
<pre wrap="">I am working on the Subversion plugin for Eclipse. We have a commit
dialog with a Text control on it to enter a commit message. I would
like to draw a vertical line within the control at column 80 as an
assist to the user to enter line breaks in their commit message. The
Java editor in JDT has a feature similar to this. I was wondering
whether there is some relatively "easy" way to do this?
Thanks
</pre>
</blockquote>
</body>
</html>
|
|
|
Powered by
FUDForum. Page generated in 0.04423 seconds