Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: ea64dff6d2adbc4b5169f3c1d370c022bafc631f (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
/*******************************************************************************
 * Copyright (c) 2012 Mia-Software.
 * 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:
 *     Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2
 *     Vincent Lorenzo (CEA-LIST) -  Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider
 *     Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates
 *******************************************************************************/
package org.eclipse.papyrus.emf.facet.efacet.ui.internal.widget;

import java.util.Collection;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.emf.facet.custom.core.ICustomizationManager;
import org.eclipse.papyrus.emf.facet.efacet.ui.internal.exported.widget.IETypedElementSelectionWidget;
import org.eclipse.papyrus.emf.facet.efacet.ui.internal.exported.widget.IETypedElementSelectionWidgetFactory;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;

public class ETypedElementSelectionWidgetFactory implements IETypedElementSelectionWidgetFactory {

	public IETypedElementSelectionWidget createETypedElementSelectionWidget(
			final int selectionMaxSize, final boolean allowEmpty,
			final Composite parentComposite,
			final ICustomizationManager customManager,
			final Collection<? extends EObject> knownEPackage) {
		final ETypedElementSelectionControlManager[] control = new ETypedElementSelectionControlManager[1];
		// must be synchronous, otherwise the shell is not created before SynchronizedETypedElementSelectionWidget, and SynchronizedComposite throws a NPE
		Display.getDefault().syncExec(new Runnable() {
			public void run() {
				control[0] = new ETypedElementSelectionControlManager(parentComposite,
						selectionMaxSize, allowEmpty,
						customManager, knownEPackage);
				control[0].createContents();
			}
		});
		return new SynchronizedETypedElementSelectionWidget(control[0]);
	}
}

Back to the top