Archive for the ‘jquery’ Tag

JSDT versus NetBeans

I’m spent a solid month evaluating JSDT.  The motivation for the investigation was to familiarize myself with Java Script as well as the state of the Java Script tools.  I also have some interest in building a product in the Java Script space.  Being a long-time Eclipse developer, I started with the JSDT.

Overall, the JSDT evaluation has been disappointing.  I may blog in detail about this at a later time.   Hopefully the next version will be more stable and useful.  There are links at the bottom pointing to the JSDT posts.

Some Java Script developers mentioned they had some success with NetBeans, so I decided to give NetBeans the same trial.

NetBeans: Resources

Download and Install

It wasn’t clear to me from the download page which NetBeans flavor I should download.  So I installed the ‘All’ flavor, chewing up nearly 1Gig of my hard drive!  That had everything I needed and much more.

Developing with Third Party Library

My use case for JSDT was 1. create a HTML/js project, 2. edit code, 3. leverage a third party library, 4. run the application.

NetBeans has a tutorial which does exactly that.  I followed this tutorial and had success with my use case.  No failures.  No exceptions.  No workarounds.  It just worked.  I won’t reproduce the steps of that tutorial here.  If you’re interested, try it out.  I’ll show some of the results.

Content Assist

NetBeans has knowledge of standard third party js libraries.  When I tried to use a jQuery function (after adding jQuery to my project), I get some useful content assist:

Very nice.  The Content Assist provided several useful things.

  • I showed the syntax of the method
  • Who is providing the method,
  • Which browsers I was targeting.
  • It told me which browsers this function does not work in.  (Which is why I think the method was crossed out in the CA window)
  • It included clear well-written documentation with detailed explanation and code example.

Running the Project

I right-clicked on the sample html, selected View, and the app ran in my FireFox browser.

Limitations

HTML5. Like JSDT, NetBeans doesn’t yet support HTML5.  This bug tracks it and states its slated for 6.10 (next) release in January 2011.

Java Script doesn’t seem to be a primary language of the IDE.  I had to dig deep into the menus– usually under some Other… option– to find Java Script tools.

Summary

I didn’t delve into more detailed use cases, such as debugging.  I may do that at a future time.

The use case I struggled to get running with the Helios version of JSDT worked right out of the box with NetBeans.  At some point, I would like to take myEclipse and Zend Studio— two commercial products– for a spin.

If my job was that of a JavaScript developer, I would take a long look at how NetBeans could make me more productive.

Links

Here are my blog posts related to my experiences using the JSDT:

And here are my posts regarding contributing to JSDT:

Using JSDT #5: Adding 3rd Party Library Redux

I’m documenting my experiences using the Eclipse JSDT.

My initial attempt to add a 3rd party library had mixed results.  My goal was to get some content assist working.  I was to add mooTools but not jQuery.  However, I also found my approach failed when I wanted to get the mooTools library loaded when running the app.

Previously

Don’t add Library to “JavaScript Resources”

Previously, I added the mootools library as a JavaScript Resource.  This resulted in knowledge of the mooTools library while I was coding.  I mistakenly assumed that I would be able to configure my project such that my html code would be able to load these libraries when running.  Maybe it’s possible, but I’ve yet to figure this out.

So, this does not work:

And when you try and run the example, you will notice either errors in your HTML debugging that states that the mootools libraries cannot be found, or the example will just not work properly.

My example

A side track for a second.

I’m running an example from the wrox Professional Java Script Frameworks book, a good introduction to Prototype, YUI, Ext JS, Dojo and MooTools.  The code samples can be downloaded here.  Unzip the mooTools zip file, and locate code/mootools/mootools-animation-ui.

The example contains ui.js and ui.html, and they use 2 mooTools libraries.

Solution: Add to Web Context

So instead of adding the script as libraries in the JavaScript Resources, just copy them in to the Web Context, make sure that your html references them correctly.

Successful Run

Now when I run the ui.html example, I am able to see the nice graphical effects that mooTools provides:

But, another exception

I was rewarded with this NPE exception dialog when I dragged the mooTools libraries from my File Explorer into the Web Context.  Filed this bug.

Using JSDT #4 : Adding Third Party Library

I’m documenting my experiences using the Eclipse JSDT.

In this post I will add a 3rd party library.  I will describe a success (mooTools) and a failure (jQuery).

Update: There is improved information in this post: Adding Third Party Library Redux.

Previously

Adding mooTools Library

MooTools is one JavaScript library I’ve been playing with lately.

First download the uncompressed version (mooTools-1.2.4-core-nc.js) and save it somewhere.

Now in Preferences, add the library. Make sure after adding the library, you also add the mooTools .js file you previously downloaded.  It should look like this:

MooTools Content Assist

Now create a Static Web Project.

  • Expand the project in Project Explorer and right click on JavaScript Resources and select Properties.
  • From this dialog, you can add MooTools.
  • Add JavaScript LibraryUser LibraryNext – Select moo Library you already added.  Finish.

You should see this in Explorer:

Content Assist

Now create a JavaScript file in your project and try some Content Assist.
Ah it can see the Cookie constructor!
And variables and functions that start with $:
And members:

MooTools Problems

I should mention that I could not get this to work in a workspace I had been working in for awhile.  In fact I spent many hours trying to get it to work and finally determined the workspace I was working had been corrupted somehow.  From the .log, I had experienced several crashes, some related to AST parsing, in that workspace.  And no amount of removing user libraries and creating fresh projects would allow me to see MooTools Content Assist.

Supposedly, if your 3rd party library uses jsDoc, the editor functionality is more robust.  MooTools does not seem to document with jsDoc.

jQuery Failure

Update: I’ve added bug 324416 for this problem.
I followed the same steps to add jQuery (1.4.2 uncompressed from the download page) as a user library. However, after adding it and opening it in Explorer, it seems that parsing has failed.  The AST is confused.
According to Explorer, it seems to know about the jQuery variable though.  But when I try to get some CA for jQuery, even though the jQuery variable is listed, I get none.  Same for _load, add, etc.  Nada.


Dojo? Prototype? YUI?

I’m wondering what experiences others have had adding 3rd party libraries or their own libraries.

Next: Adding Third Party Library Redux