From 5f483b2ddb6cb736bae99da3b7563c99246b273d Mon Sep 17 00:00:00 2001 From: bsinou Date: Wed, 1 Feb 2017 15:19:01 +0100 Subject: [PATCH] Various small enhancements --- .../forms/EditableMultiStringProperty.java | 32 +++++++----------- .../argeo/eclipse/ui/fs/FsTableViewer.java | 7 ++-- .../eclipse/ui/fs/NioFileLabelProvider.java | 5 ++- .../src/org/argeo/eclipse/ui/fs/fldr_obj.gif | Bin 216 -> 219 bytes 4 files changed, 19 insertions(+), 25 deletions(-) diff --git a/org.argeo.cms.ui/src/org/argeo/cms/forms/EditableMultiStringProperty.java b/org.argeo.cms.ui/src/org/argeo/cms/forms/EditableMultiStringProperty.java index e02bdeb93..859f64b28 100644 --- a/org.argeo.cms.ui/src/org/argeo/cms/forms/EditableMultiStringProperty.java +++ b/org.argeo.cms.ui/src/org/argeo/cms/forms/EditableMultiStringProperty.java @@ -24,14 +24,13 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; /** Display, add or remove values from a list in a CMS context */ -public class EditableMultiStringProperty extends StyledControl implements - EditablePart { +public class EditableMultiStringProperty extends StyledControl implements EditablePart { private static final long serialVersionUID = -7044614381252178595L; private String propertyName; private String message; - // TODO implement the ability to provide a list of legal values -// private String[] possibleValues; + // TODO implement the ability to provide a list of possible values + private String[] possibleValues; private boolean canEdit; private SelectionListener removeValueSL; private List values; @@ -44,15 +43,14 @@ public class EditableMultiStringProperty extends StyledControl implements private int btnHeight = 16; private int btnHorizontalIndent = 3; - public EditableMultiStringProperty(Composite parent, int style, Node node, - String propertyName, List values, String[] possibleValues, - String addValueMsg, SelectionListener removeValueSelectionListener) + public EditableMultiStringProperty(Composite parent, int style, Node node, String propertyName, List values, + String[] possibleValues, String addValueMsg, SelectionListener removeValueSelectionListener) throws RepositoryException { super(parent, style, node, true); this.propertyName = propertyName; this.values = values; -// this.possibleValues = possibleValues; + this.possibleValues = new String[]{"Un", "Deux", "Trois"}; this.message = addValueMsg; this.canEdit = removeValueSelectionListener != null; this.removeValueSL = removeValueSelectionListener; @@ -122,11 +120,9 @@ public class EditableMultiStringProperty extends StyledControl implements return label; } - private Composite createRemovableValue(Composite parent, int style, - String value) { + private Composite createRemovableValue(Composite parent, int style, String value) { Composite valCmp = new Composite(parent, SWT.NO_FOCUS); - GridLayout gl = EclipseUiUtils.noSpaceGridLayout(new GridLayout(2, - false)); + GridLayout gl = EclipseUiUtils.noSpaceGridLayout(new GridLayout(2, false)); gl.marginRight = oneValueMargingRight; valCmp.setLayout(gl); @@ -135,8 +131,7 @@ public class EditableMultiStringProperty extends StyledControl implements Button deleteBtn = new Button(valCmp, SWT.FLAT); deleteBtn.setData(FormConstants.LINKED_VALUE, value); deleteBtn.addSelectionListener(removeValueSL); - CmsUtils.style(deleteBtn, FormStyle.delete.style() - + FormStyle.BUTTON_SUFFIX); + CmsUtils.style(deleteBtn, FormStyle.delete.style() + FormStyle.BUTTON_SUFFIX); GridData gd = new GridData(); gd.heightHint = btnHeight; gd.widthHint = btnWidth; @@ -200,15 +195,12 @@ public class EditableMultiStringProperty extends StyledControl implements return; if (values.contains(value)) - errMsg = "Dupplicated value: " + value - + ", please correct and try again"; + errMsg = "Dupplicated value: " + value + ", please correct and try again"; if (errMsg != null) - MessageDialog.openError(this.getShell(), "Addition not allowed", - errMsg); + MessageDialog.openError(this.getShell(), "Addition not allowed", errMsg); else { values.add(value); - Composite newCmp = createRemovableValue(text.getParent(), - SWT.SINGLE, value); + Composite newCmp = createRemovableValue(text.getParent(), SWT.SINGLE, value); newCmp.moveAbove(text); text.setText(""); newCmp.getParent().layout(); diff --git a/org.argeo.eclipse.ui/src/org/argeo/eclipse/ui/fs/FsTableViewer.java b/org.argeo.eclipse.ui/src/org/argeo/eclipse/ui/fs/FsTableViewer.java index 7e8e94fb6..370d9b9bd 100644 --- a/org.argeo.eclipse.ui/src/org/argeo/eclipse/ui/fs/FsTableViewer.java +++ b/org.argeo.eclipse.ui/src/org/argeo/eclipse/ui/fs/FsTableViewer.java @@ -33,16 +33,15 @@ public class FsTableViewer extends TableViewer { public Table configureDefaultSingleColumnTable(int tableWidthHint) { Table table = this.getTable(); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); - table.setLinesVisible(true); + table.setLinesVisible(false); table.setHeaderVisible(false); -// CmsUtils.markup(table); -// CmsUtils.style(table, MaintenanceStyles.BROWSER_COLUMN); + // CmsUtils.markup(table); + // CmsUtils.style(table, MaintenanceStyles.BROWSER_COLUMN); TableViewerColumn column = new TableViewerColumn(this, SWT.NONE); TableColumn tcol = column.getColumn(); tcol.setWidth(tableWidthHint); column.setLabelProvider(new FileIconNameLabelProvider()); - this.setContentProvider(new MyLazyCP()); return table; } diff --git a/org.argeo.eclipse.ui/src/org/argeo/eclipse/ui/fs/NioFileLabelProvider.java b/org.argeo.eclipse.ui/src/org/argeo/eclipse/ui/fs/NioFileLabelProvider.java index 391f250eb..68fc70b77 100644 --- a/org.argeo.eclipse.ui/src/org/argeo/eclipse/ui/fs/NioFileLabelProvider.java +++ b/org.argeo.eclipse.ui/src/org/argeo/eclipse/ui/fs/NioFileLabelProvider.java @@ -22,7 +22,10 @@ public class NioFileLabelProvider extends ColumnLabelProvider { try { switch (propName) { case FsUiConstants.PROPERTY_SIZE: - return FsUiUtils.humanReadableByteCount(Files.size(path), false); + if (Files.isDirectory(path)) + return "-"; + else + return FsUiUtils.humanReadableByteCount(Files.size(path), false); case FsUiConstants.PROPERTY_LAST_MODIFIED: return Files.getLastModifiedTime(path).toString(); case FsUiConstants.PROPERTY_TYPE: diff --git a/org.argeo.eclipse.ui/src/org/argeo/eclipse/ui/fs/fldr_obj.gif b/org.argeo.eclipse.ui/src/org/argeo/eclipse/ui/fs/fldr_obj.gif index 51e703b1b9c671baa2be0f6525edb3b69403370d..42e027c933103acb0bc3a6889b1ee253bdfa4657 100644 GIT binary patch literal 219 zcmZ?wbhEHb6krfwIKsg2=fjTwU(ft}x$*zUL!a)i`2TwI|EEj--|GB-f7+YNbN*i} z{eQLg>4}NkYYq1|o9u5f+1+4#yxaU}r`gdi^F!@s8_V^#R2r-=)!$xYw6WY^bAj4_ zFkpZI#h)yU3=A?1Iv@d%oeZoI3hI3+ne)<@xV>1B`(fEuK?V+&Lu+13upU?-aN>~% z+leJYmV$v?7gmUP30m^pSR?jZz)|4A1_>U)M7|eWr0xntihbB2lP8!e@?(!&ykzXZ OhQ@l`mR1!-25SJE4`R#! literal 216 zcmZ?wbhEHb6krfwIKsg2wj(b5!P~sjn^4pBFDXFJ7TPNb)}zFdzZN zpDc_F4AKlbATf}g46LCK)cR5~=VfGBty!EmMJ+qTijl!k<;;`cOWYDXbj&=28jDUI znIPA;;-J&oD09KqYe6rnb~B%5E3$|