Skip to main content
summaryrefslogtreecommitdiffstats
blob: e03700cd0d27b915bb0f455086412289abb9524d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*******************************************************************************
 * Copyright (c) 2007 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

package org.eclipse.equinox.prov.ui.internal;

import org.eclipse.core.runtime.ListenerList;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;

/**
 * ProvisioningPropertyManager can notify clients of changes to the properties
 * of provisioning objects.
 * 
 * @since 3.4
 */

// TODO This is a HACK class.
// This class should go away and instead these kinds of events should be handled
// by the provisioning event bus.  See bug #197052 and #197701
// 
// TODO Some of these aren't even truly property changes but rather just notification
// that something happened.  Since this class is (hoped to be) temporary, I did not 
// want to define new event types and just used what was already available.
public class ProvisioningPropertyManager {

	private ListenerList listeners = new ListenerList();

	public void addPropertyChangeListener(IPropertyChangeListener listener) {
		listeners.add(listener);
	}

	public void removePropertyChangeListener(IPropertyChangeListener listener) {
		listeners.remove(listener);
	}

	public void notifyListeners(PropertyChangeEvent event) {
		final Object[] listenerArray = listeners.getListeners();
		for (int i = 0; i < listenerArray.length; i++) {
			final IPropertyChangeListener listener = (IPropertyChangeListener) listenerArray[i];
			listener.propertyChange(event);
		}

	}
}

Back to the top