Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Setting up Netbeans: Difference between revisions

From MoodleDocs
(→‎CVS with NetBeans: Added instructions for developers with write access)
(→‎CVS with NetBeans: sub-headings added)
Line 45: Line 45:


NetBeans comes with '''integrated CVS support''' which might be the easiest way to check out Moodle.
NetBeans comes with '''integrated CVS support''' which might be the easiest way to check out Moodle.
=== Anonymous checkout ===


# In NetBeans, select Window->Versioning->CVS->Checkout
# In NetBeans, select Window->Versioning->CVS->Checkout
Line 65: Line 67:
# Click ''Finish''
# Click ''Finish''


IF you wish to use Netbeans CVS and have CVS write access, the procedure is as follows:
=== Checkout for developers with write access ===
 
IF you wish to use NetBeans CVS and have CVS write access, the procedure is as follows:


# Follow the above instructions except for point 3
# Follow the above instructions except for point 3
Line 81: Line 85:
# navigate to the plugin folder, copy that folder, and then navigate to your main Moodle project folder and paste it where it belongs.
# navigate to the plugin folder, copy that folder, and then navigate to your main Moodle project folder and paste it where it belongs.


=== A few warnings ===


=== Few warnings ===
Some of these warnings could also apply to other IDE:
Some of these warnings could also apply to other IDE:
* If you want to delete a file from your computer but not from CVS, delete it from Windows Explorer/Nautilus/Finder. Otherwise your next commit could delete the file from CVS. <br/>In case you have already deleted a wrong file from Netbeans:  with Windows Explorer/Nautilus/Finder, delete all the folder content of this deleted file (including the CVS folder) and update the folder.
* If you want to delete a file from your computer but not from CVS, delete it from Windows Explorer/Nautilus/Finder. Otherwise your next commit could delete the file from CVS. <br/>In case you have already deleted a wrong file from Netbeans:  with Windows Explorer/Nautilus/Finder, delete all the folder content of this deleted file (including the CVS folder) and update the folder.
* If you rename files and that other people are working on them, Netbeans could end up to mess up your CVS folder (even though that is quite rare). Then Netbeans CVS will refuse to update your code displaying a no explicit error as '''Update Failed'''. In this case, delete the content of the damaged folder with Windows Explorer/Nautilus/Finder. Then update this folder.
* If you rename files and that other people are working on them, Netbeans could end up to mess up your CVS folder (even though that is quite rare). Then Netbeans CVS will refuse to update your code displaying a no explicit error as '''Update Failed'''. In this case, delete the content of the damaged folder with Windows Explorer/Nautilus/Finder. Then update this folder.

Revision as of 07:32, 11 November 2009

NetBeans has got a good PHP support. You find a host of information on the website (tutorials, developer blog, screen casts, etc.).

Features

  • CVS integration: see all changes, lines deletion, diff in real time, show annotations, diff history...
  • Ctrl+Click: Go to declaration
  • Export/Import Diff Patch
  • Easy navigation
  • List of functions
  • Code completion
  • Instant rename
  • HTML, CSS, JavaScript support
  • MySQL manager
  • Quick Search
  • Very few bugs

Installation

Set up for Moodle development

  • Open File > New Project > PHP > PHP Application > Next
You're going to set the project now. Name, Location and Folder are used by NetBeans and are not related to the source code. So you can choose whatever you like, except your source folder. Sources has to be your checked out Moodle branch/head folder. The rest is clear enough. Don't forget to choose UTF-8 for Default Encoding.
Example:
Project Name:        Moodle 1.9 Stable
Project Location:    C:\Users\jerome\Documents\NetBeansProjects
Project Folder:      C:\Users\jerome\Documents\NetBeansProjects\Moodle 1.9 Stable
Project Sources:     C:\Users\jerome\Projects\branch19_STABLE\moodle
Project URL:         http://localhost/moodle19/
Index File:          index.php
Create:              unchecked
Default Encoding:    UTF-8
Set as Main Project: unchecked
  • Click on Finish.
  • Start coding!

