Commit dd8f0c60 authored by Romain Bioteau's avatar Romain Bioteau Committed by Adrien
Browse files

feat(app) add export warning dialog (#389)

Closes [BS-16327](https://bonitasoft.atlassian.net/browse/BS-16327)
parent 83fa2273
......@@ -49,3 +49,5 @@ deleteContainer=Delete the file %s, with all its application descriptors
applicationInfo=An application file contains one or several application descriptors.\nSince each application is dedicated to a unique user profile, you can use this file to bundle together applications on the same topic.\n\nExample:\nManaging leave requests with Bonita BPM can be handled with such a file, containing one application descriptor for employees,\none for managers, one for HR officers, and one for administrators
applicationDetails=Application descriptors hold meta data about the application (url token, name, version, user profile), but also its navigation,\nas well as links to the pages it needs to access.\nThey were created in the Portal prior to Bonita BPM 7.5 and are now handled in the Studio to ease packaging and deployment.\nThe Studio is not aware of what is created in the Portal, so deploying an application descriptor may overwrite some Portal content.
doNotShowMeAgain=Do not show me this dialog again
exportApplicationDescriptorTitle=Export
exportApplicationDescriptorMessage=You are about to export an application descriptor file.\nApplication(s) REST API extensions, pages and profiles are not part of the file. \nMake sure they are already installed before you import this file in the Portal.
\ No newline at end of file
......@@ -22,9 +22,11 @@ import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import org.bonitasoft.studio.common.jface.MessageDialogWithPrompt;
import org.bonitasoft.studio.common.repository.RepositoryAccessor;
import org.bonitasoft.studio.common.repository.model.IRepositoryFileStore;
import org.bonitasoft.studio.common.repository.ui.OverwriteFileFilter;
import org.bonitasoft.studio.la.LivingApplicationPlugin;
import org.bonitasoft.studio.la.core.ExportApplicationRunnable;
import org.bonitasoft.studio.la.i18n.Messages;
import org.bonitasoft.studio.la.repository.ApplicationRepositoryStore;
......@@ -34,6 +36,7 @@ import org.bonitasoft.studio.ui.wizard.WizardBuilder;
import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.wizard.IWizardContainer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.DirectoryDialog;
......@@ -42,6 +45,8 @@ import org.eclipse.swt.widgets.Shell;
public class ExportApplicationHandler {
public static final String DO_NOT_SHOW_EXPORT_MESSAGE_DIALOG = "DO_NOT_SHOW_EXPORT_MESSAGE_DIALOG";
@Execute
public void exportApplicationWizard(Shell activeShell, RepositoryAccessor repositoryAccessor) {
createWizard(newWizard(), repositoryAccessor)
......@@ -69,6 +74,18 @@ public class ExportApplicationHandler {
if (resolveConflicts.isEmpty()) {
return Optional.empty();
}
final IPreferenceStore preferenceStore = LivingApplicationPlugin.getDefault().getPreferenceStore();
if (!preferenceStore.getBoolean(DO_NOT_SHOW_EXPORT_MESSAGE_DIALOG)) {
MessageDialogWithPrompt.open(MessageDialog.WARNING,
container.getShell(),
Messages.exportApplicationDescriptorTitle,
Messages.exportApplicationDescriptorMessage,
Messages.doNotShowMeAgain,
false,
preferenceStore,
DO_NOT_SHOW_EXPORT_MESSAGE_DIALOG,
SWT.NONE);
}
final ExportApplicationRunnable operation = new ExportApplicationRunnable(optionalPath.get(), resolveConflicts);
try {
container.run(true, false, operation);
......
......@@ -69,6 +69,8 @@ public class Messages extends NLS {
public static String applicationInfo;
public static String doNotShowMeAgain;
public static String applicationDetails;
public static String exportApplicationDescriptorTitle;
public static String exportApplicationDescriptorMessage;
static {
NLS.initializeMessages("messages", Messages.class);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment