public ModelEnablementDescriptor(IConfigurationElement e) { super(e); TargetRuntime rt = TargetRuntime.getRuntime(e); profileName = e.getAttribute("profile"); // $NON-NLS-1$ description = e.getAttribute("description"); // $NON-NLS-1$ String ref = e.getAttribute("ref"); // $NON-NLS-1$ modelEnablements = new ModelEnablements(rt, id); if (ref != null) { String a[] = ref.split(":"); // $NON-NLS-1$ rt = TargetRuntime.getRuntime(a[0]); String id = a[1]; initializeFromTargetRuntime(rt, id); } for (IConfigurationElement c : e.getChildren()) { String object = c.getAttribute("object"); // $NON-NLS-1$ String feature = c.getAttribute("feature"); // $NON-NLS-1$ if (c.getName().equals("enable")) { // $NON-NLS-1$ setEnabled(object, feature, true); } else if (c.getName().equals("disable")) { // $NON-NLS-1$ setEnabled(object, feature, false); } } }
public void initializeFromTargetRuntime(TargetRuntime rt, String id) { for (ModelEnablementDescriptor med : rt.getModelEnablements()) { if (id.equals(med.getId())) { Collection<String> enabledClasses = med.modelEnablements.getAllEnabledClasses(); for (String c : enabledClasses) { Collection<String> enabledFeatures = med.modelEnablements.getAllEnabledFeatures(c); for (String f : enabledFeatures) { setEnabled(c, f, true); } } break; } } }