Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 9cb437482fd1f7aaef40eb8856bc1c39b7c2c151 (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
84
85
86
/*****************************************************************************
 * Copyright (c) 2010 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:
 *  Tatiana Fesenko (CEA LIST) - Initial API and implementation
 *
 *****************************************************************************/
package org.eclipse.papyrus.uml.compare.ui.viewer.content.part.diff;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.emf.compare.ui.viewer.content.part.ModelContentMergeTabFolder;
import org.eclipse.emf.compare.ui.viewer.content.part.diff.ModelContentMergeDiffTab;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.uml.compare.UMLCompareUtils;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.uml2.uml.util.UMLUtil;


/**
 * The Structure Tab in the Merge Viewer.
 */
public class UMLModelContentMergeDiffTab extends ModelContentMergeDiffTab {


	/**
	 * Instantiates a new uML model content merge diff tab.
	 * 
	 * @param parentComposite
	 *        the parent composite
	 * @param side
	 *        the side
	 * @param parentFolder
	 *        the parent folder
	 */
	public UMLModelContentMergeDiffTab(Composite parentComposite, int side, ModelContentMergeTabFolder parentFolder) {
		super(parentComposite, side, parentFolder);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.emf.compare.ui.viewer.content.part.diff.ModelContentMergeDiffTab#setSelectionToWidget(java.util.List, boolean)
	 */
	@Override
	protected void setSelectionToWidget(List l, boolean reveal) {
		// tfesenko filter stereotype applications
		List result = new ArrayList();
		for(Object next : l) {
			if(next instanceof EObject && UMLCompareUtils.isStereotypeApplication((EObject)next)) {
				EObject stereotypeApplication = (EObject)next;
				result.add(UMLUtil.getBaseElement(stereotypeApplication));
			} else {
				result.add(next);
			}
		}
		super.setSelectionToWidget(result, reveal);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.emf.compare.ui.viewer.content.part.diff.ModelContentMergeDiffTab#setReflectiveInput(java.lang.Object)
	 */
	@Override
	public void setReflectiveInput(Object object) {
		// tfesenko 336361 - [UML Compare] Compare two elements: show right element as root
		if(object instanceof EObject) {
			clearCaches();
			// tfesenko default implementation sets object.eResource here
			setInput(object);
			setupCaches();
			needsRedraw = true;
		}
		super.setReflectiveInput(object);
	}


}

Back to the top