Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: cf0794aa1cf8da08d589ed2ddc70d8a4c0f5b687 (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
/*****************************************************************************
 * Copyright (c) 2016 CEA LIST 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:
 *   Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and Implementation
 *****************************************************************************/

package org.eclipse.papyrus.infra.emf.types.ui.properties.widgets;

import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.papyrus.infra.properties.ui.widgets.MultiReferenceEditorWithPropertyView;
import org.eclipse.papyrus.infra.widgets.editors.MultipleReferenceEditor;
import org.eclipse.swt.widgets.Composite;

/**
 * Multiple value editor for {@link StereotypeToApply}.
 */
public class FeaturesToSetEditorWithPropertyView extends MultiReferenceEditorWithPropertyView {

	/**
	 * Constructor.
	 */
	public FeaturesToSetEditorWithPropertyView(final Composite parent, final int style) {
		super(parent, style);
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.eclipse.papyrus.infra.properties.ui.widgets.MultiReferenceEditorWithPropertyView#setModelObservable(org.eclipse.core.databinding.observable.list.IObservableList)
	 */
	@SuppressWarnings("rawtypes")
	@Override
	public void setModelObservable(final IObservableList modelObservable) {
		super.setModelObservable(modelObservable);

		// Select the first element
		if (!modelObservable.isEmpty()) {
			multiReferenceEditor.getViewer().setSelection(new StructuredSelection(modelObservable.get(0)));
		}
	}


	/**
	 * {@inheritDoc}
	 * 
	 * @see org.eclipse.papyrus.infra.properties.ui.widgets.MultiReferenceEditorWithPropertyView#createMultipleReferenceEditor(int)
	 */
	@Override
	protected MultipleReferenceEditor createMultipleReferenceEditor(final int style) {
		return new FeaturesToSetMultipleEditor(this, style);

	}

}

Back to the top