1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.g2d.element.handler;
14 import org.simantics.g2d.diagram.IDiagram;
15 import org.simantics.g2d.element.IElement;
18 * All ElementContributions that implement LifeCycle get
19 * element create and destroy events.
21 * @author Toni Kalajainen
25 public interface LifeCycle extends ElementHandler {
28 * a new element has been spawned to the world
31 void onElementCreated(IElement e);
34 * Element has been destroyed from the world
37 void onElementDestroyed(IElement e);
40 * Element has been activated (after creation, cloning or loading)
41 * and added to a diagram.
46 void onElementActivated(IDiagram d, IElement e);
49 * Element has been deactivated (disposed)
53 void onElementDeactivated(IDiagram d, IElement e);
56 * A stub implementation for {@link LifeCycle} that does not do anything.
57 * Extend this to avoid having to implement all methods.
59 public static class Stub implements LifeCycle {
60 private static final long serialVersionUID = -569889719338663795L;
63 public void onElementActivated(IDiagram d, IElement e) {
67 public void onElementCreated(IElement e) {
71 public void onElementDeactivated(IDiagram d, IElement e) {
75 public void onElementDestroyed(IElement e) {