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/exported/dialog')
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialog.java35
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogCallback.java30
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogFactory.java62
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogInternal.java53
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialog.java47
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialogFactory.java72
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialogInternal.java35
7 files changed, 334 insertions, 0 deletions
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialog.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialog.java
new file mode 100644
index 00000000000..08811d9b31c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialog.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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
+ * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>)
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.ui.internal.exported.dialog;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.ETypedElement;
+
+/**
+ * A dialog to let the user select ETypedElements.
+ *
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @since 0.2.0
+ */
+public interface IETypedElementSelectionDialog<D> {
+
+ /** Set the selection to the given list of ETypedElements */
+ void setSelectedETypedElements(List<? extends ETypedElement> newSelection);
+
+ /** Emulate a press on the OK button */
+ D pressOk();
+
+ /** Emulate a press on the Cancel button */
+ void pressCancel();
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogCallback.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogCallback.java
new file mode 100644
index 00000000000..5eebec0c52d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogCallback.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * 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
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.ui.internal.exported.dialog;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.ETypedElement;
+
+/**
+ * Called when a {@link IETypedElementSelectionDialog} is closed, either by OK or Cancel.
+ * <p>
+ * This interface is intended to be implemented by clients.
+ *
+ * @since 0.2.0
+ */
+public interface IETypedElementSelectionDialogCallback {
+ /** The user canceled the dialog */
+ void canceled();
+
+ /** The user committed their selection in the dialog */
+ void committed(List<ETypedElement> selection);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogFactory.java
new file mode 100644
index 00000000000..2e726698d49
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogFactory.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * 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 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>)
+ * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.ui.internal.exported.dialog;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.facet.custom.core.ICustomizationManager;
+import org.eclipse.emf.facet.efacet.ui.internal.dialogs.ETypedElementSelectionDialogFactory;
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * A factory to create {@link IETypedElementSelectionDialog}s
+ *
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @since 0.2.0
+ */
+public interface IETypedElementSelectionDialogFactory {
+
+ /** This is the default instance of this interface. */
+ IETypedElementSelectionDialogFactory DEFAULT = new ETypedElementSelectionDialogFactory();
+
+ /**
+ * Open a dialog to let the user select ETypedElements to load.
+ *
+ * @param eTypedElements
+ * the list of ETypedElements that can be selected using this dialog
+ * @param selectionMaxSize
+ * the maximum number of typed elements that the user can select
+ * @param allowEmpty
+ * whether to allow the user to select no ETypedElement (i.e : select <code>null</code>)
+ * @param callback
+ * called when the dialog closes
+ * @param parentShell
+ * the parent shell
+ * @param customManager
+ * the customization manager used by the
+ * ICustomizableLabelProvider. Can be null.
+ */
+ <T2, D> IETypedElementSelectionDialog<D> openETypedElementSelectionDialog(
+ Collection<? extends ETypedElement> eTypedElements,
+ int selectionMaxSize, boolean allowEmpty,
+ IDialogCallbackWithPreCommit<List<ETypedElement>, T2, D> callback,
+ Shell parentShell,
+ ICustomizationManager customManager,
+ Collection<? extends EPackage> knownFacetSets);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogInternal.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogInternal.java
new file mode 100644
index 00000000000..aefe12d6287
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogInternal.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * 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
+ * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>)
+ *******************************************************************************/
+package org.eclipse.emf.facet.efacet.ui.internal.exported.dialog;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.jface.window.Window;
+
+/**
+ * Internal interface for a dialog to let the user select ETypedElements.
+ *
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @since 0.2.0
+ */
+public interface IETypedElementSelectionDialogInternal<D> extends
+ IETypedElementSelectionDialog<D> {
+
+ /**
+ * @return whether the "OK" button is currently enabled. It can be disabled if a validator is set, and the current
+ * selection is not valid.
+ */
+ boolean isOkButtonEnabled();
+
+ /**
+ * @return the selected ETypedElements.
+ * @throws UnsupportedOperationException
+ * if the dialog was cancelled (check {@link IETypedElementSelectionDialogInternal#getReturnCode()
+ * getReturnCode} before calling this method
+ */
+ List<ETypedElement> getSelectedETypedElements();
+
+ /**
+ * @return the first selected ETypedElements or <code>null</code> if none.
+ * @throws UnsupportedOperationException
+ * if the dialog was cancelled (check {@link IETypedElementSelectionDialogInternal#getReturnCode()
+ * getReturnCode} before calling this method
+ */
+ ETypedElement getFirstSelectedETypedElement();
+
+ /** @return {@link Window#OK} or {@link Window#CANCEL}. */
+ int getReturnCode();
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialog.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialog.java
new file mode 100644
index 00000000000..91cd10c2e78
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialog.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * 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.exported.dialog;
+
+import java.util.List;
+
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet;
+
+/**
+ * A dialog to let the user select facet sets to load.
+ *
+ * @param <T>
+ * the type of a pre-commit dialog
+ *
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @since 0.2.0
+ */
+public interface IFacetSetSelectionDialog<T> {
+
+ /** Set the selection to the given list of {@link FacetSet}s */
+ void setSelectedFacetSets(List<? extends FacetSet> newSelection);
+
+ /**
+ * Emulate a press on the OK button
+ *
+ * @return a pre-commit dialog, or <code>null</code> if no pre-commit dialog was opened
+ */
+ T pressOk();
+
+ /** Emulate a press on the Cancel button */
+ void pressCancel();
+
+ /** Check all {@link FacetSet}s */
+ void selectAll();
+
+ /** Uncheck all {@link FacetSet}s */
+ void deselectAll();
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialogFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialogFactory.java
new file mode 100644
index 00000000000..fa75a93c946
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialogFactory.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * 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.exported.dialog;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet;
+import org.eclipse.emf.facet.efacet.ui.internal.dialogs.FacetSetSelectionDialogFactory;
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallback;
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * A factory to create {@link IFacetSetSelectionDialog}s
+ *
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @since 0.2.0
+ */
+public interface IFacetSetSelectionDialogFactory {
+
+ /** This is the default instance of this interface. */
+ IFacetSetSelectionDialogFactory DEFAULT = new FacetSetSelectionDialogFactory();
+
+ /**
+ * Open a dialog to let the user select facet sets.
+ *
+ * @param available
+ * the {@link FacetSet}s the user will be able to select in the dialog
+ * @param selectionMaxSize
+ * the maximum number of {@link FacetSet}s that the user can select
+ * @param allowEmpty
+ * whether to allow the user to select no FacetSet (i.e : select <code>null</code>)
+ * @param callback
+ * called when the dialog closes
+ * @param parentShell
+ * the parent shell
+ * @return an instance of the dialog being opened
+ */
+ IFacetSetSelectionDialog<?> openFacetSetSelectionDialog(Collection<FacetSet> available,
+ int selectionMaxSize, boolean allowEmpty, IDialogCallback<List<FacetSet>> callback,
+ Shell parentShell);
+
+ /**
+ * Open a dialog to let the user select facet sets. The callback will be called before the dialog closes, to let you
+ * open a "pre-commit" dialog, to ask the user for confirmation for example.
+ *
+ * @param available
+ * the {@link FacetSet}s the user will be able to select in the dialog
+ * @param selectionMaxSize
+ * the maximum number of {@link FacetSet}s that the user can select
+ * @param allowEmpty
+ * whether to allow the user to select no FacetSet (i.e : select <code>null</code>)
+ * @param callback
+ * called before the dialog is committed, and again when the dialog is committed
+ * @param parentShell
+ * the parent shell
+ * @return an instance of the dialog being opened
+ */
+ <T> IFacetSetSelectionDialog<T> openFacetSetSelectionDialog(Collection<FacetSet> available,
+ int selectionMaxSize, boolean allowEmpty, IDialogCallbackWithPreCommit<List<FacetSet>, Boolean, T> callback,
+ Shell parentShell);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialogInternal.java b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialogInternal.java
new file mode 100644
index 00000000000..e8e584b98f0
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.efacet.ui/src/org/eclipse/papyrus/emf/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialogInternal.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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.exported.dialog;
+
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet;
+import org.eclipse.jface.viewers.TreeViewer;
+
+/**
+ * Internal interface for a dialog to let the user select {@link FacetSet}s.
+ *
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ *
+ * @param <T>
+ * the type of a pre-commit dialog (can be <code>null</code> if there is no pre-commit dialog)
+ */
+public interface IFacetSetSelectionDialogInternal<T> extends IFacetSetSelectionDialog<T> {
+
+ /**
+ * @return whether the "OK" button is currently enabled. It can be disabled if a validator is set, and the current
+ * selection is not valid.
+ */
+ boolean isOkButtonEnabled();
+
+ /** @return the tree viewer */
+ TreeViewer getTreeViewer();
+}

Back to the top