You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For our project, we need to register additional listeners, which are notified whenever an edit policy is either activated or deactivated. Their purpose is to e.g. perform refresh operations on the non-GEF parts of our project.
The way we have this currently implemented is by (effectively) copy-pasting all GEF edit policies, with custom activate() and deactivate() methods as follows:
public void activate() {
m_isActive = true;
fireActivate();
}
public void deactivate() {
fireDeactivate();
m_isActive = false;
}
Both fire() methods just iterate over a list of listeners which you can register for
This is obviously a major overhead for a seemingly simple change...
So my question: Is there a "proper" way to do this?
I'd be willing to provide a pull request, which contributes our listener implementation, if there is interested.
As far as I can tell, EditPolicy.activate() is only called in EditPart.activate() and EditPart.installEditPolicy(). So alternatively, it may also be possible to extend the EditPartListener with an policyActivated() and policyDeactivated() method.
Except that I'm not sure how the case should be handled, when EditPolicy.setHost() is called. Because then you would probably have to migrate all relevant EditPartListeners from one to the other...
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
For our project, we need to register additional listeners, which are notified whenever an edit policy is either activated or deactivated. Their purpose is to e.g. perform refresh operations on the non-GEF parts of our project.
The way we have this currently implemented is by (effectively) copy-pasting all GEF edit policies, with custom activate() and deactivate() methods as follows:
Both fire() methods just iterate over a list of listeners which you can register for
This is obviously a major overhead for a seemingly simple change...
So my question: Is there a "proper" way to do this?
I'd be willing to provide a pull request, which contributes our listener implementation, if there is interested.
As far as I can tell, EditPolicy.activate() is only called in EditPart.activate() and EditPart.installEditPolicy(). So alternatively, it may also be possible to extend the EditPartListener with an policyActivated() and policyDeactivated() method.
Except that I'm not sure how the case should be handled, when EditPolicy.setHost() is called. Because then you would probably have to migrate all relevant EditPartListeners from one to the other...
Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions