Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 382160

Summary: Editor examples: require.js link dead.
Product: [ECD] Orion Reporter: Thaddee Tyl <thaddee.tyl>
Component: ClientAssignee: John Arthorne <john.arthorne>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: simon_kaegi
Version: unspecified   
Target Milestone: 0.5   
Hardware: All   
OS: All   
Whiteboard:

Description Thaddee Tyl CLA 2012-06-08 22:03:05 EDT
1. Make a fresh pull from the orion client.
2. Go to orion.client/bundles/org.eclipse.orion.client.editor/web/examples.
3. Open the html page embeddededitor.html.

The page won't work, because the link to ../../requirejs/require.js is broken.

Either there is a build step to add that require.js file, which
1. may break Orion if the require.js file is imported from the Internet
   and doesn't have the correct version,
2. is completely undocumented, and should be.

Or it is simply missing. Please add it.
Comment 1 John Arthorne CLA 2012-06-09 21:23:18 EDT
This is because at runtime there are two source trees mounted side-by-side in the server configuration. This runtime shape doesn't match the source tree shape, but there is nothing at build-time that inserts it. Since this is an example that we want people to consume, maybe we could just add a comment in the embeddededitor.html pointing to it? If it helps you in the short term, you can find the require.js script here:

https://github.com/eclipse/orion.client/tree/master/bundles/org.eclipse.orion.client.core/web/requirejs

I wouldn't recommend finding a random require.js copy on the internet because it is a fast evolving script and we may not work on older or newer versions.
Comment 2 Thaddee Tyl CLA 2012-06-12 15:19:28 EDT
John Arthorne, obviously merely copying the requirejs directory
to the correct place wasn't enough, because other js components
that are vital to the editor fail to load.

I find it unfortunate that developers that only want to use
Orion's web-based editor have to jump through hoops.
I wish each component of the system was cleanly separated
and could be worked on independently of the rest.
I'll try to see what I can do to make the experience smoother.
Comment 3 John Arthorne CLA 2012-06-12 15:29:57 EDT
(In reply to comment #2)
> John Arthorne, obviously merely copying the requirejs directory
> to the correct place wasn't enough, because other js components
> that are vital to the editor fail to load.

What error do you see, and in what example and what browser? I tried this yesterday and it worked for me (Chrome 19, Firefox 14, Windows 7). There was one bug in the textview demo that had a bad path to the js-tests component (bug 382253). But the minimal and embedded editor examples worked as standalone/offline pages once requirejs was in the right place.
Comment 4 John Arthorne CLA 2012-06-12 15:43:29 EDT
(In reply to comment #2)
> I find it unfortunate that developers that only want to use
> Orion's web-based editor have to jump through hoops.
> I wish each component of the system was cleanly separated
> and could be worked on independently of the rest.
> I'll try to see what I can do to make the experience smoother.

Any ideas here definitely welcome. I think one challenge is where to draw the line because there are many different editor embedding scenarios. Some people want a raw text editor, others want language tooling features, etc. The current examples are just three points on a large spectrum of possible configurations.
Comment 5 Thaddee Tyl CLA 2012-06-12 20:13:19 EDT
(In reply to comment #3)
> (In reply to comment #2)
> > John Arthorne, obviously merely copying the requirejs directory
> > to the correct place wasn't enough, because other js components
> > that are vital to the editor fail to load.
> 
> What error do you see, and in what example and what browser? I tried this
> yesterday and it worked for me (Chrome 19, Firefox 14, Windows 7). There was
> one bug in the textview demo that had a bad path to the js-tests component (bug
> 382253). But the minimal and embedded editor examples worked as
> standalone/offline pages once requirejs was in the right place.

For some reason, it doesn't find i18n.js (which I believe means orion.client/bundles/org.eclipse.orion.client.editor/web/orion/textview/i18n.js).

Also, it doesn't find the CSS files right off the bat, but that can at least be solved by copying the css directory from orion.client/bundles/org.eclipse.orion.client.core/web/css to orion.client/bundles/org.eclipse.orion.client.editor/web/css.
Comment 6 John Arthorne CLA 2012-07-04 16:05:54 EDT
I have added comments in the example source indicating that require.js needs to be reachable when running the example. I also wrote a post describing how to setup the examples, which should help people searching for information on it.