Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/widget/FacetSetSelectionWidgetFactory.java')
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/widget/FacetSetSelectionWidgetFactory.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/widget/FacetSetSelectionWidgetFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/widget/FacetSetSelectionWidgetFactory.java
new file mode 100644
index 00000000000..1950fb7e470
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/widget/FacetSetSelectionWidgetFactory.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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:
+ * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.ui.internal.widget;
+
+import org.eclipse.emf.facet.efacet.ui.internal.exported.widget.IFacetSetSelectionWidget;
+import org.eclipse.emf.facet.efacet.ui.internal.exported.widget.IFacetSetSelectionWidgetFactory;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+
+public class FacetSetSelectionWidgetFactory implements IFacetSetSelectionWidgetFactory {
+
+ public IFacetSetSelectionWidget createFacetSetSelectionWidget(final int selectionMaxSize, final boolean allowEmpty,
+ final Composite parentComposite, final Runnable onChange) {
+ final FacetSetSelectionControl[] control = new FacetSetSelectionControl[1];
+ // must be synchronous, otherwise the shell is not created before SynchronizedFacetSetSelectionWidget, and
+ // SynchronizedComposite throws a NPE
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ control[0] = new FacetSetSelectionControl(parentComposite, selectionMaxSize, allowEmpty, onChange);
+ control[0].createContents();
+ }
+ });
+ return new SynchronizedFacetSetSelectionWidget(control[0]);
+ }
+}

Back to the top