Archive for the ‘prototype’ Tag
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.
- mooTools-1.2.4-core.js
- mooTools more, which is a script that is built by selecting various components. I chose all the options except the non-English options, and chose no compression to create a mootools-1.2.4.4-more.js.
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 Library – User Library – Next – Select moo Library you already added. Finish.
You should see this in Explorer:
Content Assist
MooTools Problems
Supposedly, if your 3rd party library uses jsDoc, the editor functionality is more robust. MooTools does not seem to document with jsDoc.
jQuery Failure
Dojo? Prototype? YUI?
I’m wondering what experiences others have had adding 3rd party libraries or their own libraries.