CVS with NetBeans

NetBeans comes with integrated CVS support which might be the easiest way to check out Moodle.

Anonymous checkout

  1. In NetBeans, select Window->Versioning->CVS->Checkout
  2. Select Team->CVS->Checkout
  3. Enter into CVS Root: :pserver:anonymous@us.cvs.moodle.org:/cvsroot/moodle
(Non-US-residents might use one of the other Moodle CVS servers nearer to them.)
  1. Click Next
  2. Browse or enter into Module: moodle
  3. Browse or enter into Branch: MOODLE_19_STABLE
  4. Browse or enter into Local Folder: C:\xampp\htdocs
  5. Click Finish (and wait a few minutes for Moodle to be checked out)
  6. When you get the dialog box "Do you want to create an IDE project from the checked-out sources?", Click "Create Project..."
  7. Select PHP Application with Existing Sources, and click Next
  8. Browse or enter into Sources Folder C:\xampp\htdocs\moodle
  9. Enter into Project Name: moodle
  10. Keep the other defaults and click next
  11. Run As: should have selected Local Web Site (running on local web server)
  12. Enter into Project URL http://localhost/moodle/
  13. Browse or enter into Index File: index.php
  14. Click Finish

Checkout for developers with write access

IF you wish to use NetBeans CVS and have CVS write access, the procedure is as follows:

  1. Follow the above instructions except for point 3
  2. At part 3, substitute :ext:yourusername for the part before the @ and remove the country code from after it, leaving it like this :ext:yourusername@cvs.moodle.org/cvsroot/moodle
  3. Follow the rest of the instructions as above

If you wish to work with a plugin, you will need to check this out separately and add it to the Moodle code project you have just made. This because for some reason, the 'Do you want to create a project' option fails to show any of the files once you open it if you try to check out the plugin on its own (Netbeans 6.7.1 on a mac).

  1. Follow the above steps up to point 3, and again substitute :ext:yourusername and click 'next'
  2. Click 'Browse...' next to the 'Module' dialogue
  3. Find the plugin you wish to work with in CONTRIB
  4. Click 'OK'
  5. Proceed as before up to point 6, then press 'Close' when asked if you want to create a new project.
  6. Now navigate to the folder you earlier specified in the 'local folder' dialogue and you will find a folder marked 'contrib'.
  7. navigate to the plugin folder, copy that folder, and then navigate to your main Moodle project folder and paste it where it belongs.

A few warnings

Some of these warnings could also apply to other IDE:

  • If you want to delete a file from your computer but not from CVS, delete it from Windows Explorer/Nautilus/Finder. Otherwise your next commit could delete the file from CVS.
    In case you have already deleted a wrong file from Netbeans: with Windows Explorer/Nautilus/Finder, delete all the folder content of this deleted file (including the CVS folder) and update the folder.
  • If you rename files and that other people are working on them, Netbeans could end up to mess up your CVS folder (even though that is quite rare). Then Netbeans CVS will refuse to update your code displaying a no explicit error as Update Failed. In this case, delete the content of the damaged folder with Windows Explorer/Nautilus/Finder. Then update this folder.
  • If you create a patch or a new php file with Netbeans on Microsoft Windows, please check that it's a Unix format file. You may want to use another software to create Unix format patch/php file.

Optimization

1. You may want to run Netbeans with the Sun JDK. Netbeans seems to work a bit better with the Sun JDK. Download it from [1]. You'll have to edit Netbeans config file. Open netbeans/etc/netbeans.conf. Then uncomment and edit:

netbeans_jdkhome="your_JDK_path"

2. To change the Netbeans look and feel run netbeans in the command line with this parameter:

"netbeans"  --laf javax.swing.plaf.metal.MetalLookAndFeel 

3. If Netbeans starts to slow down, give it more memory

"netbeans" -J-Xmx600m

Coding faster

Keyboard shortcuts

(Note: Some shortcuts might not work for PHP development.)

See also: