Action or Handler

When I code using swing, I used to wrote the controller part of the MVC in Action classes. So, when I code in eclipse RCP, I wrote it also in Action classes.

I was wrong.

The code was fine until the program need to get the result of the business process operations. The Action class in eclipse RCP doesn’t return anything. After I searched the answer for two whole days, I found that there is a plugin called org.eclipse.core.command. The Action classes I was using is commonly used for handling events in a view’s menus. The Eclipse use command design pattern.

In command design pattern, there is a command, the invoker, and the handler of commands. The invoker is the view, which then issues commands, and the commands appoint which handler is supposed to handle the command.

In short, this is what happened after I changed my program :

View -> command registry -> command, and states -> handler -> business process -> handler -> View

And thats it. The handlers is able to return values using state.

How about the Action classes I mentioned earlier ?

The Action class is able to use the Command class to do the task. Then you can put the Action class in menus.

powered by performancing firefox


No comments yet

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: