コード例 #1
0
  public void storeMappings(IProject project, ProjectLanguageConfiguration config)
      throws CoreException {
    ICProjectDescription descriptor = getProjectDescription(project, true);
    ICStorageElement rootElement = descriptor.getStorage(LANGUAGE_MAPPING_ID, true);
    // clear all children and settings
    rootElement.clear();

    ICStorageElement projectMappings = rootElement.createChild(PROJECT_MAPPINGS);

    addProjectContentTypeMappings(config.getContentTypeMappings(), projectMappings);
    addFileMappings(config.getFileMappings(), projectMappings);
    CCorePlugin.getDefault().setProjectDescription(project, descriptor);
  }
コード例 #2
0
 public ProjectLanguageConfiguration decodeMappings(IProject project) throws CoreException {
   ProjectLanguageConfiguration config = new ProjectLanguageConfiguration();
   ICProjectDescription descriptor = getProjectDescription(project, false);
   if (descriptor != null) {
     ICStorageElement rootElement = descriptor.getStorage(LANGUAGE_MAPPING_ID, false);
     if (rootElement != null) {
       ICStorageElement[] mappingElements = rootElement.getChildrenByName(PROJECT_MAPPINGS);
       if (mappingElements.length > 0) {
         ICStorageElement element = mappingElements[0];
         config.setContentTypeMappings(decodeProjectContentTypeMappings(element));
         config.setFileMappings(decodeFileMappings(element));
       }
     }
   }
   return config;
 }