This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Some TopComponents (Editor, Form Editor) should keep Project Context. We need some support to do it. Suggested solution (by Jarda) is to implement ProjectCloneableEditor and other stuff in Project Module. Thanks :)
Can you give a little bit more information on what it is you need? Why does the Editor need project context?
The Editor may need to access some project settings (e.g. parser database).
Projects API provides two classes to support integration with editor - ProjectEditorSupport, ProjectEditor. Modules should use them when they provide editor features which require context of the project containing edited file (e.g. code completion in java editor). Projects infrastructure provides correct node as an activated node of the editor TopComponent. When editor TopComponent needs to create its own activated node it should provide Project on that node. It can be obtained from ProjectEditor.getProject(), also subclasses of ProjectEditor are notified whenever the project context of edited file changes (see notifyProjectChanged method). ProjectEditorSupport implementation should be always provided from DataObject of the source file, project context is delivered to it automaticaly when editor is opened. This ensures that source file can be opened in editor even when there is no opened project containing that file. Projects infrastructure provides speacial action in the popup menu of editor's TopComponent which allows to switch project context of edited file in case that there is several projects containing edited file. The context is also switched when file is re-opened from another project. Editor can read project from the property of Document. This property is called 'project' and is automaticaly updated whenever the project context of edited file changes. This property can be 'null' or not set in case that file isn't edited in context of any project.