sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi/src/com/nokia/carbide/cpp/internal/pi/analyser/EventHandler.java
equal
deleted
inserted
replaced
|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 package com.nokia.carbide.cpp.internal.pi.analyser; |
|
19 |
|
20 import java.util.Enumeration; |
|
21 |
|
22 import org.eclipse.swt.widgets.Event; |
|
23 |
|
24 import com.nokia.carbide.cpp.internal.pi.manager.PluginInitialiser; |
|
25 import com.nokia.carbide.cpp.internal.pi.plugin.model.IEventListener; |
|
26 |
|
27 |
|
28 |
|
29 public class EventHandler |
|
30 { |
|
31 private static EventHandler instance = null; |
|
32 |
|
33 private EventHandler () |
|
34 {} |
|
35 |
|
36 public static EventHandler getInstance() |
|
37 { |
|
38 if (instance == null) |
|
39 { |
|
40 instance = new EventHandler(); |
|
41 } |
|
42 return instance; |
|
43 } |
|
44 |
|
45 public void broadcastEvent(String eventString, Event event) |
|
46 { |
|
47 Enumeration e = PluginInitialiser.getPluginInstances(NpiInstanceRepository.getInstance().activeUid(), "com.nokia.carbide.cpp.internal.pi.plugin.model.IEventListener"); //$NON-NLS-1$ |
|
48 if (e == null) return; |
|
49 while (e.hasMoreElements()) |
|
50 { |
|
51 IEventListener plugin = (IEventListener)e.nextElement(); |
|
52 plugin.receiveEvent(eventString, event); |
|
53 } |
|
54 } |
|
55 } |