Third Edition of My Book ‘Java EE 8 Development with Eclipse’ Published

 

Third edition of my book ‘Java EE 8 Development with Eclipse‘ is now published.

I had completely re-written the previous edition of this book. The third (current) edition has three new chapters –

Chapter 12Microservices, describes how to develop and deploy microservices. It also covers the deployment of microservices in Docker container.

Chapter 13Deploying JEE Applications in the Cloud, describes how to deploy JEE applications in Amazon and Google Cloud platforms. Specifically, it describes the deployment of applications in AWS EC2, Beanstalk, Google Compute Engine, and Google App Engine. It also describes Eclipse tools that can be used for deployment to the Cloud.

Chapter 14Securing JEE Applications, describes how to secure JEE applications using authentication and authorization features of JEE containers. It also covers some of the JEE 8 security enhancements.

You can find more information about outline of each chapter at https://www.packtpub.com/mapt/book/application_development/9781788833776

– Ram Kulkarni

My Second Book Published

My second book “Java EE Development with Eclipse – Second Edition” has been published. One of the reasons I did not post much on the blog was this book. I had been working on the book for the past few months and I am very glad that it has been published now.

Java EE Development with Eclipse - Second Edition - Cover

JEE-Book-Cover-2

One of the challenges writing this book was the diverse topics that it covered – Servlets, JSP, JSF, JDO, EJB, JSM, SOAP, REST, Spring, Unit Testing, Debugging and trouble shooting performance and memory issues in Java applications. Separate books could be written, and books have been written, on some of these topics.

This book explains how to develop applications using these technology in Eclipse IDE. The focus is not just on how to use different technologies in JEE, but also on setting up development environment, testing, debugging and deploying applications developed using these technologies.

The book is available on the publisher’s site at bit.ly/1GryrTd.

-Ram Kulkarni

In-place Editing in Eclipse TreeViewer

In an Eclipse RCP application I was working on recently, I had to implement a TreeViewer with in-place editing feature. It was not easy to find all the information required to implement this, so I thought I would explain it here.

First let’s take a simple example, where hierarchical data is displayed in  a tree.
tree_viewer1

When any item in the tree is double clicked, I want to edit the value in-place.

Here is the code to create this tree, without editing support. I will first create a data model using a Map. To simplify the example, I am assuming only one level of hierarchy.

Continue reading “In-place Editing in Eclipse TreeViewer”

Implementing Eclipse Editor Plugin

I had presented a tutorial on implementing Eclipse Editor plugin a couple of years ago. Recently when I started implementing a new Eclipse editor, I was looking for that presentation, but couldn’t find it easily. I like to use my blog as reference for myself, so I thought I would post my Eclipse editor tutorial here.

For the tutorial, I created a new language called VGL (Vector Graphics Language) and built Eclipse editor plugin for it. The language is not important, and just serves the purpose for explaining how to create an editor. The tutorial starts with defining the language and then incrementally builds features of a typical Eclipse editor. I created separate projects for each step in the tutorial. There are nine Eclipse projects. Download and import project in Eclipse for each step if you want to see how it is built incrementally. The last project contains all the editor features covered in this tutorial.

Continue reading “Implementing Eclipse Editor Plugin”

Maintaining expanded/collapsed state in Eclipse TreeViewer

JFace TreeViewer is a very useful UI control for displaying hierarchical data. It is used extensively in Eclipse, for example in Project/Package/Navigator view, Outline view, Debug Variables view etc. Eclipse .org hosts a nice article on TreeViewer – How to use the JFace Tree Viewer.

To specify data and its hierarchy in the TreeViewer, you implement ITreeContentProvider interface. This interface has methods like getElements, getChildren which you need to override to provide content and structure to the TreeViewer. You would typically return array of your model objects from getElements or getChildren methods. And since it is a tree view, you can expand or collapse the nodes. The model classes for an example in the above article could be Category (book, game etc.), Book and Game. Category can have Books or Games. You might load this information from a database and pass it to the content provider object. To refresh information in the TreeViewer, you would call one of the variants of refresh() function.

