Adding Portlet URL in the Portlet Toolbar in Liferay 7

Portlet URL can be added using Portlet Tool Bar Contributor module. Here also osgi plays its magic of modularity. It can be implemented through OSGI service component. Service component can be either in same module or different one. Wiki page elaborate it through blade tool. Below are steps to implement it  through eclipse IDE. 

 

Create Module Project and select Template as shown below.

 

It will auto generate Portlet Tool Bar Component class. In the component class one thing is necessary the portlet id on which you want to add toolbar.Now Override the method as shown below to add URL in Menu Item that will be redirected once user click the URL.

 

 

Deploy the module, you can see the Icon defined above on the portlet Header.

Multiple URL Menu Item Can be added following the same approach. Permission check can be done by getting the reference of permission checker in the service component.  Permission check will ensure whether to show URL to a User based on granted permissions.