/**
   * Returns the active Model project associated with the specified resource, or <code>null</code>
   * if no Model project yet exists for the resource.
   *
   * @exception IllegalArgumentException if the given resource is not one of an IProject, IFolder,
   *     IRoot or IFile.
   * @see ModelWorkspace
   */
  @Override
  public ModelProject getModelProject(final IResource resource) {
    IProject project = resource.getProject();
    if (project == null || !project.isOpen()) return null;

    if (!DotProjectUtils.isModelerProject(project)) {
      return null;
    }

    // Only if the modelling project is open, is a partner model project created
    ModelProject modelProject = findModelProject(resource);
    if (modelProject == null) {
      switch (resource.getType()) {
        case IResource.FOLDER:
        case IResource.FILE:
        case IResource.PROJECT:
          return new ModelProjectImpl(project, this);
        case IResource.ROOT:
          return null;
        default:
          throw new IllegalArgumentException(
              ModelerCore.Util.getString(
                  "ModelWorkspaceImpl.Invalid_resource_for_ModelProject",
                  resource,
                  this)); //$NON-NLS-1$
      }
    }

    return modelProject;
  }
  /** @see org.teiid.designer.core.workspace.Openable */
  @Override
  protected boolean generateInfos(
      final OpenableModelWorkspaceItemInfo info,
      final IProgressMonitor pm,
      final Map newElements,
      final IResource underlyingResource) {

    ModelWorkspaceManager.getModelWorkspaceManager().putInfo(this, info);

    // determine my children
    Collection<IProject> projects = DotProjectUtils.getOpenModelProjects();
    for (IProject project : projects) {
      info.addChild(getModelProject(project));
    }
    return true;
  }