| Summary: | Unnecessary complication in AbstractEditPart#setModel() and AbstractEditPart#setParent() | ||
|---|---|---|---|
| Product: | [Tools] GEF | Reporter: | Pratik Shah <ppshah> |
| Component: | GEF-Legacy GEF (MVC) | Assignee: | Alexander Nyßen <nyssen> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | minor | ||
| Priority: | P3 | CC: | nyssen |
| Version: | 3.2 | ||
| Target Milestone: | 3.7.1 (Indigo) M5 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
As there is no side-effect (e.g. resulting notification) in this method, the check is really not necessary. The same holds for setParent().
Thus changed implementation of setModel to:
public void setModel(Object model) {
this.model = model;
}
Accordingly, changed implementation of setParent() to
public void setParent(EditPart parent) {
this.parent = parent;
}
Committed changes to cvs HEAD (3.7).
|
The setModel() method in AbstractEditPart looks like this: public void setModel(Object model) { if (getModel() == model) return; this.model = model; } The getModel() check is not necessary. It's a minor issue (and there are workarounds), but could create a problem in some cases (for instance, when the model could be an EMF proxy and needs to be replaced with the resolved EObject when getModel() is invoked).