/** {@inheritDoc} */
 public void dispose() {
   if (fActions != null) {
     final ISelectionProvider provider = fSite.getSelectionProvider();
     for (Iterator iter = fActions.iterator(); iter.hasNext(); ) {
       Action action = (Action) iter.next();
       if (action instanceof ISelectionChangedListener)
         provider.removeSelectionChangedListener((ISelectionChangedListener) action);
     }
   }
   fActions = null;
   super.dispose();
 }
  private GenerateIncludePathActionGroup(IWorkbenchSite site) {
    fSite = site;
    fActions = new ArrayList();

    final RemoveFromIncludepathAction remove = new RemoveFromIncludepathAction(site);
    fActions.add(remove);

    final ConfigurePHPIncludePathAction configure = new ConfigurePHPIncludePathAction(site);
    fActions.add(configure);

    final ISelectionProvider provider = fSite.getSelectionProvider();
    for (Iterator iter = fActions.iterator(); iter.hasNext(); ) {
      Action action = (Action) iter.next();
      if (action instanceof ISelectionChangedListener) {
        provider.addSelectionChangedListener((ISelectionChangedListener) action);
      }
    }
  }
  private boolean canOperateOnSelection() {
    ISelection sel = fSite.getSelectionProvider().getSelection();
    if (!(sel instanceof IStructuredSelection)) return false;
    IStructuredSelection selection = (IStructuredSelection) sel;

    if (selection.isEmpty()) {
      return false;
    }

    for (Iterator iter = selection.iterator(); iter.hasNext(); ) {
      Object element = iter.next();

      if (element instanceof IProject) {
        IProject project = (IProject) element;
        if (!project.isAccessible()) {
          return false;
        }
      }

      if (element instanceof IWorkingSet) return false;
    }
    return true;
  }