Archive for the ‘RText’ Category

Project Support in RText

Tuesday, September 18th, 2012

The next release of RText will include support for projects.  Projects are collections of files logically grouped together, usually a part of the same application if you’re a developer.

The project support will be not be of the same scope as projects in Eclipse, NetBeans, or Visual Studio.  Rather, RText will take the approach used by other “programmer’s editors.”

The main UI component of projects support is the “Projects” docked window.  By default it is docked on the left-hand side of RText:

Projects Support Main Panel

Projects Support Main Panel

The root node in the tree view is the current workspace.  A workspace is simply a collection of zero or more projects.  This allows you to logically group projects that are related, for example.

Workspaces are loaded and saved as XML files.  On startup, RText loads the last project you had open.  You can create a new workspace, or open an existing one, via the docked window’s popup menu:

Open an Existing Project

Open an Existing Project

Opening another workspace  automatically saves the currently open one; this way, you don’t have to worry about manually saving your workspaces or projects.

Adding a new Project to the workspace is as easy as right-clicking, selecting “New Project…”, and giving the project a name.  You can use any characters you want in project names, as they aren’t represented by a physical file or folder (they’re simply “metadata” in the parent workspace’s XML).

In each project you create, you can add Files, Folders, and Logical Folders via the context menu:

Adding an Item to a Project

Adding an Item to a Project

The “Add Files…” menu item allows you to add one or more files to the project.  Again, the files in a project don’t need to live in a common parent directory, since the project is a logical grouping of files and folders.

The “Add Folder…” menu item allows you to add an entire folder to the project.  Not only that, but you can filter what files are displayed in the project UI.  So you could only dispaly *c, *.cpp, and *.h files, for example, or filter out “CVS” folders or *.bak files.

Finally, “Add Logical Folder…” adds a folder to the project that doesn’t actually exist on disk, but you can still add files, folders, and other logical folders to it.  Think of it as an extra organizational tool; you can logically group files in the UI with logical folders.

That’s it in a nutshell.  The plugin is fully integrated with RText – double-clicking a file opens it in an editor, you can delete or rename files directly from the plugin tree view, etc.  It’s already in SVN, so check it out and see what you think!

RText 2.0.4 Released!

Friday, September 7th, 2012

