Hi Angelo, I was under the impression that you and Paul were working on this together.
Anyway, I think your comments are valuable. I'm not sure if the guy that is working on this is on this list: here is the bug [1], you should put your comments there. [1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=426397 Cheers, Wim On Thu, Mar 6, 2014 at 4:43 PM, Angelo zerr <[email protected]> wrote: > Hi E4 guys, > > I have noticed that you provide an OrionEditor based on 3x EditorPart + > OrionEditorControl : > > > http://git.eclipse.org/c/e4/org.eclipse.e4.tools.git/tree/bundles/org.eclipse.e4.tools.orion.text.editor/src/org/eclipse/e4/tools/orion/text/editor/OrionEditor.java > > At first why OrionEditor is not based on E4 part? > > I would like to share with you my skill about an OrionEditor like. Indeed > I have do the same thing than Orion with CodeMirror in my project > https://github.com/angelozerr/CodeMirror-Eclipse. > > I have a CMControl (like OrionEditorControl) and a CMEditorPart > https://github.com/angelozerr/CodeMirror-Eclipse/blob/master/core/codemirror.eclipse.ui/src/codemirror/eclipse/ui/editors/CMEditorPart.javaand > an implemetation per mode (css, js, etc). > > An interesting feature that I have done I think is that the editor like > JavascriptEditor declared in > https://github.com/angelozerr/CodeMirror-Eclipse/blob/master/mode/javascript/codemirror.eclipse.ui.javascript/plugin.xml > > works in several context : > > * RCP > * RAP > * IDE > > In your case, your OrionEditor is linked to IFile and so you can just use > it on IDE context and not for RCP and RAP context. > > To support any context, in my case I have delegate the load and save to an > extension point called cmOperations, so I can work with IFile (see > https://github.com/angelozerr/CodeMirror-Eclipse/blob/master/core/codemirror.eclipse.ui.ide/plugin.xml), > Java File (see > https://github.com/angelozerr/CodeMirror-Eclipse/blob/master/core/codemirror.eclipse.ui/plugin.xml) > , other context. > > To load/save my CodeMirror Editor from IFile, I use this cmOperations > https://github.com/angelozerr/CodeMirror-Eclipse/blob/master/core/codemirror.eclipse.ui.ide/src/codemirror/eclipse/ui/ide/operations/CMFileOperation.java > > In this code, we will see that I use file.getCharset() to load the content > of IFile. As you are linked to commons io, I suggest you to do the same > thing than me : > > > ------------------------------------------------------------------------------- > > InputStream in = file.getContents(); > > try { > return IOUtils.toString(in, file.getCharset()); > > } finally { > if (in != null) { > > in.close(); > } > } > ------------------------------------------------------------------------------- > > > I don't know if Orion has the same problem than CodeMirror, but with > CodeMorrir when you want to retrieve the text value of the editor, you must > pass the lineSeparator char (otherwise it uses a default value). > > So I had to the getLineSeparator which comes from the Eclipse preferences > to fix this problem. > > Hope my feedback will be useful for you. > > Regards Angelo > > _______________________________________________ > e4-dev mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/e4-dev > >
_______________________________________________ e4-dev mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/e4-dev
