Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 6bc9857b352f0e859fb037562fc57f785e22ba0c (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*******************************************************************************
 * Copyright (c) 2000, 2009 QNX Software Systems 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:
 *     QNX Software Systems - Initial API and implementation
 *******************************************************************************/
package org.eclipse.cdt.core;

import java.util.EventObject;

import org.eclipse.cdt.core.settings.model.CProjectDescriptionEvent;
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionListener;

/**
 * @noextend This class is not intended to be subclassed by clients.
 * @noinstantiate This class is not intended to be instantiated by clients.
 * @deprecated register {@link ICProjectDescriptionListener} for {@link CProjectDescriptionEvent}
 */
@Deprecated
public class CDescriptorEvent extends EventObject {

	/**
	 * Comment for <code>serialVersionUID</code>
	 */
	private static final long serialVersionUID = 3257009869059143225L;
	public static final int CDTPROJECT_CHANGED = 1;
	public static final int CDTPROJECT_ADDED = 2;
	public static final int CDTPROJECT_REMOVED = 3;

	public static final int OWNER_CHANGED = 0x10;
	public static final int EXTENSION_CHANGED = 0x20;

	private static final int FLAGS_MASK = 0xf;

	int fType;

	public CDescriptorEvent(ICDescriptor descriptor, int type, int flags) {
		super(descriptor);
		fType = type | flags;
	}

	public ICDescriptor getDescriptor() {
		return (ICDescriptor) getSource();
	}

	public int getType() {
		return fType & FLAGS_MASK;
	}

	public int getFlags() {
		return fType & ~FLAGS_MASK;
	}

	@Override
	public String toString() {
		StringBuffer buf = new StringBuffer();
		switch (getType()) {
			case CDTPROJECT_ADDED :
				buf.append("CDTPROJECT_ADDED"); //$NON-NLS-1$
				break;
			case CDTPROJECT_REMOVED :
				buf.append("CDTPROJECT_REMOVED"); //$NON-NLS-1$
				break;
			case CDTPROJECT_CHANGED :
				buf.append("CDTPROJECT_CHANGED"); //$NON-NLS-1$
				break;
		}
		if ( (getFlags() & OWNER_CHANGED) != 0 ) {
			buf.append("[OWNER CHANGED]"); //$NON-NLS-1$
		}
		if ( (getFlags() & EXTENSION_CHANGED) != 0 ) {
			buf.append("[EXTENSION CHANGED]"); //$NON-NLS-1$
		}
		if (getFlags() == 0) {
			buf.append("[UNSPECIFIED]"); //$NON-NLS-1$
		}
		return buf.toString();
	}
}

Back to the top