SWediT Frequently Asked Questions
1) What the heck is SWediT?
SWediT is a text editor written in Java using SWT. See question 2 for more info on SWT. SWediT is pronounced as one word, basically the word “edit” with a “swe” sound in front of it. If you say it to a random person, they will think you said “sweat it.” The capitalization is to note the reliance on SWT, not to change the pronunciation to “es -- double-u -- eddy -- tee.”
2) Where can I find out more information on SWT?
SWT is the Standard Widget Toolkit. It is an alternative to AWT and Swing. The key players in SWT are the Eclipse consortium, Object Technology International (OTI), and IBM. The advantage of SWT is that it tends have the functionality of Swing while maintaining the native look and feel of the platform it is running on. There is also a performance advantage over Swing in many cases. The disadvantage, of course, is that it is not part of the “standard” Sun Java.
3) What idiot thought the world needed another text
editor?
Well, the problem was VEDIT. VEDIT is a text editor from Greenview Data, Inc. that runs on several platforms, notably QNX 4.2x. This is important because that’s what my co-workers and I used for many years. When QNX released 6.x / Neutrino / Momentics, VEDIT didn’t work on it and Greenview Data was uninterested in porting to it.
I know, I know, there’re a million text editors out there. Things are a little more complicated in the QNX 6.x world, though. The choices were pretty much as follows: the stand QNX Photon editor ped (no undo function), the old QNX text-based editor qed (no longer supported), emacs (which we’ll talk about later), vi or a clone (also later), workspace (freeware from a QNX user, but we didn’t like it that much), and handful of others like JOE (very much like emacs) and mp (couldn’t be configured the way we like). That left us with either learning a new editor we didn’t like or writing one from scratch. BTW, you may see nedit available for QNX 6.x. It was available for 6.1, but when we started using 6.2 the 6.1 version broke. Also, nedit and all X Windows applications launch very slowly QNX Photon.
Please note that I don’t really expect anyone to use this text editor. It was written for internal use. It was made open source largely on a lark.
4) Why didn’t you just use emacs?
First of all, emacs isn’t as customizable as you think. I have seen 3000 line elisp files, such as the excellent cua.el from Kim Storm. My whole text editor is about that size! What’s the point of being able to configure if I can rewrite from scratch in less space? Besides, some things can’t really be messed with. A simple example; try and map the escape key to quit (which is normally Ctrl-G) and still use the Alt key as Meta.
On top of this, emacs on QNX requires X to be installed, even if you are only running in a terminal. A special program called XPhoton must be running, which fools X programs into thinking that Photon is really X Windows. This process slows emacs down and makes it even bulkier than it normally is.
5) Why didn’t you just use vi?
You have got to be kidding me. Vi was a brilliant innovation in 1976. I’m very glad it was written. The idea of modes (editing mode versus command mode) was a great idea at the time. All modern editors should be modeless. I know that people who know vi really well claim they can be just as fast or faster than someone working in a modeless text editor. This is a bit like Michael Jordan bragging that he can beat me at basketball with one hand tied behind his back. It’s not that he’s not good with one hand tied, it’s that you shouldn’t deliberately tie one hand if you are looking for productivity.
5) Why didn’t you just use the Eclipse IDE?
On QNX, if you want to use the Eclipse IDE for commercial purposes you pay quite a bit of money. On top of that, Eclipse is big, bulky, and slow. Because all of our systems are custom, we use “embedded” targets as development machines. That means the size of our dev tools matter to us.
6) How do I get SWediT?
SWediT is available from its Project Page at SourceForge.net.
7) How do I compile SWediT?
Basically, your command line should look something like “javac –classpath .;c:\jdk1.3.1\bin;c:\jdk1.3.1\lib;swt.jar SWediT.java” On QNX 6.x, this looks something like “j9c –classpath .;/usr/eclipse/ive/bin; /usr/eclipse/ive/lib;swt.jar SWediT.java” If swt.jar is already in your CLASSPATH, you don’t have to worry about it. I tend to put it in the same directory as my source so I can ditch the –classpath option. If you don’t have swt.jar (and the corresponding .dll or .so shared library) you will need to get it from Eclipse.org.
8) How do I run SWediT?
“java –cp .;c:\jdk1.3.1\bin;c:\jdk1.3.1\lib;swt.jar SWediT.java” or “j9 –cp .;/usr/eclipse/ive/bin; /usr/eclipse/ive/lib;swt.jar SWediT.java” Now you need not just swt.jar in the classpath but the shared library as well. On Windows, this file is named something like swt-win32-2047.dll, while on QNX it will be libswt-photon-2047.so. On Windows, copying the .dll to \Winnt\system32 is usually a good option; on QNX you can put it with all the other j9 .so files in /usr/eclipse/ive/bin.
9) Hey! Your editor completely screwed up my file, and all I did was open, save, close!
Yes. One of the things that has driven us crazy over the years is strange junk characters getting into our source files. We’ve spent hours trying to figure out why a program won’t compile only to later discover a hidden control character at the end of the document. So SWediT discards all characters outside the range of ASCII 32 through 126. This means line art is discarded, control characters are ignored, accented letters are gone, and more. The only exceptions are the ‘\n’ characters that mark a new line (ASCII 13) and the ‘\t’ tab characters (ASCII 9). SWediT is not appropriate if you need these characters.
10) What are the key mappings?
Well, the program is designed have configurable key mapping, but I haven’t actually created a way for users to enter them yet. At some point there will be some real documentation and a method inside the program for examining the key map.
11) Why should I use SWediT?
You shouldn’t, probably. There is a little more reason to use it if you are on QNX 6.x, but even then you’re probably better off with something else. I had fairly unusual requirements. These included the following: (1) configurable, so that I could make my editor look like Notepad and like VEDIT; (2) character-at-a-time, unlimited undo/redo; (3) removal of junk characters; (4) works on QNX and Windows; (5) limited retraining of myself and co-workers; (6) matching open and close parenthesis, square brackets, and curly braces; (7) block-selection mode; (8) multiple buffers; (9) reasonably small installed size; (10) reasonable performance. Syntax highlighting is desirable and is on the features-to-be-added list. Things that we did not want that many editors provide include: (1) file compare; (2) printing; (3) word wrap; (4) integration with other programs, such as e-mail or an IDE; (5) macros; (6) spell check; (7) bookmarks; (8) window tiling.
12) Frequently Asked Questions, huh? How many people have ever actually asked a question about SWediT?
Um, er… Okay, none. But these are some of the questions that might get asked if any one ever stumbles across SWediT.
13) Be honest. What text editor did you use to write your text editor?
Mostly TextPad, which I highly recommend. I also used Notepad, believe it or not, because my Windows machine at work does not have anything better. However, at about two weeks of development I started using SWediT almost exclusively for its own development. I still use TextPad on my home machine as the default text editor, and Notepad at work. I’m hoping this will change in the next few weeks, but I’m keeping TextPad around just in case.
As side note, using TextPad really does increase my productivity over Notepad. The main things it’s got are the indent/undent features, block mode selection, and syntax highlighting. When SWediT has these, I will stop using TextPad.
14) What idiot wrote that license?
The complete text of license can be found here. Basically, I took the MIT license and then went looking through every license I could find and added their requirements to the MIT license. I’m particularly fond of the part about not using SWediT for online control of a nuclear facility. There is a very dry sense of humor going on here, and I certainly understand if you don’t get it.
15) What kind of idiot starts FAQ items with “What
idiot…”
Umm… me?
16) I looked at your source code and it’s the worst written garbage I’ve ever seen. Are you a complete idiot?
Oh, no. I’m much worse than that. A complete idiot couldn’t write code nearly as badly as me. You have to be a pretty good programmer to write code as bad mine. I’m just smart enough to be a danger. Don’t worry, though; the terms of the license prohibit anyone from using my program for anything dangerous, like aircraft control.
17) All right, wise-guy. Who are you, anyway?
My name is James Ingraham. I work for Sage Automation, Inc. as Software Engineering Team Leader.