| Summary: | Project#hasNature returns false during project open event, even though project does have nature | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | James Blackburn <jamesblackburn+eclipse> | ||||
| Component: | Resources | Assignee: | Platform-Resources-Inbox <platform-resources-inbox> | ||||
| Status: | RESOLVED NOT_ECLIPSE | QA Contact: | |||||
| Severity: | major | ||||||
| Priority: | P3 | ||||||
| Version: | 3.7 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Linux-GTK | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Created attachment 180661 [details]
backtraces
So I set two breakpoints:
- One in our project-open resource change handler (1)
- One in ProjectDescriptionReader#endNaturesElement. (2)
When this bug occurs breakpoint (1) is hit before breakpoint (2) due to the notification manager's asynchronous notification.
This is pretty bad, as AFAICS, the project description hasn't been loaded, but resource change listeners have been notified that the project is accessible.
Subclipse creates and opens the project, then populates it. This seems like a bad thing to do. Will file a bug there, and in the interim check for delta in the project description. |
CDT has a listener which responds to project open, and does: project.isOpen() ? project.hasNature(CProjectNature.C_NATURE_ID) : true; However I'm seeing hasNature(org.eclipse.cdt.core.cnature) return false -- natureIDs == String[0]. This is during a project set import. When the breakpoint is set in hasNature, looking on disk at the .project shows: <natures> <nature>org.eclipse.cdt.core.cnature</nature> <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> </natures> Backtrace looks something like: ProjectDescription.hasNature(String) line: 241 Project.hasNature(String) line: 539 ResourceChangeHandler2(ResourceChangeHandlerBase).shouldVisit(IProject) line: 166 ResourceChangeHandlerBase$DeltaVisitor.visit(IResourceDelta) line: 101 ResourceDelta.accept(IResourceDeltaVisitor, int) line: 68 ResourceDelta.accept(IResourceDeltaVisitor, int) line: 79 ResourceDelta.accept(IResourceDeltaVisitor) line: 48 ResourceChangeHandler2(ResourceChangeHandlerBase).doHandleResourceMove(IResourceChangeEvent, ResourceChangeHandlerBase$IResourceMoveHandler) line: 201 ResourceChangeHandler2(ResourceChangeHandlerBase).resourceChanged(IResourceChangeEvent) line: 160 ResourceChangeHandler2.resourceChanged(IResourceChangeEvent) line: 175 NotificationManager$2.run() line: 291 SafeRunner.run(ISafeRunnable) line: 42 NotificationManager.notify(ResourceChangeListenerList$ListenerEntry[], IResourceChangeEvent, boolean) line: 285 NotificationManager.broadcastChanges(ElementTree, ResourceChangeEvent, boolean) line: 149 Workspace.broadcastPostChange() line: 346 Workspace.endOperation(ISchedulingRule, boolean, IProgressMonitor) line: 1394 Workspace.run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor) line: 2255 NotificationManager$NotifyJob.run(IProgressMonitor) line: 40 Worker.run() line: 54