Bug 220663 [ActivityMgmt] Invalid thread access when activity is enabled
I couldn't find information about which events are supposed to be fired on any thread vs. on the UI thread. Kim, do you have a suggestion where the asyncExec should go? org.eclipse.swt.SWTException: Invalid thread access at org.eclipse.swt.SWT.error(SWT.java:3716) at org.eclipse.swt.SWT.error(SWT.java:3634) at org.eclipse.swt.SWT.error(SWT.java:3605) at org.eclipse.swt.widgets.Widget.error(Widget.java:442) at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:336) at org.eclipse.swt.widgets.Menu.getItems(Menu.java:832) at org.eclipse.jface.action.MenuManager.update(MenuManager.java:679) at org.eclipse.jface.action.MenuManager.update(MenuManager.java:638) at org.eclipse.ui.internal.menus.WorkbenchMenuService.updateManagers(WorkbenchMenuService.java:332) at org.eclipse.ui.internal.menus.WorkbenchMenuService.access$1(WorkbenchMenuService.java:327) at org.eclipse.ui.internal.menus.WorkbenchMenuService$3.activityManagerChanged(WorkbenchMenuService.java:294) at org.eclipse.ui.internal.activities.AbstractActivityManager.fireActivityManagerChanged(AbstractActivityManager.java:51) at org.eclipse.ui.internal.activities.ProxyActivityManager$1.activityManagerChanged(ProxyActivityManager.java:50) at org.eclipse.ui.internal.activities.AbstractActivityManager.fireActivityManagerChanged(AbstractActivityManager.java:51) at org.eclipse.ui.internal.activities.MutableActivityManager.setEnabledActivityIds(MutableActivityManager.java:535) at org.eclipse.ui.internal.activities.ws.WorkbenchActivitySupport.setEnabledActivityIds(WorkbenchActivitySupport.java:322) at org.eclipse.ui.activities.WorkbenchActivityHelper.enableActivities(WorkbenchActivityHelper.java:156) at org.eclipse.ui.activities.WorkbenchActivityHelper.allow(WorkbenchActivityHelper.java:120) at org.eclipse.ui.activities.WorkbenchActivityHelper.allowUseOf(WorkbenchActivityHelper.java:91) at org.eclipse.ui.internal.ide.IDEWorkbenchActivityHelper.processProject(IDEWorkbenchActivityHelper.java:202) at org.eclipse.ui.internal.ide.IDEWorkbenchActivityHelper$3.resourceChanged(IDEWorkbenchActivityHelper.java:165) at org.eclipse.core.internal.events.NotificationManager$2.run(NotificationManager.java:282) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:276) at org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:148) at org.eclipse.core.internal.resources.Workspace.broadcastPostChange(Workspace.java:313) at org.eclipse.core.internal.resources.Workspace.endOperation(Workspace.java:1022) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1809) at org.eclipse.team.core.variants.PersistantResourceVariantByteStore.run(PersistantResourceVariantByteStore.java:171) at org.eclipse.team.internal.core.subscribers.DescendantResourceVariantByteStore.run(DescendantResourceVariantByteStore.java:181) at org.eclipse.team.core.variants.ResourceVariantTree.collectChanges(ResourceVariantTree.java:110) at org.eclipse.team.internal.ccvs.core.syncinfo.CVSResourceVariantTree.collectChanges(CVSResourceVariantTree.java:87) at org.eclipse.team.core.variants.AbstractResourceVariantTree.refresh(AbstractResourceVariantTree.java:90) at org.eclipse.team.internal.ccvs.core.syncinfo.CVSResourceVariantTree.refresh(CVSResourceVariantTree.java:334) at org.eclipse.team.core.variants.AbstractResourceVariantTree.refresh(AbstractResourceVariantTree.java:54) at org.eclipse.team.core.variants.ResourceVariantTreeSubscriber.refresh(ResourceVariantTreeSubscriber.java:162) at org.eclipse.team.core.variants.ResourceVariantTreeSubscriber.refresh(ResourceVariantTreeSubscriber.java:126) at org.eclipse.team.core.subscribers.Subscriber.refresh(Subscriber.java:465) at org.eclipse.team.internal.ccvs.core.CVSWorkspaceSubscriber.refreshWithContentFetch(CVSWorkspaceSubscriber.java:434) at org.eclipse.team.internal.ccvs.ui.mappings.WorkspaceSubscriberContext.refresh(WorkspaceSubscriberContext.java:305) at org.eclipse.team.core.mapping.provider.SynchronizationContext.refresh(SynchronizationContext.java:109) at org.eclipse.team.internal.ui.synchronize.RefreshModelParticipantJob.doRefresh(RefreshModelParticipantJob.java:68) at org.eclipse.team.internal.ui.synchronize.RefreshParticipantJob.run(RefreshParticipantJob.java:309) at org.eclipse.team.internal.ui.synchronize.RefreshModelParticipantJob.run(RefreshModelParticipantJob.java:116) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/IDEWorkbenchActivityHelper.java
return;
		}
        String[] ids = project.getDescription().getNatureIds();
        if (ids.length == 0) {
			return;
		}
        
        for (int j = 0; j < ids.length; j++) {
            IPluginContribution contribution = (IPluginContribution) natureMap
                    .get(ids[j]);
            if (contribution == null) {
				continue; 
			}
            ITriggerPoint triggerPoint = workbenchActivitySupport
                    .getTriggerPointManager().getTriggerPoint(NATURE_POINT); 
            
            WorkbenchActivityHelper.allowUseOf(triggerPoint, contribution);
        }
    }
    /**
     * Unhooks the <code>IResourceChangeListener</code>.
     */
    public void shutdown() {
        if (listener != null) {
            ResourcesPlugin.getWorkspace().removeResourceChangeListener(
                    listener);
        }
    }
}