Go to the Projects Manifest.MF file Select the extensions tab and add viewActions extension . Right click and from context menu select viewerContribution and in targetID provide the id of view where contribution is to be made. Add new action to the contribution from contextmenu. Override run method of the Action class which Implements IViewActionDelegate
public class ProfileViewActionDelegate implements IViewActionDelegate { public void init(IViewPart view) { // TODO Auto-generated method stub } @Override public void run(IAction action) { } @Override public void selectionChanged(IAction action, ISelection selection) { // TODO Auto-generated method stub } }
8
public void run(IAction action) { // TODO Auto-generated method stub MessageBox box = new MessageBox(view.getSite().getShell(),SWT.ICON_INFORMATIO N); box.setMessage("Hello! You clicked view action!"); box.open(); }
10
11
12
13
14
15
16
Q/A?
17