Commit ce12999f authored by Florian Hölzl's avatar Florian Hölzl
Browse files

Kernel: JavaFX editor. Added EMF listener to diagram base controllers.

Issue-Ref: 3815
Issue-Url: https://af3-developer.fortiss.org/issues/3815

Signed-off-by: Florian Hölzl's avatarFlorian Hoelzl <hoelzl@fortiss.org>
parent ed072154
EObjectBasedDiagramControllerBase.java 1d57b1b031d57ffb5123773c752e3415bacd8f7e RED
EObjectBasedDiagramControllerBase.java 7129769962099851bc48d97d69f259b0f692625c RED
EObjectBasedRectangularResizableContentControllerBase.java 6cdf3d430353b79ec8c2ccf1bc20736db2ed102c RED
LayoutedModelElementBasedContentAnchorageController.java abbf310db98983a6e80c4cd339cb34a23c795101 RED
LayoutedModelElementBasedDiagramAnchorageController.java bb4a942f9cca35f032dfe3adee26443654315774 RED
......
......@@ -19,6 +19,9 @@ import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.DiagramCoordinate;
import org.eclipse.systemfocus.kernel.common.ui.javafx.lwfxef.DiagramViewerFeatures;
......@@ -38,6 +41,14 @@ import javafx.scene.control.MenuItem;
*/
public abstract class EObjectBasedDiagramControllerBase extends ControllerBase
implements IModelChangeProvider {
/** Notification adapter for model change events. */
private final Adapter notificationListener = new AdapterImpl() {
@Override
public void notifyChanged(Notification event) {
fireUpdateComplete();
}
};
/** Constructor. */
public EObjectBasedDiagramControllerBase(IMVCBundle mvcb) {
super(mvcb);
......@@ -86,7 +97,9 @@ public abstract class EObjectBasedDiagramControllerBase extends ControllerBase
}
/** Called when sub-class should register with the underlying {@link EObject}. */
protected abstract void connectToModel();
protected void connectToModel() {
getEObject().eAdapters().add(notificationListener);
}
/** {@inheritDoc} */
@Override
......@@ -98,7 +111,11 @@ public abstract class EObjectBasedDiagramControllerBase extends ControllerBase
}
/** Called when sub-class should unregister from the underlying {@link EObject}. */
protected abstract void disconnectFromModel();
protected void disconnectFromModel() {
getEObject().eAdapters().remove(notificationListener);
}
/** Called when sub-class should unregister from the underlying {@link EObject}. */
/** {@inheritDoc} */
@Override
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment