code: public void removeResourceFromProject(CmsDbContext dbc, CmsResource resource) throws CmsException {
  
          // remove the resource to the project only if the resource is already in the project
          if (isInsideCurrentProject(dbc, resource.getRootPath())) {
              // check if there are already any subfolders of this resource
              I_CmsProjectDriver projectDriver = getProjectDriver(dbc);
              if (resource.isFolder()) {
                  List<String> projectResources = projectDriver.readProjectResources(dbc, dbc.currentProject());
                  for (int i = 0; i < projectResources.size(); i++) {
                      String resname = projectResources.get(i);
                      if (resname.startsWith(resource.getRootPath())) {
                          // delete the existing project resource first
                          projectDriver.deleteProjectResource(dbc, dbc.currentProject().getUuid(), resname);
                      }
                  }
              }
              try {
                  projectDriver.deleteProjectResource(dbc, dbc.currentProject().getUuid(), resource.getRootPath());
              } catch (CmsException exc) {
                  // if the subfolder exists already - all is ok
              } finally {
                  m_monitor.flushCache(CmsMemoryMonitor.CacheType.PROJECT_RESOURCES);
  
                  OpenCms.fireCmsEvent(
                      new CmsEvent(
                          I_CmsEventListener.EVENT_PROJECT_MODIFIED,
                          Collections.<String, Object> singletonMap("project", dbc.currentProject())));
              }
          }
      }
docs: Removes a resource from the current project of the user.<p>
  
  @param dbc the current database context
  @param resource the resource to apply this operation to
  
  @throws CmsException if something goes wrong
  
  @see CmsObject#copyResourceToProject(String)
  @see I_CmsResourceType#copyResourceToProject(CmsObject, CmsSecurityManager, CmsResource)