Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 349809

Summary: User does not notice if text is getting shorted automatically on copy&paste
Product: z_Archived Reporter: Claudio Guglielmo <claudio.guglielmo>
Component: ScoutAssignee: Project Inbox <scout.core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: enhancement    
Priority: P3 CC: Andreas.Hoegger, bsh, lhu
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:
Bug Depends on:    
Bug Blocks: 396192    

Description Claudio Guglielmo CLA 2011-06-20 08:29:23 EDT
Build Identifier: 3.8.0

If MaxLength is set on a string field and a text whose length exceeds that value is pasted from the clipboard the text will automatically be shorted without informing the user.

It would be good to either inform the user with a message box saying the text was shorted or to invalidate the value so that the user can correct it by himself.
In my opinion the invalidation would be better but only if validateOnAnyKey is set to true otherwise the user does not know when the text is short enough. Because of this I would prefer the solution with the message box.

BTW: At the moment a project can achieve this by either overriding execParseValue of a StringField like this:

public String execParseValue(String text) throws ProcessingException {
            if (StringUtility.hasText(text) && text.length() > getMaxLength()) {
              MessageBox.showOkMessage(null, null, "The inserted text is too long for this field and has therefore been truncated."));
            }
            return super.execParseValue(text);
          }

Or (more general) by creating a custom SwtScoutStringField with a ModifyListener.

Reproducible: Always
Comment 1 Beat Schwarzentrub CLA 2011-10-19 10:30:59 EDT
I think this is an SWT-only problem. The Swing variants of the Scout fields already handle this correctly (see org.eclipse.scout.rt.ui.swing.basic.document.BasicDocumentFilter).
Comment 2 Lukas Huser CLA 2011-12-27 15:17:20 EST
[Swing] The implementation of this feature is not complete for Swing either. When pasting to a StringField with keyboard shortcut ctrl-v, the user is informed with a message box. But when using the context menu item "Paste" on a StringField, the content is silently truncated to the maximum field length.
Comment 3 Andreas Hoegger CLA 2015-04-14 09:55:34 EDT
Scout Project clean up.
Bugs matching one of the following criteria will be removed:
- SWT, Swing and HTML(RAP) bugs which are not mandatory for the next release. The future is the new HTML UI.
- Bugs concerning a replaced technology.
- old bugs which got obsolete.
Comment 4 Matthias Zimmermann CLA 2015-07-06 08:24:57 EDT
bugzilla cleanup for bugs in state WONTFIX, INVALID and WORSFORME and no target milestone.

in case the bug should have been closed by mistake, please reopen the bug and let us know why you think that this bug should not have been closed.