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/SynchronizedFacetSetSelectionWidget.java')
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/widget/SynchronizedFacetSetSelectionWidget.java90
1 files changed, 90 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/SynchronizedFacetSetSelectionWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/widget/SynchronizedFacetSetSelectionWidget.java
new file mode 100644
index 00000000000..4a01661d637
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/widget/SynchronizedFacetSetSelectionWidget.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * 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 java.util.Collection;
+import java.util.List;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet;
+import org.eclipse.emf.facet.efacet.ui.internal.exported.widget.IFacetSetSelectionWidget;
+import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable;
+import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable;
+import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.SynchronizedObject;
+import org.eclipse.swt.widgets.Control;
+
+public class SynchronizedFacetSetSelectionWidget extends SynchronizedObject<FacetSetSelectionControl> implements IFacetSetSelectionWidget {
+
+ private final FacetSetSelectionControl control;
+
+ protected FacetSetSelectionControl getDelegate() {
+ return this.control;
+ }
+
+ public SynchronizedFacetSetSelectionWidget(final FacetSetSelectionControl control) {
+ super(control, control.getTreeViewer().getTree().getDisplay());
+ this.control = control;
+ }
+
+ public void setAvailableFacetSets(final Collection<? extends FacetSet> available) {
+ voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ getDelegate().setAvailableFacetSets(available);
+ }
+ });
+ }
+
+ public List<FacetSet> getSelectedFacetSets() {
+ return safeSyncExec(new AbstractExceptionFreeRunnable<List<FacetSet>>() {
+ @Override
+ public List<FacetSet> safeRun() {
+ return getDelegate().getSelectedFacetSets();
+ }
+ });
+ }
+
+ public void setSelectedFacetSets(final Collection<? extends FacetSet> facetSetsToSelect) {
+ voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ getDelegate().setSelectedFacetSets(facetSetsToSelect);
+ }
+ });
+ }
+
+ public IStatus getValidationStatus() {
+ return safeSyncExec(new AbstractExceptionFreeRunnable<IStatus>() {
+ @Override
+ public IStatus safeRun() {
+ return getDelegate().getValidationStatus();
+ }
+ });
+ }
+
+ public boolean isDisposed() {
+ return safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() {
+ @Override
+ public Boolean safeRun() {
+ return Boolean.valueOf(getDelegate().isDisposed());
+ }
+ }).booleanValue();
+ }
+
+ public Control getControl() {
+ return safeSyncExec(new AbstractExceptionFreeRunnable<Control>() {
+ @Override
+ public Control safeRun() {
+ return getDelegate().getControl();
+ }
+ });
+ }
+}

Back to the top