How to build a pure e4 RCP Text Editor - eclipse-rcp

I am using the latest Eclipse 4.7 Eclipse. I am trying to build a language sensitive editor for a pure e4 RCP application. I have modeled my editor after the example XML Text Editor template project (generated from File->New->Plug-in project). I have modified it and extended it to support my custom language (loosely based on specialized XML tags/elements/attributes).
I can run this plugin on its own from the default product “org.eclipse.platform.ide” and it works just fine. But I am trying to include this plug-in into my own pure e4 RCP application and I am having a challenge in figuring out how to present my custom editor.
I try to follow the tutorial from Vogella found here: http://www.vogella.com/tutorials/EclipseEditors/article.html#add-simple-content-assist
I even purchased the Vogella book.
But that example looks nothing like the standard XML Text Editor example. From the tutorial, it mentions that to launch the editor programmatically, it implies that you need to create your own implementation of IEditorInput – but how does this relate to how the example XML Text Editor provides input for the editor through extending the FileDocuementProvider?
Perhaps the XML Text Editor example is the old 3.X way of doing things and I need to refactor my editor. I can do this – but then are there pure e4 RCP Text Editor examples similar in functionality to the XML Text Editor example? I really do need the syntax highlighting, validation, support markers, etc. found in the XML Editor example. Where can I go to learn how to do this?

Related

Eclipse Plugin: Editor for a file type with some simple elements

I want to create a plugin for Eclipse that allows me to edit a file in a graphical way. Parsing and saving the file is no problem, but I can't seem to figure out the simplest way of designing an editor in Eclipse. I guess this must be super easy, but I can only find complex examples when googling, and no simple solution for quickly sticking together a GUI as an editor (I don't want to define an entire EMF model etc. for this simple task).
The editor should only have a few simple lists and add and delete button to edit these lists. In should open when I double click the file with the appropriate file ending.
Questions:
In RCP4 required for this or just a normal editor plugin?
In started of with the normal editor plugin generated by the Wizard that provides a XMLEditor. What is the recommend way for adding these simple model editing elements (lists)?
I'm working on a similar editor using Window Builder, Forms, and EMF JFace data bindings.
It is not that complex, but I wouldn't call it simple either. Or, put it differently - it is all simple once you know how it works, but you'll have to invest some time in gaining that knowledge.
Some links which should help you get started:
https://eclipse.org/windowbuilder/
http://blog.vogella.com/2016/06/14/helping-windowbuilder/ - WindowBuilder for Neon
http://www.vogella.com/tutorials/EclipseDataBindingEMF/article.html
http://www.vogella.com/tutorials/EclipseDataBinding/article.html
https://tomsondev.files.wordpress.com/2011/05/emf-databinding.pdf
https://wiki.eclipse.org/JFace_Data_Binding
https://www.eclipse.org/articles/Article-Forms/article.html

creating text based editor plugins for eclipse wizard page

I have developed an eclipse plugin project. I need a text editor that can save, copy, paste, search. This text editor must be inserted in the wizard pages which are developed using swt.
Any suggestions?
In a plug-in you can use the JFace org.eclipse.jface.text.TextViewer.
You will to provide save and search. TextViewer does support the interface required by the Eclipse org.eclipse.ui.texteditor.FindReplaceDialog.
If you really only want SWT code then use org.eclipse.swt.custom.StyledText

Eclipse form based XML editor

Can anyone suggest me some reading for creating Form based editor in Eclipse?
The right Google term would probably be "Eclipse Forms", and there are a few articles available:
Eclipse Forms API - Tutorial
Revitalize your applications with Eclipse Forms
Eclipse Forms: Rich UI for the Rich Client
Also, in general a good place to start searching for Eclipse material is http://www.eclipse.org/articles/

Editor library used in Eclipse source

I am looking to create an editor and I was wondering if there was a Swing library which Eclipse uses for its main editor. It may be something quite basic, but I am looking for the drop down menus which come when you press full stop. Strings become symbols rather than just text.
Eclipse is rather SWT-based than Swing-based.
As for a custom editor, you could look into an eclipse-GMF-EMF-based editor with XText
Xtext is a framework for development of textual domain specific languages (DSLs).
Just describe your very own DSL using Xtext's simple EBNF grammar language and the generator will create a parser, an AST-meta model (implemented in EMF) as well as a full-featured Eclipse text editor from that.
alt text http://www.eclipse.org/Xtext/images/screenshot-title.png
The Framework integrates with technology from Eclipse Modeling such as EMF, GMF, M2T and parts of EMFT.
Development with Xtext is optimized for short turn-arounds, so that adding new features to an existing DSL is a matter of minutes. Still sophisticated programming languages can be implemented.
Actually I think you want to consider developing an Eclipse RCP application which involves using SWT, JFace and other parts of the Eclipse platform. There are many layers of editor support which are in the Platform Text component, this is what the Eclipse JDT editors are based on. The modelling stuff (GMF, EMF, etc) is probably much more than what you want. The AbstractTextEditor class in org.eclipse.ui.texteditor is a good place to start. RCP gets you a lot of other stuff as far as helping you to manage the objects you are editing, but you don't necessarily need to use this.
There are likely Eclipse corner (on eclipse.org) articles on how to do this, but the specific one escapes me now. I always just look at the code.

Why does one need the Eclipse Snippets View when editor templates already exist?

What are the tradeoffs of the Eclipse Snippets View vs. editor templates? Why were Snippets introduced in the first place?
Snippets appear to be a custom version of templates, with a view in the perspective and GUI dialogs to prompt for variable values in the template.
The only "new" functionality they have is to offer up their functionality through toolbar items in the editors.
Snippets view is sort of an extension proposed by WTP (Web Tool Platform) for template, more oriented to (web) code formatting, whereas templates help the user enter reoccurring patterns into a text editor.
So at the beginning, Eclipse Templates was a standard eclipse feature which could only be applied for java and javadocs.
Snippets are basically the same, but for other kind of files and were introduced by WTP to fill the same need, but for their own type of files (xml, jps, html, ...)
(and this is, right there, "why snippets were introduced in the first place")
Template does not have their own view, but rather an obscure Preference page (Preferences -> Java -> Editor -> Templates)
You could at the time however write a small eclipse extension in order to make a Template View.
This has been resolved since eclipse3.4M6 (Templates have their own view)
You can also build some custom advanced snippets view
Additionally, the Snippets view was first conceived during the development time frame between Eclipse 1.0 and 2.0, before the content assist templates were anywhere close to being as capable as they now are. That's why it was created, and it simply came into WTP as part of IBM's initial contribution to the project.