if (mSelection instanceof IStructuredSelection) {
IStructuredSelection selection = (IStructuredSelection)mSelection;
// get the unique selected item.
if (selection.size() == 1) {
Object element = selection.getFirstElement();
// get the project object from it.
IProject project = null;
if (element instanceof IProject) {
project = (IProject) element;
} else if (element instanceof IAdaptable) {
project = (IProject) ((IAdaptable) element).getAdapter(IProject.class);
}
// and finally do the action
if (project != null) {
ExportHelper.exportProject(project);
}
}
}