RText 2.0.4 was released today on SourceForge!  See also the Javadoc and SVN repository.  This release basically provides all the new functionality in the 2.0.4 release of RSyntaxTextArea (including the Asian language fix in and fixes a couple of bugs.

I’ve been coming up with a list of changes in the 2.0.5 releases of RSTA and RText.  Look for a blog outlining them in a week or so.  Suggestions are of course welcome!

RText 2.0.3 Released

Saturday, May 5th, 2012

RText 2.0.3 was just released on SourceForge!  It’s based off of the recent 2.0.3 release of RSyntaxTextArea.  Here’s what’s new:

  • Added code folding for several languages, including C, C++, Java, Perl, XML, Groovy, C#, JavaScript, MXML, CSS and LaTeX.
  • Dockable window panels are now collapsible, allowing you to allot more screen real estate to the editors when necessary.
  • Added LaTeX syntax highlighting and code folding.
  • Added DTD syntax highlighting.
  • Added “Go to Member” shortcut (Ctrl+Shift+O) similar to Eclipse. Currently only for Java, JavaScript, and XML.
  • The Source Browser’s tree view of source code is now sortable.
  • License changed to modified BSD from GPL.  This allows folks to use pieces of RText without making their entire application GPL.

In short: code folding, more languages supported, and more liberal license.

Unfortunately, my MacBook is on the fritz, so I can’t create a Mac app bundle at the moment.  As soon as I can get this resolved, a Mac bundle will get uploaded to SourceForge.  Until then, folks on OS X can use the *nix bundle if necessary (it’s just a gzipped install).

RSyntaxTextArea & RText updated in Maven

Thursday, April 19th, 2012

Just a quick note that a user has kindly updated the RSyntaxTextArea and RText artifacts available in Maven:|ga|1|g%3A%22com.fifesoft%22%20OR%20g%3A%22com.fifesoft.rtext%22

As usual, please report any issues in the forums.

RText 2.0.0-beta2 Released

Sunday, January 15th, 2012

RText 2.0.0-beta2 was just released on SourceForge!  Why wasn’t there a “beta 1”?  Well, this release includes RSTA 2.0-beta2, and I wanted to keep their version numbers in sync, so there was no beta 1.  RText is an example of a full-featured application that takes advantage of everything RSyntaxTextArea has to offer.  Keep in mind though that this release is built on top of a beta release of RSTA, and there may be more bugs than usual (or maybe not!).

In any case, enjoy!

RText 1.5 Released on SourceForge!

Tuesday, September 13th, 2011

I’m happy to announce that RText 1.5 was released on SourceForge earlier this week.  This release brings the following changes:

  • Added scripted macro support.  You can now write macros in either JavaScript or Groovy and assign them shortcuts, essentially creating your own custom menu item actions.  This feature really allows you to extend RText in any way imaginable!
  • Added very basic JSP code completion.  Unfortunately, I have not been able to add tld support yet, but the framework is now in place.
  • Added a “stop” button to the Tool output window like the one in the Console output window.  Now you can kill runaway tools (finally!).
  • Updated to RSyntaxTextArea/AutoComplete 1.5.2.  This improves anti-aliasing in the editor, and adds options to auto-insert closing curly braces, clear whitespace-only lines on Enter presses, and painting indent/tab lines.  All of this is configurable in the Options dialog.
  • Added “Check for Updates” menu item to Help menu.
  • Made opening a file via Find in Files dialog center the matched line vertically in the editor.


Scripted Macros in next RText

Tuesday, August 23rd, 2011

In the next RText release, the old macro functionality – which recorded keystrokes in the editor component for playback – is being replaced with something much more powerful.  If you’re using Java 6 or later, you’ll be able to write scripts in Rhino or Groovy (Groovy support requires the embeddable Groovy jar to be placed on RText’s classpath), assign them shortcuts, then use them like any other action in the RText menu bar!  These scripts will run in the main RText process, and will have programmatic access to the entire application.  This truly allows you to extend RText in any way you can think of.

To create a scripted macro, choose “New Macro…” from the Macros menu:

New Macro menu item

New Macro menu item

The name of your macro must be unique among all macros, and will be the menu item text.  The description field is optional, and will display in RText’s status bar when you mouse-over the menu item.  Give the macro a keyboard shortcut (if you want to), select the scripting language you want to use, and click OK to begin creating your macro.  (Note that if you choose to use Groovy, you’ll be reminded in the dialog that the embeddable Groovy jar needs to be placed in the RText install, and RText needs to be restarted to pick it up.  Rhino works out-of-the-box with Java 6 JVM’s since it comes standard).

A script template will open in RText:

A rather large comment at the top describes the macro functionality, as well as two pre-defined variables you can use to manipulate the running RText instance:

In this file, you simply write out your macro.  As an example, below is simple Rhino script for a (very crude, and in fact mostly incorrect) word counter macro.  It counts the number of “words” in the selected text in the current editor, and displays it in a popup dialog.  Note the focus here isn’t on the actual correctness of the algorithm, but rather the overall macro structure:

Word Count Macro

Word Count Macro

Important things to take away are:

  1. Macros are run on the EDT, so you are free to call any Swing-related methods you want without wrapping them in SwingUtilities.invokeLater().
  2. It’s a good idea to wrap your macros in calls to textArea.beginAtomicEdit() and textArea.endAtomicEdit() if you will be manipulating the text in textArea.  The latter method should also be in a “finally” block, in case any unexpected exceptions are thrown.  These methods cause any action done in your macro to be remembered as a “single operation” for undo/redo purposes.  Failure to do this simply means that, if you edit the text in the text component, you may have to press Ctrl+Z multiple times to get what the macro did un-done, depending on what exactly you’re doing.  In the example above, we didn’t actually edit the text area’s contents, so beginAtomicEdit()/endAtomicEdit() weren’t strictly necessary, but I left them there for instruction.

Pretty cool, huh?  If you assigned this macro a shortcut, you can run it by simply typing said shortcut (be sure to select some text first to watch it work!).

Editing or removing macros can be easily be done in the “Macros” panel of the Options dialog.  This panel is easily accessed via the “Macros” -> “Edit Macros…” menu item.

Macros in Options dialog

Macros in Options dialog

Here you can add new macros, remove old ones, or modify existing ones (modifying either their shortcut/description, or the actual code itself).

RText 1.4.0 Released

Monday, June 13th, 2011

RText 1.4.0 has just been released on SourceForge!  Here’s what’s new this release:

  • Added Flex (MXML) syntax highlighting and source browser support.
  • Added Clojure syntax highlighting.
  • Fixed bug: the default directory for new files wasn’t persisted when modified in the Options dialog.  Thanks pmsl in the forums!
  • Added a Console plugin.  This allows you to run system commands (like a shell), as well as interact directly with the RText UI using its API via JavaScript (Rhino).
  • Improved Java code completion.
  • Updated Dutch translation (thanks Rogier), Korean translation (Kwangsub), and Traditional Chinese translation (kp200906).

Moving forward, expect to see improvements to Javascript and MXML editing, even better keyboard navigation, and (yet again) improved Java code completion (read: use less memory)!

RText 1.3.1 – Bugfix Release

Wednesday, November 24th, 2010

Wowza, just a few days after RText 1.3 was released, a major bug was discovered by a fellow on the RText forums.  This bug caused the Options dialog to not display if you didn’t have Perl installed on your machine.  You got no error message, just no Options dialog.  The cause was a nasty, unchecked NullPointerException, but as such was an easy fix.  So if you grabbed 1.3, and especially if you don’t have Perl installed, go and upgrade to 1.3.1 today!

RText 1.3.0 Released!

Saturday, November 20th, 2010

RText 1.3.0 was released on SourceForge this past Friday!  This released focused on two things:  aesthetic improvements to the UI and bug fixes.  As always, I encourage you to download it and check it out.  Here’s a rundown of what was changed:

  • Drop shadows were added to menus. This code was graciously borrowed from JGoodies, and when using WindowsLookAndFeel, really pushes us over the edge to looking like a truly native application.

    Drop shadows under menus

    Drop shadows under menus

  • Revamped external LookAndFeel support. Several Substance 6.1 skins are now selectable by default in RText.  Some tweaking may still be needed to get some custom components looking 100% with arbitrary (non-“standard”) LookAndFeels.

    RText with Graphite Glass skin

    RText with Graphite Glass skin

  • Text matches in the “Find in Files” dialog are now syntax highlighted, providing a little extra context when looking through a list of search results:

    Syntax Highlighted Search Results

    Syntax Highlighted Search Results

  • Translucent search windows now work on Java 7+, not just Java 6.  This feature is still optional and disabled by default, as translucent windows may not be a fast operation on some systems (or you may just find it annoying =)  ):

    (Optional) translucent search dialogs

    (Optional) translucent search dialogs

  • Added Copy, Paste, and Delete popup menu items on the File System Tree:

    New File System Tree options

    New File System Tree options

  • Added PERL5LIB modification support to the Perl parser – see the Perl options panel in the Options dialog.

    Overriding PERL5LIB

    Overriding PERL5LIB

  • Fixed a bug with “variables” not working for tool directories (i.e. ${file_dir}).
  • Fixed several bugs in Java code completion.
  • The relevant Throwable is now included in completion choices when inside of a catch block when editing Java:

    Java code completion in catch blocks

    Java code completion in catch blocks

  • Logging any uncaught EDT throwables to a log file in user’s home directory (AWTExceptionHandler).
  • Fixed NPE in FindInFilesTable when user switches from WinLAF to another one (workaround for JRE bug 6429812).
  • Added a “Libraries” tab to the About dialog listing all external libraries RText uses.

    About dialog lists used libraries

    About dialog lists used libraries

  • The order you put file chooser favorite directories in is now remembered.
  • Updated Spanish translation (thanks phrodo).