Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog')
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialog.java51
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogCallback.java28
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogCallbackWithPreCommit.java59
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogWithoutResultCallback.java33
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IOkDialog.java32
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IOkDialogFactory.java52
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IQuestionDialog.java43
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IQuestionDialogFactory.java49
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IWithResultDialogCallback.java34
9 files changed, 381 insertions, 0 deletions
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialog.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialog.java
new file mode 100644
index 00000000000..33e36c54d8e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialog.java
@@ -0,0 +1,51 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.dialog;
+
+import org.eclipse.emf.facet.util.ui.internal.exported.util.dialog.AbstractDialog;
+
+/**
+ * @see AbstractDialog
+ * @since 0.3
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface IDialog<W extends Object> {
+
+ /**
+ * Press the "Ok" button.
+ */
+ void commit();
+
+ /**
+ * Press the "Cancel" button.
+ */
+ void cancel();
+
+ /**
+ * Open the dialog. This method is used for to open the dialog into the
+ * thread UI. So, this method has no to be called into the constructor.
+ *
+ * @return the result of the dialog (OK or CANCEL).
+ */
+ int open();
+
+ /**
+ * Return if the dialog is valid or not.
+ *
+ * @return true if all the necessaries properties are set.
+ */
+ boolean isDialogValid();
+
+ W getWidget();
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogCallback.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogCallback.java
new file mode 100644
index 00000000000..34e56f47245
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogCallback.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Initial API
+ * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.ui.internal.exported.dialog;
+
+/**
+ * A callback used to return a dialog's result asynchronously.
+ *
+ * @param <T>
+ * the type of the result
+ */
+public interface IDialogCallback<T> {
+ /**
+ * The user committed their selection in the dialog.
+ *
+ * @param result
+ * the result
+ */
+ void committed(T result);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogCallbackWithPreCommit.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogCallbackWithPreCommit.java
new file mode 100644
index 00000000000..b53f3b1ba03
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogCallbackWithPreCommit.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Initial API
+ * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.ui.internal.exported.dialog;
+
+/**
+ * A callback used to return a dialog's result asynchronously. This interface makes it possible to open a second
+ * "pre-commit" dialog when the user commits their selection in the first dialog. This second dialog is given the
+ * opportunity to open before the first dialog closes. This can be useful to ask the user for confirmation for example.
+ * <p>
+ * The second dialog should either:
+ * <ul>
+ * <li>call {@link IDialogCallback#committed(Object) committed} on the callback passed to
+ * {@link IDialogCallbackWithPreCommit#openPrecommitDialog(Object, IDialogCallback) openPrecommitDialog} with the
+ * definitive result
+ * <li>do nothing if the pre-commit dialog was canceled
+ * </ul>
+ *
+ * @param <T1>
+ * the type of the result for the first dialog
+ * @param <T2>
+ * the type of the result for the pre-commit dialog
+ * @param <D>
+ * the type of the pre-commit dialog
+ */
+public interface IDialogCallbackWithPreCommit<T1, T2, D> {
+ /**
+ * The user confirmed their choice in the pre-commit dialog.
+ *
+ * @param result
+ * the result of the first dialog
+ * @param precommitResult
+ * the result of the pre-commit dialog
+ */
+ void committed(T1 result, T2 precommitResult);
+
+ /**
+ * The user committed their selection in the first dialog. This method is called to let you open a second
+ * "pre-commit" dialog, that can prompt the user for confirmation.
+ *
+ * @param result
+ * the result from the first dialog
+ * @param precommitCallback
+ * you must call {@link IDialogCallback#committed(Object) committed} on this callback if the user
+ * confirms their choice in the second (pre-commit) dialog, and pass the result of the pre-commit dialog.
+ * Or do nothing if the user chose to cancel. If you return <code>null</code> from this method, you
+ * mustn't call {@link IDialogCallback#committed(Object)} or the commit will be done twice
+ * @return the pre-commit dialog (for unit tests), or <code>null</code> if no pre-commit callback is needed
+ */
+ D openPrecommitDialog(T1 result, IDialogCallback<T2> precommitCallback);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogWithoutResultCallback.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogWithoutResultCallback.java
new file mode 100644
index 00000000000..c2f44779394
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogWithoutResultCallback.java
@@ -0,0 +1,33 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.dialog;
+
+
+/**
+ * A callback used to return a dialog's result asynchronously.
+ *
+ * @since 0.3
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface IDialogWithoutResultCallback {
+
+ /**
+ * The user commit his action.
+ */
+ void commited();
+
+ /**
+ * The user cancel his action.
+ */
+ void canceled();
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IOkDialog.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IOkDialog.java
new file mode 100644
index 00000000000..c578bdde60d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IOkDialog.java
@@ -0,0 +1,32 @@
+/**
+ * Copyright (c) Soft-Maint.
+ *
+ * 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:
+ * Thomas Cicognani (Soft-Maint) - Bug 406565 - Ok Dialog
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.dialog;
+
+
+/**
+ *
+ * @author tcicognani
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @since 0.4
+ */
+public interface IOkDialog {
+
+ void commit();
+
+ boolean isInformation();
+
+ boolean isWarning();
+
+ boolean isError();
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IOkDialogFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IOkDialogFactory.java
new file mode 100644
index 00000000000..030c54a0a26
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IOkDialogFactory.java
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) Soft-Maint.
+ *
+ * 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:
+ * Thomas Cicognani (Soft-Maint) - Bug 406565 - Ok Dialog
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.dialog;
+
+import org.eclipse.emf.facet.util.ui.internal.dialog.OkDialogFactory;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ *
+ * @author tcicognani
+ *
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @since 0.4
+ */
+public interface IOkDialogFactory {
+ IOkDialogFactory DEFAULT = new OkDialogFactory();
+
+ IOkDialog openDialog(Shell parentShell, int kind, String title,
+ String message, IDialogCallback<Void> iDialogCallback);
+
+ IOkDialog openDialog(Shell parentShell, int kind, String title,
+ String message);
+
+ IOkDialog openInformationDialog(Shell parentShell, String title,
+ String message, IDialogCallback<Void> iDialogCallback);
+
+ IOkDialog openInformationDialog(Shell parentShell, String title,
+ String message);
+
+ IOkDialog openWarningDialog(Shell parentShell, String title,
+ String message, IDialogCallback<Void> iDialogCallback);
+
+ IOkDialog openWarningDialog(Shell parentShell, String title, String message);
+
+ IOkDialog openErrorDialog(Shell parentShell, String title, String message,
+ IDialogCallback<Void> iDialogCallback);
+
+ IOkDialog openErrorDialog(Shell parentShell, String title, String message);
+
+ IOkDialog openErrorDialog(Shell parentShell, Exception exception,
+ String message);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IQuestionDialog.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IQuestionDialog.java
new file mode 100644
index 00000000000..d336f8977f2
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IQuestionDialog.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * 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 366367 - To be able to change the "CanBePresentedInTheTable" query
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.ui.internal.exported.dialog;
+
+import org.eclipse.swt.widgets.Shell;
+
+/** A simple dialog with a title, a message, and "yes" and "no" buttons */
+public interface IQuestionDialog {
+
+ /** Opens the dialog */
+ void open();
+
+ /** Programmatically emulate a press on the "Yes" button */
+ void pressYes();
+
+ /** Programmatically emulate a press on the "No" button */
+ void pressNo();
+
+ /** Add a listener that will be modified when the dialog closes */
+ void addCloseListener(final Runnable runnable);
+
+ /**
+ * Get the user's answer
+ *
+ * @return <ul>
+ * <li><code>true</code> if the user clicked "Yes"
+ * <li><code>false</code> if the user clicked "No"
+ * <li><code>null</code> if the user closed the dialog without clicking either on "Yes" or "No"
+ * </ul>
+ */
+ Boolean getResult();
+
+ /** @return the dialog's shell */
+ Shell getShell();
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IQuestionDialogFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IQuestionDialogFactory.java
new file mode 100644
index 00000000000..f43e2632424
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IQuestionDialogFactory.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * 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 366367 - To be able to change the "CanBePresentedInTheTable" query
+ * Gregoire Dupe (Mia-Software) - Bug 374903 - [Table] ITableWidget.setLoadedFacetSets
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.ui.internal.exported.dialog;
+
+import org.eclipse.emf.facet.util.ui.internal.dialog.QuestionDialogFactory;
+import org.eclipse.swt.widgets.Shell;
+
+/** A factory to instantiate {@link IQuestionDialog} */
+public interface IQuestionDialogFactory {
+ static IQuestionDialogFactory INSTANCE = new QuestionDialogFactory();
+
+ /**
+ * Instantiates a question dialog (without opening it)
+ *
+ * @param parent
+ * the parent shell for the new dialog
+ * @param title
+ * the text that appears in the title of the dialog
+ * @param message
+ * the text that appears in the message area of the dialog
+ * @return the dialog, ready to be {@link IQuestionDialog#open() opened}
+ */
+ @Deprecated
+ IQuestionDialog createQuestionDialog(Shell parent, String title, String message);
+
+ /**
+ * Instantiates a question dialog (without opening it)
+ *
+ * @param parent
+ * the parent shell for the new dialog
+ * @param title
+ * the text that appears in the title of the dialog
+ * @param message
+ * the text that appears in the message area of the dialog
+ * @return the dialog, ready to be {@link IQuestionDialog#open() opened}
+ * @since 0.2
+ */
+ IQuestionDialog createQuestionDialog(Shell parent, String title,
+ String message, IDialogCallback<Boolean> callback);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IWithResultDialogCallback.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IWithResultDialogCallback.java
new file mode 100644
index 00000000000..e6110141109
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IWithResultDialogCallback.java
@@ -0,0 +1,34 @@
+/**
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 406570 - Handlers to Save and SaveAs EMF resources
+ */
+package org.eclipse.emf.facet.util.ui.internal.exported.dialog;
+
+
+/**
+ * A callback used to return a dialog's result asynchronously.
+ *
+ * @since 0.3
+ * @noextend This interface is not intended to be extended by clients.
+ */
+public interface IWithResultDialogCallback<T> {
+
+ /**
+ * The user commit his action.
+ */
+ void commited(T result);
+
+ /**
+ * The user cancel his action.
+ */
+ void canceled(T result);
+}

Back to the top