Skip to main content
summaryrefslogtreecommitdiffstats
blob: 7217ca8e72ef27ebb1c5e53f3e3c6fdc06fca628 (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
/*******************************************************************************
 * Copyright (c) 2016 EclipseSource Services GmbH 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:
 *     Martin Fleck - initial API and implementation
 *******************************************************************************/
package org.eclipse.emf.compare.uml2.papyrus.tests.profiles.migration;

import org.eclipse.core.runtime.Platform;
import org.osgi.framework.Bundle;

/**
 * This utility provides information about the Papyrus plugin that provides the profile migration. This is
 * important as the profile migration in Eclipse Luna works a bit different than in Mars and upper.
 * Specifically, the IDs of the migrated elements are not kept correctly which in the comparison yields a lot
 * of additions and deletions of elements.
 * 
 * @author Martin Fleck
 */
public class PapyrusMigrationUtil {
	/**
	 * Bundle responsible for the Papyrus profile migration. This may be null if the bundle can not be found.
	 */
	public static Bundle PROFILE_MIGRATION_BUNDLE = Platform.getBundle("org.eclipse.papyrus.uml.modelrepair"); //$NON-NLS-1$

	/**
	 * Latest version number of the profile migration bundle for Eclipse Luna without the qualifier.
	 */
	public static final String LUNA_VERSION = "1.0.2"; //$NON-NLS-1$

	/**
	 * Returns true if the profile migration bundle is not null and the bundle version
	 * (major.minor.micro.qualifier) starts with the given version strings.
	 * 
	 * @param version
	 *            expected version of the profile migration bundle
	 * @return true if the bundle version starts with the given version, false if the version is not a match
	 *         or the bundle could not be found.
	 */
	public static boolean isVersion(String version) {
		return PROFILE_MIGRATION_BUNDLE != null
				&& PROFILE_MIGRATION_BUNDLE.getVersion().toString().startsWith(version);
	}

	/**
	 * Returns true if the profile migration bundle is not null and we loaded the bundle version from Eclipse
	 * Luna.
	 */
	public static boolean isLuna() {
		return isVersion(LUNA_VERSION);
	}
}

Back to the top