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

Bug 347826

Summary: [client] organization of editor-related files
Product: [ECD] Orion Reporter: Susan McCourt <susan>
Component: ClientAssignee: Felipe Heidrich <eclipse.felipe>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: bokowski, eclipse.felipe, john.arthorne, johnjbarton, mamacdon, mihai.sucan, Silenio_Quarti, simon_kaegi
Version: 0.2   
Target Milestone: 0.2   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Susan McCourt CLA 2011-05-31 12:28:30 EDT
We have done some work to allow the source editing features to be consumed independently of the rest of the Orion client (bug 337647 and bug 340926).  What we haven't done is group all of the files together so that it's easy to know what you need.

In addition, some of the samples have evolved into the real implementations, and we might consider moving them out of "samples" directories.

The editor may be consumed in non-source editing situations, so we need to organize this in a way that still meets the original requirements of assuming the low level text widget without having to figure out all the other stuff.

See discussion here.
http://dev.eclipse.org/mhonarc/lists/orion-dev/msg00587.html
Comment 1 Susan McCourt CLA 2011-05-31 16:22:51 EDT
files used by embedded editor example:

<script src="/editor/samples/styler.js"></script>
<script src="/editor/samples/rulers.js"></script>
<script src="/editor/samples/undoStack.js"></script>
<script src="/editor/js/model.js"></script>
<script src="/editor/js/editor.js"></script>	

<script src="/js/editorFeatures.js"></script>
<script src="/js/contentAssist.js"></script>
<script src="/js/contentAssist/webContentAssist.js"></script>
<script src="/js/editorContainer.js"></script>


We also need HTML syntax highlighting to be accessible at this level.
Comment 2 John J. Barton CLA 2011-05-31 18:50:24 EDT
I think you are proposing to move the files listed in comment 1 to a common directory?

