10.02.2013 Views

SlickEdit User Guide

SlickEdit User Guide

SlickEdit User Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ALIASES<br />

6. On the Alias options page, the Parameters group box will now display a list of the parameters that<br />

you have added.<br />

7. In the large text field on the right side of the Alias options page, you can now type the alias value.<br />

In the places where you want parameter prompting to occur, type %(ParamName), where<br />

ParamName is the parameter name that you entered in Step 3.<br />

8. Click OK when you are finished.<br />

Example: Instantiating a Variable in Java with Parameter Prompting<br />

In Java, instantiating variables can be a repetitive task. The following code shows a common Java code<br />

snippet:<br />

public class {<br />

public static void main (String args[]) {<br />

String x = new String( arg[0] );<br />

}<br />

}<br />

You could define an alias for entering new class names with variables and arguments. That way, when you<br />

press Enter after the third line and type and expand the alias, you will be prompted for the values.<br />

For this alias, use the Parameters section of the Alias options page to first define three parameters:<br />

class_name, var_name, and arg_list. Then, enter the following text for the alias value:<br />

%(class_name) %(var_name) = new %(class_name)( %(arg_list) );<br />

Creating a Language-Specific Alias from a Selection<br />

You can create a language-specific alias from a selection by following the steps below.<br />

1. Select some code.<br />

2. Right-click and select Create Alias.<br />

3. Give the alias a name and click OK.<br />

4. The language-specific Alias options page appears, from which you can edit the code to fine-tune<br />

or add parameters.<br />

<strong>SlickEdit</strong>® <strong>User</strong> <strong>Guide</strong> 281

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!