In Eclipse RCP way of doing things, where should I keep my model objects? And when they are loaded or changed, how should they talk to the views?
I am attempting to port my existing application to Eclipse RCP. It could be viewed as an IDE-like application: I open a file, which contains links to source files. The source files are displayed in the tree view. I can edit the source, and build the sources into some output...
For example, when I handle the Open command, where would I create the model object so my views can see them? I'd rather avoid the use of singleton manager class, but that maybe the simplest way.
Interesting code I found browsing JDT's source code are JavaCore, JavaModel, JavaModelManager. and JavaProject.
IProject[] projects= ResourcesPlugin.getWorkspace().getRoot().getProjects();
public static IJavaProject create(IProject project) {
if (project == null) {
return null;
}
JavaModel javaModel = JavaModelManager.getJavaModelManager().getJavaModel();
return javaModel.getJavaProject(project);
}
Related: