Moodle and NetBeans

I have been using NetBeans while for a while now as my IDE of choice, specifically when writing code for Moodle.

The one thing I don’t do, is spend a lot of time customising the IDE. The one thing I did pick up though was creating shortcuts – like the ones you would use in say Emmet.

For those not familiar with the process, this is what I did. Say for example you would like to add notifications to the screen. The Moodle code for that would look something like this:

\core\notification::add(‘Enrolled into courses and groups ‘, ‘success’);

This allows you to send a message to the user, and define the background. You read more about that here: moodleroot/lib/classes/notifications.php

To type out the notification each time is not really a problem, but you could create a shortcut in NetBeans for the task. To create the shortcut,

Click Tools -> Options from the main menu.

nb_shortcut_1.jpg

Once the options menu has loaded, click the Editor tab.

nb_shortcut_2jpg.jpg

The Editor tab lists the current shortcuts available in NetBeans. Click the New button.

nb_shortcut_3.jpg

Enter a name of the shortcut. I create my using m_ and the name of the shortcut.

nb_shortcut_4.jpg

Add the code for the new shortcut and click Apply.

nb_shortcut_5.jpg

To use the shortcut in NetBeans, simply type the shortcut code and press the tab key.

nb_shortcut_6.jpg

The above is a quick example, but you can use it for creating methods as well, where it does become a time saver.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s