Improve CMS dialogs and localisation.
[lgpl/argeo-commons.git] / org.argeo.cms.ui / src / org / argeo / cms / ui / dialogs / CmsWizardDialog.java
index de41bbfe15c8b31b9b48537b9f85ea5cf700feec..e4fe35d3426c72880e9d20afb968a5f45c90860c 100644 (file)
@@ -2,12 +2,10 @@ package org.argeo.cms.ui.dialogs;
 
 import java.lang.reflect.InvocationTargetException;
 
-import org.argeo.cms.CmsException;
 import org.argeo.cms.CmsMsg;
-import org.argeo.cms.util.CmsUtils;
+import org.argeo.cms.ui.util.CmsUiUtils;
 import org.argeo.eclipse.ui.EclipseUiUtils;
 import org.argeo.eclipse.ui.Selected;
-import org.argeo.eclipse.ui.dialogs.LightweightDialog;
 import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.jface.wizard.IWizard;
 import org.eclipse.jface.wizard.IWizardContainer2;
@@ -24,6 +22,7 @@ import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
 
+/** A wizard dialog based on {@link LightweightDialog}. */
 public class CmsWizardDialog extends LightweightDialog implements IWizardContainer2 {
        private static final long serialVersionUID = -2123153353654812154L;
 
@@ -47,7 +46,7 @@ public class CmsWizardDialog extends LightweightDialog implements IWizardContain
                wizard.addPages();
                currentPage = wizard.getStartingPage();
                if (currentPage == null)
-                       throw new CmsException("At least one wizard page is required");
+                       throw new IllegalArgumentException("At least one wizard page is required");
        }
 
        @Override
@@ -57,7 +56,7 @@ public class CmsWizardDialog extends LightweightDialog implements IWizardContain
                Composite messageArea = new Composite(parent, SWT.NONE);
                messageArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
                {
-                       messageArea.setLayout(CmsUtils.noSpaceGridLayout(new GridLayout(2, false)));
+                       messageArea.setLayout(CmsUiUtils.noSpaceGridLayout(new GridLayout(2, false)));
                        titleBar = new Label(messageArea, SWT.WRAP);
                        titleBar.setFont(EclipseUiUtils.getBoldFont(parent));
                        titleBar.setLayoutData(new GridData(SWT.BEGINNING, SWT.FILL, true, false));
@@ -78,7 +77,7 @@ public class CmsWizardDialog extends LightweightDialog implements IWizardContain
                IWizardPage[] pages = wizard.getPages();
                for (int i = 0; i < pages.length; i++) {
                        pageBodies[i] = new Composite(body, SWT.NONE);
-                       pageBodies[i].setLayout(CmsUtils.noSpaceGridLayout());
+                       pageBodies[i].setLayout(CmsUiUtils.noSpaceGridLayout());
                        setSwitchingFormData(pageBodies[i]);
                        pages[i].createControl(pageBodies[i]);
                }
@@ -137,7 +136,7 @@ public class CmsWizardDialog extends LightweightDialog implements IWizardContain
                        }
                }
                if (index < 0)
-                       throw new CmsException("Cannot find index of wizard page " + page);
+                       throw new IllegalArgumentException("Cannot find index of wizard page " + page);
                pageBodies[index].moveAbove(pageBodies[currentPageIndex]);
 
                // // clear