From my perspective, the key is to have the files all with in client.editor or client.code. The date appears in the name "core" so build tools are much harder to write unless the files all share a common directory.
Comment 3 Mark Macdonald CLA 2011-06-01 10:47:04 EDT
(In reply to comment #1)
> We also need HTML syntax highlighting to be accessible at this level.

For this, I'll need to add

<script src="/js/styler/htmlSyntaxHighlight.js"></script>
<script src="/js/styler/textMateStyler.js"></script>

To that list of files in Comment 1.
Comment 4 Felipe Heidrich CLA 2011-06-01 11:01:10 EDT
Current:

server mapping /org.eclipse.orion.client.editor/web/ -> /editor

js
	editor.js  - eclipse.Editor, eclipse.KeyBinding, 
	model.js - eclipse.TextModel

samples
	brkp_obj.gif
	browserEditor.html [remove]
	console.js [move content to demo.html and delete this file]
	demo.html
	editor.css [includes css for the editor, styler, and rulers - need to be slit so rulers.js can be moved out of sample]
	rulers.js - eclipse.Ruler, eclipse.LineNumberRuler, eclipse.AnnotationRuler, eclipse.OverviewRuler
	styler.js - eclipse.TextStyler
	styles.txt [remove]
	text.txt
	todo.gif
	undoStack.js - eclipse.UndoStack
	white_space.png
	white_tab.png
	
	
html imports
	<script src="/editor/js/model.js"></script>
	<script src="/editor/js/editor.js"></script>	
    <script src="/editor/samples/styler.js"></script>
	<script src="/editor/samples/rulers.js"></script>
	<script src="/editor/samples/undoStack.js"></script>


Proposed:

server mapping /org.eclipse.orion.client.editor/web/ -> /

orion
	editor
		TextView.js	- orion.editor.TextView, orion.editor.KeyBinding (was eclipse.Editor, eclipse.KeyBinding)
		TextModel.js - orion.editor.TextModel (was eclipse.TextModel)
		Rulers.js - orion.editor.Ruler, orion.editor.LineNumberRuler, orion.editor.AnnotationRuler, orion.editor.OverviewRuler (was eclipse.Ruler, eclipse.LineNumberRuler, eclipse.AnnotationRuler, eclipse.OverviewRuler)
		UndoStack.js - orion.editor.UndoStack (was eclipse.UndoStack)
		textview.css (css for the TextView)
		rulers.css (css for the rulers)
		
	samples	
		demo.html
		TextStyler.js - orion.samples.TextStyler (was eclipse.TextStyler)
		textstyler.css (css for the text styler)
		text.txt
		images
			brkp_obj.gif
			todo.gif
			white_space.png
			white_tab.png
			
html imports
	<script src="/orion/editor/TextModel.js"></script>
	<script src="/orion/editor/TextView.js"></script>	
    <script src="/orion/editor/Rulers.js"></script>
	<script src="/orion/editor/UndoStack.js"></script>
	<script src="/orion/samples/TextStyler.js"></script>
	
	
	
Replaces that will need changing:
org.eclipse.orion.client.core
org.eclipse.orion.client.editor
org.eclipse.orion.server.configurator [for the server mapping]
org.eclipse.orion.releng [for the build scripts]
org.eclipse.orion.client.git/static/git-status.html


--------------------------------------------------

Suggestions ?

Questions:
- Should be use orion.editor.TextView or just orion.TextView ? I lean toward orion.editor.TextView to minimize changes to conflict in the namespace and URI

org.eclipse.orion.client.core has a folder called 'static' for the html content, org.eclipse.orion.client.editor has folder called 'web' for the html content
- I like web better, but most importantly I think we should use the same name whatever name we decide ?

Susan, are you moving the editor-related files from org.eclipse.orion.client.core to org.eclipse.orion.client.editor ?
If so, which files, and where would you like them to go ?

Mark, what about the text mate work, should it be moved to org.eclipse.orion.client.editor ?
If so, which files, and where would you like them to go ?

Final note: the current styler.js besides providing syntax coloring it also provide bracket matching and highlight current line,
moving highlight current line to a separate file would be easy enough, but bracket matching would be much harder as it uses the token information 
generate by the scanner to skip brackets inside of string literals and comments.
Mark, is bracket matching being provided by the new text mate styler ?
Comment 5 Susan McCourt CLA 2011-06-01 12:35:55 EDT
adding John A. and Simon to discussion since they've been dealing with namespace issues in the services and in require js work

JJB - do you have an opinion on the use of "static" vs. "web" for the directory name?  What would you expect?

(In reply to comment #4)

> Proposed:

Overall I like what you are proposing. 

> orion
>     editor
>         TextView.js    - orion.editor.TextView, orion.editor.KeyBinding (was
> eclipse.Editor, eclipse.KeyBinding)

I have a copy of KeyBinding in commands.js.  We could split this out and I wouldn't have to copy it.  I realize it's very small, just trying to prevent copied code where possible.


> 
> Questions:
> - Should be use orion.editor.TextView or just orion.TextView ? I lean toward
> orion.editor.TextView to minimize changes to conflict in the namespace and URI

Me too but not strongly.   For namespacing I defer to Simon and John for opinions.  We use orion.edit to group the edit related services so it seems logical to me.

> 
> org.eclipse.orion.client.core has a folder called 'static' for the html
> content, org.eclipse.orion.client.editor has folder called 'web' for the html
> content
> - I like web better, but most importantly I think we should use the same name
> whatever name we decide ?

Agree it should be the same, I don't have a preference.  What does the web/js community expect?  (I asked JJB this question at the top)

> 
> Susan, are you moving the editor-related files from
> org.eclipse.orion.client.core to org.eclipse.orion.client.editor ?
> If so, which files, and where would you like them to go ?

Boris told me you and Simon were doing this, but I'm happy to do it as a second step.  Just let me know.  Are you ok with these things going in org.eclipse.orion.client.editor?
Makes sense to me.
Do we want a subfolder ("features") to distinguish the add-on functionality vs. raw widget functionality?  Consumers of the whole thing like to have it in one place.  What about consumers of non-source editing (do we have any?)

The files that need to be moved are:
<script src="/js/editorFeatures.js"></script>
<script src="/js/contentAssist.js"></script>
<script src="/js/contentAssist/webContentAssist.js"></script>
<script src="/js/editorContainer.js"></script>
<script src="/js/styler/htmlSyntaxHighlight.js"></script>
<script src="/js/styler/textMateStyler.js"></script>

We should also move these files from static/examples to the editor samples directory
"/examples/embeddededitor.js"
"/examples/embeddededitor.html"
"/examples/embeddededitor.css"
"/examples/minimaleditor.js"
"/examples/minimaleditor.html"

We also need to rename the file editorContainer.js to editor.js
Also need to rename classes to orion namespace and rename "EditorContainer" to "Editor"
Comment 6 Mark Macdonald CLA 2011-06-01 13:10:56 EDT
(In reply to comment #4)
> Mark, what about the text mate work, should it be moved to org.eclipse.orion.client.editor ?
> If so, which files, and where would you like them to go ?

It should go with the add-on functionality (alone with content assist, etc).

> Mark, is bracket matching being provided by the new text mate styler ?
No.
Comment 7 John J. Barton CLA 2011-06-01 17:38:26 EDT
(In reply to comment #5)
> JJB - do you have an opinion on the use of "static" vs. "web" for the directory
> name?  What would you expect?

Neither path segment appears in the relative URL so it won't matter. We'll be searching for the files listed in the .html file. If we find them all under some common stable directory name we are happy! The part that is harder to deal with is when the relative urls map to completely different bundles.
Comment 8 Felipe Heidrich CLA 2011-06-03 09:43:11 EDT
Yesterday I released the first part of this work, this includes
moving and renaming all the text view related files.
Fix the editor related files to point to the new names.
Name change sumary:
eclipse.Editor 			-> orion.textview.TextView
eclipse.KeyBinding 		-> orion.textview.KeyBinding
eclipse.TextModel 		-> orion.textview.TextModel
eclipse.Ruler 			-> orion.textview.Ruler
eclipse.LineNumberRuler		-> orion.textview.LineNumberRuler
eclipse.AnnotationRuler		-> orion.textview.AnnotationRuler
eclipse.OverviewRuler		-> orion.textview.OverviewRuler
eclipse.UndoStack.js		-> orion.textview.UndoStack
eclipse.TextStyler		-> examples.textview.TextStyler

The changes in the filesystem:
#       renamed:    web/samples/styler.js -> web/examples/textview/TextStyler.js
#       renamed:    web/samples/demo.html -> web/examples/textview/demo.html
#       renamed:    web/samples/brkp_obj.gif -> web/examples/textview/images/brkp_obj.gif
#       renamed:    web/samples/todo.gif -> web/examples/textview/images/todo.gif
#       renamed:    web/samples/white_space.png -> web/examples/textview/images/white_space.png
#       renamed:    web/samples/white_tab.png -> web/examples/textview/images/white_tab.png
#       renamed:    web/samples/text.txt -> web/examples/textview/text.txt
#       new file:   web/examples/textview/textstyler.css
#       new file:   web/orion/textview/KeyBinding.js
#       renamed:    web/samples/rulers.js -> web/orion/textview/Rulers.js
#       renamed:    web/js/model.js -> web/orion/textview/TextModel.js
#       renamed:    web/js/editor.js -> web/orion/textview/TextView.js
#       renamed:    web/samples/undoStack.js -> web/orion/textview/UndoStack.js
#       new file:   web/orion/textview/rulers.css
#       new file:   web/orion/textview/textview.css
#       deleted:    web/samples/console.js
#       deleted:    web/samples/editor.css

What is missing:

-Fix js-tests
-Move editor related files 
-Add requiredJS capability to textview and editor files
Comment 9 Felipe Heidrich CLA 2011-06-06 11:16:47 EDT
Last Friday Simon close and rename all the remaining files.
/org.eclipse.orion.client.editor
  /web/orion/editor/
    contentAssist.js
    editor.js
    editorFeatures.js
    htmlGrammar.js
    textMateStyler.js
    webContentAssist.js

  /web/examples/editor/
    embeddededitor.css
    embeddededitor.html
    embeddededitor.js
    htmlStyles.css
    minimaleditor.css
    minimaleditor.html
    minimaleditor.js
    images/
      skinnyheaderlogo.png

Closing this bug as fixed