code: private void initialize() {
  		if (selection != null && selection.isEmpty() == false
  				&& selection instanceof IStructuredSelection) {
  			IStructuredSelection iStructuredSelection = (IStructuredSelection) selection;
  			
  			if (iStructuredSelection.size() > 0) {
  				Object selectedObject = iStructuredSelection.getFirstElement();
  				IProject project = null;
  				
  				if (selectedObject instanceof IJavaProject) {
  					project = ((IJavaProject)selectedObject).getProject();
  				} else if (selectedObject instanceof IJavaElement) {
  					IJavaProject jProject= ((IJavaElement)selectedObject).getJavaProject();
  					project = jProject.getProject();
  				} else if (selectedObject instanceof IResource) {
  					project = ((IResource)selectedObject).getProject();
  				} 
  				
  				if (project != null) {
  					projectText.setText(project.getName());
  				}
  			}
  		}
  		serviceText.setText("mySample");
  	}
docs: Tests if the current workbench selection is a suitable container to use.