Skip to main content
summaryrefslogtreecommitdiffstats
blob: 2b9d997f434a497b1a07059427028c1600094965 (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
/*****************************************************************************
 * Copyright (c) 2011 CEA LIST.
 *
 * 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:
 *  Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
 *****************************************************************************/
package org.eclipse.papyrus.uml.tools.providers;

import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.papyrus.infra.ui.emf.providers.EMFLabelProvider;
import org.eclipse.papyrus.uml.tools.utils.ProfileUtil;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.Profile;

//TODO : To be refactored. Merge this class with UMLLabelProvider
@Deprecated
public class ProfileLabelProvider extends EMFLabelProvider implements ILabelProvider {

	private Package umlPackage;

	public static final String TAG_PROFILE_CHANGED = "    (has changed, consider re-applying profile)";

	public static final String UNKNOWN_PROFILE = "<Unknown>";

	public ProfileLabelProvider(Package umlPackage) {
		this.umlPackage = umlPackage;
	}

	@Override
	public String getText(Object source) {
		if (source instanceof Profile) {
			Profile profile = (Profile) source;
			String name = profile.getQualifiedName();
			if (name == null) {
				name = UNKNOWN_PROFILE;
			}
			if (ProfileUtil.isDirty(umlPackage, profile)) {
				name += TAG_PROFILE_CHANGED;
			}
			return name;
		}
		return super.getText(source);
	}
}

Back to the top