Continue reading “Maintaining expanded/collapsed state in Eclipse TreeViewer”

Remote JavaScript debugging with Chrome Developer Tools

I have been using Chrome Developer Tools (CDT) for the past couple of weeks to build a JavaScript debugger. Though you can debug JavaScript in Chrome browser itself, my requirement was such that I needed a debugger that runs outside Chrome and debugs pages running in Chrome. I found that Chrome Developer Tools provides a JavaScript debugger plugin for Eclipse. CDT has exposed Java APIs, if you want to build the debugger yourself. It also has exposed JavaScript APIs for its debugger.

So I first evaluated Eclipse plugin that CDT provides. Before I get to that plugin, here are some useful links about CDT –
Continue reading “Remote JavaScript debugging with Chrome Developer Tools”

"Access restriction" error in Eclipse plugins

I spent quite a lot of time today trying to debug “Access restriction” error in one of my Eclipse plugins. In the last four years of Eclipse plugin development, I don’t recall ever facing this issue, but today suddenly some of the imports in one of the classes in my Eclipse plugin were flagged off as errors –

Access restriction: The type ISelection is not accessible due to restriction on required library <eclipse-path>\eclipse\plugins\org.eclipse.jface_3.6.1.M20100825-0800.jar

I had seen warnings about ‘restricted access’ for some of the imports earlier, but those were for classes that Eclipse discouraged to use e,g, for internal Eclipse classes. But today I was seeing errors.

The error does not tell much about what could have gone wrong. ISelection is exported from jface plugin and it is a public interface. And I had used this class without any error in other plugins.

Continue reading “"Access restriction" error in Eclipse plugins”

Eclipse SWT GridLayout – Making the widget fill horizontally

I have been stuck with the problem of making UI widgets fill horizontally in a grid layout a few times. The solution is simple, but when I have to create UI using Eclipse SWT after a long gap, I tend to forget how I had made this work earlier, so I decided to blog about this.

I had to create a simple UI with one label and associated text box. I coded it like this –

GridLayout layout = new GridLayout(2, false);
tabContainer.setLayout(layout); //this is the parent composite

Label label1 = new Label(tabContainer, SWT.NONE);
label1.setText("Some Label:");
GridData gd = new GridData();
gd.grabExcessHorizontalSpace = false;
label1.setLayoutData(gd);

Text txtBox1 = new Text(tabContainer, SWT.BORDER);
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
txtBox1.setLayoutData(gd);

Continue reading “Eclipse SWT GridLayout – Making the widget fill horizontally”

Using Java Objects in JavaScript in Eclipse SWT Browser Control

I have been developing Eclipse plugins for more than four years now. I have implemented many features in the ColdFusion Builder, which is an Eclipse based IDE. Eclipse SDK provides a SWT Browser control which can be used within Eclipse plugin to display HTML files. Eclipse does not include any browser, but it uses the system browser- on Windows it is Internet Explorer and on Macintosh it is Safari. I have used this control mainly to display static HTML content or open a URL on a remote server, e.g. for executing ColdFusion Builder extensions written in CFML.

Recently I have been doing a lot of mobile application dev elopement, and saw how easy it was to invoke Java objects from JavaScript in Android. I have blogged about this in one of my posts, Creating Android Applications with HTML User Interface. This got me thinking that it would be nice if SWT Browser control would also provide some way to pass Java Objects to JavaScript. Turned out that it is possible.

Continue reading “Using Java Objects in JavaScript in Eclipse SWT Browser Control”

Challenges in implementing ColdFusion Builder

ColdFusion 10 and ColdFusion Builder 2.0.1 released this week, on 14th May. My article on What’s new in ColdFusion Builder 2.0.1 is published on the Adobe Developer Connection. I have been working on ColdFusion Builder for close to 3.5 years now and the release of updater this week has put me in a mood to reflect on challenges we have faced so far.
Continue reading “Challenges in implementing ColdFusion Builder”

Social