Fix layout glitches
[lgpl/argeo-commons.git] / org.argeo.cms.ui.workbench / src / org / argeo / cms / ui / workbench / internal / jcr / parts / NodeVersionHistoryPage.java
index 4697b7acfd1bb1f17d7ec3261079b6839a0d3fe1..15cef3ef326623e4cd149ae1450af6c50b1199ea 100644 (file)
@@ -90,40 +90,33 @@ public class NodeVersionHistoryPage extends FormPage implements
                ScrolledForm form = managedForm.getForm();
                form.setText(WorkbenchUiPlugin.getMessage("nodeVersionHistoryPageTitle"));
                tk = managedForm.getToolkit();
+               Composite body = form.getBody();
                GridLayout twt = new GridLayout(1, false);
                twt.marginWidth = twt.marginHeight = 5;
-               Composite body = form.getBody();
                body.setLayout(twt);
-
                try {
                        if (!currentNode.isNodeType(NodeType.MIX_VERSIONABLE)) {
                                tk.createLabel(body,
                                                WorkbenchUiPlugin.getMessage("warningUnversionableNode"));
                        } else {
-                               createHistorySection(form.getBody());
-                               createTreeSection(form.getBody());
+                               createHistorySection(body);
+                               createTreeSection(body);
                        }
                } catch (RepositoryException e) {
-                       throw new EclipseUiException(
-                                       "Unexpected error while checking if node is versionable", e);
+                       throw new EclipseUiException("Unable to check if node is versionable", e);
                }
        }
 
        protected void createTreeSection(Composite parent) {
-               // Section Layout & MetaData
                Section section = tk.createSection(parent, Section.TWISTIE);
                section.setLayoutData(new GridData(GridData.FILL_BOTH));
                section.setText(WorkbenchUiPlugin.getMessage("versionTreeSectionTitle"));
 
-               // Section Body
                Composite body = tk.createComposite(section, SWT.FILL);
-               // WARNING : 2 following lines are compulsory or body won't be
-               // displayed.
-               body.setLayout(new GridLayout());
                section.setClient(body);
-
-               body.setLayoutData(new GridData(GridData.FILL_BOTH));
                section.setExpanded(true);
+               body.setLayoutData(new GridData(GridData.FILL_BOTH));
+               body.setLayout(new GridLayout());
 
                nodeContentProvider = new FullVersioningTreeContentProvider();
                nodesViewer = createNodeViewer(body, nodeContentProvider);
@@ -160,8 +153,8 @@ public class NodeVersionHistoryPage extends FormPage implements
 
                final Text styledText = tk.createText(section, "", SWT.FULL_SELECTION
                                | SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
-               styledText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
                section.setClient(styledText);
+               styledText.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.FILL_GRAB));
                refreshHistory(styledText);
                styledText.setEditable(false);
                section.setExpanded(false);
@@ -254,7 +247,6 @@ public class NodeVersionHistoryPage extends FormPage implements
                } catch (RepositoryException e) {
                        throw new EclipseUiException("Cannot generate history for node", e);
                }
-
        }
 
        public List<VersionDiff> listHistoryDiff() {