Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: a49315b83aecd041a3136f74c0ed3a13cbff7b05 (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
53
54
55
56
57
58
59
60
61
62
63
/*******************************************************************************
 * Copyright (c) 2007, 2017 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.equinox.internal.p2.engine;

import java.util.EventObject;
import org.eclipse.equinox.p2.engine.IProfileEvent;

/**
 * @noextend This class is not intended to be subclassed by clients.
 * @since 2.0
 */
public class ProfileEvent extends EventObject implements IProfileEvent {
	private static final long serialVersionUID = 3082402920617281765L;

	private int reason;

	public ProfileEvent(String profileId, int reason) {
		super(profileId);
		this.reason = reason;
	}

	@Override
	public int getReason() {
		return reason;
	}

	@Override
	public String getProfileId() {
		return (String) getSource();
	}

	@Override
	public String toString() {
		StringBuffer buffer = new StringBuffer();
		buffer.append("ProfileEvent["); //$NON-NLS-1$
		buffer.append(getProfileId());
		buffer.append("-->"); //$NON-NLS-1$
		switch (reason) {
			case IProfileEvent.ADDED :
				buffer.append("ADDED"); //$NON-NLS-1$
				break;
			case IProfileEvent.REMOVED :
				buffer.append("REMOVED"); //$NON-NLS-1$
				break;
			case IProfileEvent.CHANGED :
				buffer.append("CHANGED"); //$NON-NLS-1$
				break;
		}
		buffer.append("] "); //$NON-NLS-1$
		return buffer.toString();
	}
}

Back to the top