Exemple #1
0
  private void doneInitializing() {
    for (ICConfigurationDescription cfg : fCfgMap.values()) {
      // FIXME How and why are we down casting to a CConfigurationDescriptionCache. Comments,
      // please!
      CConfigurationDescriptionCache cache = (CConfigurationDescriptionCache) cfg;
      cache.doneInitialization();
    }

    if (fIsReadOnly) fPrefs.setReadOnly(true);
  }
  public CFolderDescriptionCache(CFolderData base, CConfigurationDescriptionCache cfg) {
    super(base.getId(), base.getPath(), cfg, null);
    fCfg = cfg;
    fCfg.addResourceDescription(this);

    copyDataFrom(base, true);
  }
Exemple #3
0
  void switchToCachedAppliedData(CProjectDescription appliedCache) {
    if (fIsReadOnly) return;

    ICConfigurationDescription[] cfgs = appliedCache.getConfigurations();
    for (int i = 0; i < cfgs.length; i++) {
      CConfigurationDescriptionCache cfgCache = (CConfigurationDescriptionCache) cfgs[i];
      CConfigurationDescription des =
          (CConfigurationDescription) getChildSettingById(cfgCache.getId());
      if (des != null) {
        des.setData(cfgCache);
        //				ICResourceDescription rcDes = des.getResourceDescription(new Path("dd"), false);
        //				rcDes = des.getResourceDescription(new Path("dd"), false);
        //				ICBuildSetting bs = des.getBuildSetting();
        //				ICLanguageSetting lss[] = ((ICFolderDescription) rcDes).getLanguageSettings();
      }
    }
  }
Exemple #4
0
 /**
  * Convert the current CConfigurationDescriptions to cached versions This occurs during the
  * SetCProjectDescription Operation
  */
 void switchToCachedConfigurationDescriptions() throws CoreException {
   for (Map.Entry<String, ICConfigurationDescription> e : fCfgMap.entrySet()) {
     if (e.getValue() instanceof CConfigurationDescription) {
       CConfigurationDescription cfgDes = (CConfigurationDescription) e.getValue();
       CConfigurationData baseData = ((IInternalCCfgInfo) cfgDes).getConfigurationData(false);
       CConfigurationDescriptionCache baseCache = null;
       if (baseData instanceof CConfigurationDescriptionCache) {
         baseCache = (CConfigurationDescriptionCache) baseData;
         baseData = baseCache.getConfigurationData();
       }
       CConfigurationDescriptionCache cache =
           new CConfigurationDescriptionCache(
               cfgDes, baseData, baseCache, cfgDes.getSpecSettings(), this, null);
       e.setValue(cache);
     }
   }
 }
Exemple #5
0
  public void loadDatas() {
    if (!fIsReadOnly || !fIsLoading) return;

    for (Iterator<ICConfigurationDescription> iter = fCfgMap.values().iterator();
        iter.hasNext(); ) {
      CConfigurationDescriptionCache cache = (CConfigurationDescriptionCache) iter.next();
      try {
        cache.loadData();
      } catch (CoreException e) {
        CCorePlugin.log(e);
        iter.remove();
      }
    }

    //		doneInitializing();

    //		fIsLoading = false;
  }
Exemple #6
0
  public boolean applyDatas(SettingsContext context) {
    if (!fIsReadOnly || !fIsApplying) return false;

    boolean modified = false;
    for (Iterator<ICConfigurationDescription> iter = fCfgMap.values().iterator();
        iter.hasNext(); ) {
      CConfigurationDescriptionCache cache = (CConfigurationDescriptionCache) iter.next();
      try {
        if (cache.applyData(context)) modified = true;
      } catch (CoreException e) {
        CCorePlugin.log(e);
        e.printStackTrace();
        iter.remove();
      }
    }

    //		doneInitializing();

    //		fIsApplying = false;

    return modified;
  }
 private ResourceDescriptionHolder getRcDesHolder() {
   if (fRcDesHolder == null) fRcDesHolder = fCfg.createHolderForRc(getPath());
   return fRcDesHolder;
 }
 public boolean isExcluded() {
   return fCfg.isExcluded(getPath());
 }
Exemple #9
0
  /**
   * Create a project description based on another project description
   *
   * @param base
   * @param saving
   * @param storage
   * @param el
   * @param isCreating
   */
  public CProjectDescription(
      CProjectDescription base,
      boolean saving,
      ICSettingsStorage storage,
      ICStorageElement el,
      boolean isCreating) {
    fActiveCfgInfo = new CfgIdPair(base.fActiveCfgInfo);
    fSettingCfgInfo = new CfgIdPair(base.fSettingCfgInfo);
    fProject = base.fProject;
    fStorage = storage;
    fRootStorageElement = el;
    fIsReadOnly = saving;
    fIsLoading = base.fIsLoading;
    fIsApplying = saving || base.fIsApplying;
    fIsCreating = isCreating;

    fPrefs =
        new CProjectDescriptionPreferences(
            base.fPrefs,
            (CProjectDescriptionPreferences)
                CProjectDescriptionManager.getInstance()
                    .getProjectDescriptionWorkspacePreferences(false),
            false);

    for (Iterator<ICConfigurationDescription> iter = base.fCfgMap.values().iterator();
        iter.hasNext(); ) {
      try {
        IInternalCCfgInfo cfgDes = (IInternalCCfgInfo) iter.next();
        if (fIsReadOnly) {
          CConfigurationData baseData = cfgDes.getConfigurationData(false);
          CConfigurationDescriptionCache baseCache = null;
          if (baseData instanceof CConfigurationDescriptionCache) {
            baseCache = (CConfigurationDescriptionCache) baseData;
            baseData = baseCache.getConfigurationData();
          }
          CConfigurationDescriptionCache cache =
              new CConfigurationDescriptionCache(
                  (ICConfigurationDescription) cfgDes,
                  baseData,
                  baseCache,
                  cfgDes.getSpecSettings(),
                  this,
                  null);
          configurationCreated(cache);
        } else {
          CConfigurationData baseData = cfgDes.getConfigurationData(false);
          CConfigurationDescription cfg = new CConfigurationDescription(baseData, this);
          configurationCreated(cfg);
        }
      } catch (CoreException e) {
        CCorePlugin.log(e);
      }
    }

    // Shallow cloning the base map
    Map<QualifiedName, Object> cloneMap =
        Collections.synchronizedMap(new HashMap<QualifiedName, Object>());
    synchronized (base.fPropertiesMap) {
      cloneMap.putAll(base.fPropertiesMap);
    }
    fPropertiesMap = cloneMap;
  }