In this article we will study about Eclipse YAML Editor. For this example we will use Eclipse Luna 4.4.2. and YEdit plugin (1.0.20) which is a YAML file editor plugin.
Eclipse is an integrated development environment (IDE) used in computer programming, and is the most widely used Java IDE. It contains a base workspace and an extensible plug-in system for customizing the environment. Eclipse is written mostly in Java and its primary use is for developing Java applications, but it may also be used to develop applications in other programming languages through the use of plugins. The initial codebase originated from IBM VisualAge. The Eclipse software development kit (SDK), which includes the Java development tools, is meant for Java developers. Users can extend its abilities by installing plug-ins written for the Eclipse Platform, such as development toolkits for other programming languages, and can write and contribute their own plug-in modules.
“YAML Ain’t Markup Language” (abbreviated YAML) is a data serialization language designed to be human-friendly and work well with modern programming languages for common everyday tasks. Open, inter-operable and readily understandable tools have advanced computing immensely. YAML was designed from the start to be useful and friendly to people working with data. It uses Unicode printable characters, some of which provide structural information and the rest containing the data itself. YAML achieves a unique cleanness by minimizing the amount of structural characters and allowing the data to show itself in a natural and meaningful way. For example, indentation may be used for structure, colons separate key: value pairs, and dashes are used to create “bullet” lists.
2. Install Plugin
In this section we will see how to install a plugin in Eclipse. There are multiple ways to install an Eclipse plugin but we will make use of the most common one, which is by using Eclipse Marketplace. If you want to study more about how to install an Eclipse plugin, you can look into How to Install a plugin in Eclipse. Eclipse Marketplace Client (MPC) is a rich client interface for browsing and installing the Eclipse based solutions listed on the Eclipse Marketplace portal. It is a new feature that allows Eclipse users to discover and install Eclipse solutions directly into their Eclipse installation.
Go to Help=>Eclipse Marketplace…
The Eclipse Marketplace Client pop-up will be displayed. In the Find text box type YAML and click ‘Go’
Eclipse will display the search results. Click on the ‘Install’ button for YEdit plugin. YEdit is an editor for editing YAML files. It is implemented as a Eclipse plugin. You will be required to confirm the selected changes.
Click Confirm, Eclipse will ask you to review the licenses.
Accept the license and click Finish. Eclipse will display a warning pop-up. Click OK. Eclipse will start installing the plugin. After installation you will be asked to restart the Eclipse.
“YAML Ain’t Markup Language” (abbreviated YAML) is a data serialization language designed to be human-friendly and work well with modern programming languages for common everyday tasks. It uses Unicode printable characters, some of which provide structural information and the rest containing the data itself. YAML achieves a unique cleanness by minimizing the amount of structural characters and allowing the data to show itself in a natural and meaningful way. For example, indentation may be used for structure, colons separate key: value pairs, and dashes are used to create “bullet” lists.
The design goals for YAML are, in decreasing priority:
- YAML is easily readable by humans.
- YAML data is portable between programming languages.
- YAML matches the native data structures of agile languages.
- YAML has a consistent model to support generic tools.
- YAML supports one-pass processing.
- YAML is expressive and extensible.
- YAML is easy to implement and use.
Both JSON and YAML aim to be human readable data interchange formats. However, JSON and YAML have different priorities. JSON’s foremost design goal is simplicity and universality. Thus, JSON is trivial to generate and parse, at the cost of reduced human readability. It also uses a lowest common denominator information model, ensuring any JSON data can be easily processed by every modern programming environment.
In contrast, YAML’s foremost design goals are human readability and support for serializing arbitrary native data structures. Thus, YAML allows for extremely readable files, but is more complex to generate and parse. In addition, YAML ventures beyond the lowest common denominator data types, requiring more complex processing when crossing between different programming environments.
Now we will see how a YEdit Eclipse plugin helps to make YAML file creation and modification easier. Below is a sample YAML file opened in a normal text editor compared to the one opened in a YEdit:
You can see from the figure above that using the YAML Editor makes the file more readable and easy to maintain. You can open the file using a standard Text Editor or YEdit YAML Editor as shown in the figure 6.
Using the YAML editors gives you other benefits as well. You can toggle comments and format code using the YEdit (Plugin) menu options as shown below.
In this article we saw how to install a YAML Plugin (YEdit) in Eclipse. We also discussed what YAML is and how we can easily edit a YAML file using YEdit in Eclipse. We also saw that depending on how we use the YAML editor, formatting the code becomes easier, otherwise the developer has to do this manually.
There are other YAML file editor plugins available in Eclipse but we chose YEdit because it’s easy and powerful. You can try other plugins as well to see it they suit your requirement better than YEdit.