public List<ToolEnablement> getAllElements() { ArrayList<ToolEnablement> ret = new ArrayList<ToolEnablement>(); for (EClass e : elementSet) { ToolEnablement tool = new ToolEnablement(); tool.setTool(e); tool.setEnabled(isEnabled(e)); ret.add(tool); HashSet<EStructuralFeature> possibleFeatures = new HashSet<EStructuralFeature>(); ArrayList<ToolEnablement> children = new ArrayList<ToolEnablement>(); for (EAttribute a : e.getEAllAttributes()) { possibleFeatures.add(a); } for (EReference a : e.getEAllContainments()) { possibleFeatures.add(a); } for (EReference a : e.getEAllReferences()) { possibleFeatures.add(a); } for (EStructuralFeature feature : possibleFeatures) { ToolEnablement toolEnablement = new ToolEnablement(feature, tool); toolEnablement.setEnabled(isEnabled(e, feature)); children.add(toolEnablement); } sortTools(children); tool.setChildren(children); } sortTools(ret); return ret; }
public boolean isEnabled(ToolEnablement tool) { return prefs.getBoolean(tool.getPreferenceName(), true); }
public void setEnabled(ToolEnablement tool, boolean enabled) { prefs.putBoolean(tool.getPreferenceName(), enabled); }