Out of the box, RDPi makes programming faster. Now let me show you what happens when you make a few tweaks under the hood to make your editor fly!
RDPi is an incredible tool. Whether it's something new like the Screen and Report Designers or something as standard as the LPEX editor, there's almost no part of programming where RDPi won't make your life a little easier. And that's just from day one after installing the tool. However, as powerful as RDPi is, it still has room for some personalization, the kind of tweaks that can make the tool as comfortable as your favorite chair.
In my previous article, I showed you the power of base RDPi in making traditional programming changes; in this article, I'll show you how to shave precious seconds off of those repetitive tasks that are so common in our job. Let's see if I can fit five speed techniques in one article, shall we?
First We Need to Venture Where There Be Dragons!
OK, not quite. But we do have to use the dreaded Preferences dialog. Fear not, though, intrepid reader. One of the tips in this article is a trick for navigating the Preferences just a little bit more easily.
Figure 1: The path to the treasure of user actions leads through the dreaded Preferences menu. (Click images to enlarge.)
Shown in Figure 1, the Preferences dialog has rightly earned the sobriquet "The Sargasso Sea of Eclipse." That's because every user setting ends up in here in a huge unwieldy collection of thousands of options. I'm not kidding, either: the General category alone has hundreds of settings. And while the tree control is probably the most logical way to navigate, it's not particularly efficient, especially when digging down several levels. But there is hope!
Figure 2: RDPi provides a nice way to filter only those options you need.
The filter text at the top of the option tree allows you to enter a text string that will be used to filter all the myriad options and categories in the system. Note that this technique not only selects categories whose names match the filter, but also categories that have options whose names match the filter. For example, in Figure 2, the Password Management dialog shows up in the list because it has an option Username (you can't see it because I'm showing the User Key Actions dialog, but trust me: it's there!). Cool, eh? That's speed trick number one. Number two is right on its heels: as powerful as the text filter is, it becomes even more powerful when you know you can use wildcards! For example, "user*act" would have selected only User Actions, User Key Actions, and User Mouse Actions.
Defining User Key Actions
In the previous article, I used a menu option to filter my source code to show only the lines that contained the text I had highlighted. The option can be found under the Edit menu (Edit > Selected > Filter selection), but that's cumbersome; you have to actually move your cursor out of the source code to get to the main menu. The same option exists in the context menu (the one that pops up when you right-click), but even that requires several clicks and a couple of mouse movements. Faster, certainly, but not fast. And we're shooting for cheetah fast. Let's see how we do that.
The obvious way is to use a User Key Action. Referring again to Figure 2, you'll see that I've created a new user key action by tying a keystroke (in this case, Alt+F) to a specific editor action, namely filterSelection. A couple of points need mentioning: first, you have to remember the proper shorthand for the keystrokes (well, you don't have to memorize them; they are in the Help for this dialog). Notice that a-f is Alt+F, while a-s-f is Alt+Shift+F. The prefixes are a for Alt, c for Control, and s for Shift, and as you can see, you can combine them. Press Set to add the combination to the list.
Productivity tip number three is a two-parter. First, be very careful with your keystroke definition. Not only do you have to manually enter the keystroke (there is no way to capture a keystroke from the keyboard), but you can enter an invalid value and the editor takes it! I did "Alt-f" a few times until I figured that out. Hint: the dialog will show the correct key to the right of the entry field if you enter something syntactically correct. Note: always, always remember to hit the Set button. If you hit OK before hitting Set, the dialog goes away and you lose the action you so laboriously concocted.
OK, having created the new action, you can now use it. Hit OK and return to editing your source. Select some text and then press Alt-F in your editor; this will invoke the "filterSelection" action and will filter your source based on the selected text. And that's speed tip four. In fact, tip four is an aggregate tip because it allows you to automate a whole range of actions: you can select any action from the dropdown and tie it to any keystroke. The trick is knowing which action does what. That's primarily investigative testing: configure one and see what it does. Sometimes, there are several that seem to do similar things. An example might be the three commands split, splitAndShift, and splitLine. Each is a variation of splitting a line, with the difference being how much the second line is indented. What I did was assign each one to a different key (I use Alt-1, Alt-2, and Alt-3, because they're easy to remember and don't typically conflict with other shortcuts). Personally, I prefer the splitLine, but I'll leave it as an exercise for you. In another article, I'll try to give a more complete analysis of the various available actions, but let me list a few of my favorites.
You already known filterSelected; it filters based on the currently selected code. Another favorite is blockFill, which fills a rectangle. Mark a rectangle using Alt-R and fill it with the same text repeated (think of adding modification marks or commenting out sections of code). A little-known action is hexEditLine. It lets you edit the hex code of a source line. The really cool feature is that it allows you to edit in EBCDIC, ASCII, or even Unicode (see Figure 3).
Figure 3: The hex editor allows you to edit the hex code of a source using any of several character encodings.
Leaving You with the Mouse
At this point you can double-click on a word (such as a file or field name or an opcode) and then hit Alt-F to filter the source to show only those lines with that code. It's fast, but it's not cheetah fast. Why? Because I still have to switch between mouse and keyboard. Even though I made the keystroke a left-handed one (Alt-F is pretty easy to hit with the left hand), it's not completely fluid. And thus the fifth and final tip: using the mouse!
Figure 4: This configuration allows me to switch in and out of filtered mode using the mouse wheel.
User Mouse Actions is the dialog that does for mouse events what User Key Actions does for keystrokes. The event definition is quite sophisticated; I was surprised by just how many variations of the mouse event you could define. How about Alt-left-button-triple-click? However, a complex action defeated my purpose. I wanted something quick and simple, so I went with the wheel. The wheelUp action means rolling the wheel away from you (toward the top of the mouse), while wheelDown is the opposite. In map software like Google Maps, wheel up zooms in, and wheel down zooms out, so I made wheel up filter the source code ("zooming" into the filtered source) and wheel down executes the showAll action, which "zooms out" to show all the code. A bit of a stretch, but I don't care because now I am truly cheetah fast!
Seriously, I can double-click on a file name and push the wheel up to see only the lines where the file is used, see a line I want to review, then click on that line and wheel down to show the code in context at that point. At that point, I can then click on something else and continue the process. This works really well when I'm watching how variables are set: I click on one variable, see where it gets its value, and then click on that variable and filter it, and so on.
So there you have it. A quick set of tips for using User Key Actions and User Mouse Actions to supercharge your editor. I hope this inspires you to do a little investigating of your own!
LATEST COMMENTS
MC Press Online