Bug 77871 [GlobalActions] (Re)Build Project should track resources itself
bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/BuildAction.java
IIDEHelpContextIds.INCREMENTAL_BUILD_ACTION);
        } else {
            setText(IDEWorkbenchMessages.getString("RebuildAction.text")); 
            setToolTipText(IDEWorkbenchMessages
                    .getString("RebuildAction.tooltip")); 
            setId(ID_REBUILD_ALL);
            WorkbenchHelp.setHelp(this, IIDEHelpContextIds.FULL_BUILD_ACTION);
        }
        this.buildType = type;
    }
    /**
     * Adds the given project and all of its prerequisities, transitively,
     * to the provided set.
     */
    private void addAllProjects(IProject project, HashSet projects) {
        if (project == null || !project.isAccessible()
                || projects.contains(project))
            return;
        projects.add(project);
        try {
            IProject[] preReqs = project.getReferencedProjects();
            for (int i = 0; i < preReqs.length; i++)
                addAllProjects(preReqs[i], projects);
        } catch (CoreException e) {
            
        }
    }
    /* (non-Javadoc)
     * Method declared on WorkspaceAction.
     */