Bug 77871 [GlobalActions] (Re)Build Project should track resources itself
bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/WorkbenchActionBuilder.java
* Hooks listeners on the preference store and the window's page, perspective and selection services.
     */
    private void hookListeners() {
        pageListener = new IPageListener() {
            public void pageActivated(IWorkbenchPage page) {
                enableActions(page.getPerspective() != null);
            }
            public void pageClosed(IWorkbenchPage page) {
                IWorkbenchPage pg = getWindow().getActivePage();
                enableActions(pg != null && pg.getPerspective() != null);
            }
            public void pageOpened(IWorkbenchPage page) {
                
            }
        };
        getWindow().addPageListener(pageListener);
        perspectiveListener = new IPerspectiveListener() {
            public void perspectiveActivated(IWorkbenchPage page,
                    IPerspectiveDescriptor perspective) {
                enableActions(true);
            }
            public void perspectiveChanged(IWorkbenchPage page,
                    IPerspectiveDescriptor perspective, String changeId) {
                
            }
        };
        getWindow().addPerspectiveListener(perspectiveListener);
        prefListener = new Preferences.IPropertyChangeListener() {
            public void propertyChange(Preferences.PropertyChangeEvent event) {
                if (event.getProperty().equals(