Commit ee393940 authored by Romain Bioteau's avatar Romain Bioteau Committed by GitHub

feat(startup) remove import workspace (#1570)

Closes BST-76
parent 983ff7c7
......@@ -33,10 +33,9 @@ incompatibleJavaVersionMessage=You are running %s using an incompatible Java ver
exitWarningMessage=Exit {0}?\n\nClosing the Studio will delete unsaved work in the {1} and in the {2}. Be sure you have saved any opened elements in the {2}, and export your custom resources from the {1}.\n\nNote: In <A>Preferences > Database</A>, you can uncheck the "On exit clean database" option to keep your database content.
doNotShowMeAgain=Do not show me this dialog again
startDialogTitle=Welcome to Bonita Studio %s
startDialogMsg=\u2022 Many new values in this Bonita. We strongly advise you to read the <a>%s</a>.\n\n\u2022 If you are upgrading from a previous version you may want to import your work from an existing workspace.
startDialogDetails=you can import an existing workspace later, using the following menu from the Studio:\nFile > Import > Workspace
startDialogMsg=\u2022 Many new values in this Bonita. We strongly advise you to read the <a>%s</a>.\n\n\u2022 If you are upgrading from a previous version you may want to import your work using BOS Archives.
startDialogDetails=you can import a BOS Archive using the following menu from the Studio:\nFile > Import > Import BOS archive
releaseNote=release notes
importWorkspace=Import a workspace
_6xFormsDontWorkAnymore=6.x forms based on Google Web Toolkit (GWT) technology are not supported anymore
letsStart=Let's start !
NewButtonLabel=New
......
......@@ -16,7 +16,6 @@ package org.bonitasoft.studio.application.dialog;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Objects;
import org.bonitasoft.studio.application.i18n.Messages;
......@@ -24,40 +23,25 @@ import org.bonitasoft.studio.common.ProductVersion;
import org.bonitasoft.studio.common.jface.MessageDialogWithPrompt;
import org.bonitasoft.studio.common.log.BonitaStudioLog;
import org.bonitasoft.studio.preferences.browser.OpenBrowserOperation;
import org.eclipse.core.commands.Command;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.NotEnabledException;
import org.eclipse.core.commands.NotHandledException;
import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.e4.core.commands.ECommandService;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.forms.events.ExpansionAdapter;
import org.eclipse.ui.forms.events.ExpansionEvent;
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.internal.WorkbenchWindow;
public class StartupMessageDialog extends MessageDialogWithPrompt {
private Link startMessage;
private Label title;
public static int IMPORT_BUTTON_ID = 38;
public StartupMessageDialog(Shell parentShell) {
super(parentShell,
......@@ -141,10 +125,8 @@ public class StartupMessageDialog extends MessageDialogWithPrompt {
@Override
protected void createButtonsForButtonBar(Composite parent) {
Button importButton = createButton(parent, IMPORT_BUTTON_ID, Messages.importWorkspace, false);
super.createButtonsForButtonBar(parent);
getButton(IDialogConstants.OK_ID).setText(Messages.letsStart);
importButton.addListener(SWT.Selection, e -> Display.getDefault().asyncExec(this::openImportWorkspaceDialog));
}
private void createDetailsSection(Composite parent) {
......@@ -173,37 +155,4 @@ public class StartupMessageDialog extends MessageDialogWithPrompt {
});
}
private void openImportWorkspaceDialog() {
IEclipseContext context = ((WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow()).getModel()
.getContext();
ECommandService commandService = context.get(ECommandService.class);
Command importWorksapceCommand = commandService.getCommand("org.bonitasoft.studio.importer.workspace.command");
try {
close();
importWorksapceCommand
.executeWithChecks(new ExecutionEvent(importWorksapceCommand, new HashMap<>(), null, context));
} catch (ExecutionException | NotHandledException | NotDefinedException | NotEnabledException e1) {
throw new RuntimeException("Failed to execute import workspace command", e1);
}
}
private String getAccessibleMessageFor(Image image) {
if (image.equals(getErrorImage())) {
return JFaceResources.getString("error");//$NON-NLS-1$
}
if (image.equals(getWarningImage())) {
return JFaceResources.getString("warning");//$NON-NLS-1$
}
if (image.equals(getInfoImage())) {
return JFaceResources.getString("info");//$NON-NLS-1$
}
if (image.equals(getQuestionImage())) {
return JFaceResources.getString("question"); //$NON-NLS-1$
}
return null;
}
}
......@@ -68,7 +68,6 @@ public class Messages extends NLS {
public static String doNotShowMeAgain;
public static String startDialogMsg;
public static String startDialogDetails;
public static String importWorkspace;
public static String releaseNote;
public static String letsStart;
public static String _6xFormsDontWorkAnymore;
......
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