Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: e27365be56847a4efe46f7e26a9561fa817a73ed (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
/*****************************************************************************
 * Copyright (c) 2013, 2017 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:
 *   CEA LIST - Initial API and implementation
 *****************************************************************************/
package org.eclipse.papyrus.cdo.internal.core.importer;

import org.eclipse.core.runtime.IPath;
import org.eclipse.emf.common.util.DiagnosticChain;
import org.eclipse.papyrus.cdo.core.importer.IModelTransferConfiguration;
import org.eclipse.papyrus.cdo.core.importer.IModelTransferNode;

import com.google.common.base.Objects;

/**
 * This is the ManyToOneModelImportMapping type. Enjoy.
 */
public class ManyToOneModelImportMapping extends AbstractModelImportMapping {

	private IPath mapping;

	public ManyToOneModelImportMapping(IModelTransferConfiguration config) {
		super(config);

		computeDefaultMappings(config);
	}

	@Override
	public void mapTo(IModelTransferNode source, IPath path) {
		if (!Objects.equal(this.mapping, path)) {
			this.mapping = path;

			for (IModelTransferNode next : getConfiguration().getModelsToTransfer()) {
				fireMappingChanged(next);
			}
		}
	}

	@Override
	public IPath getMapping(IModelTransferNode node) {
		return mapping;
	}

	@Override
	protected void validateUniqueMappings(DiagnosticChain diagnostics) {
		// pass. The whole point of this mapping is that all inputs map to one output
	}

}

Back to the top