1 /*******************************************************************************
2 * Copyright (c) 2019 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 * Semantum Oy - initial API and implementation
11 *******************************************************************************/
12 package fi.vtt.simantics.procore.internal;
14 import java.util.concurrent.CopyOnWriteArrayList;
16 import org.simantics.db.service.EventSupport;
19 * Simple implementation for Event Support.
21 * Note: for more extended / complicated scenarios, we could use org.simantics.utils.threads.SyncListenerList.
26 public class EventSupportImpl implements EventSupport {
28 private CopyOnWriteArrayList<EventListener> listeners = new CopyOnWriteArrayList<>();
31 public synchronized void addListener(EventListener l) {
36 public synchronized void removeListener(EventListener l) {
40 public void fireEvent(String type, Object data) {
41 for (EventListener l : listeners) {