From 8e9f1136ae985e98dc3fab5b7efb277742e38f4e Mon Sep 17 00:00:00 2001 From: Brian Clements Date: Tue, 11 Feb 2014 16:45:05 -0600 Subject: [PATCH] Issue #2699 require non blank handle previously defaulted to userid if handle left blank now reprompts for handle preferences now default to userid to pre-fill handle Former-commit-id: 0765451a9d141f9ae6fdfd1bc7731d730067faa8 [formerly 0765451a9d141f9ae6fdfd1bc7731d730067faa8 [formerly ae5f2d2b547241e7ba9c22aabaf64fceceb1b563]] Former-commit-id: ddf5b2a3ef189e32d04eeb9c4eb286c2f548a04a Former-commit-id: fab4fea177d7fbe4ed7fc5a8c0cfbe8d881277bc --- .../collaboration/ui/CreateSessionDialog.java | 11 +++++++--- .../uf/viz/collaboration/ui/InviteDialog.java | 20 ++++++++----------- .../ui/prefs/CollabPrefInitializer.java | 3 ++- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/CreateSessionDialog.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/CreateSessionDialog.java index 06e7f04432..1e9294fee1 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/CreateSessionDialog.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/CreateSessionDialog.java @@ -90,6 +90,7 @@ import com.raytheon.viz.ui.editor.IMultiPaneEditor; * Jan 30, 2014 2698 bclement added handle to join room with * Feb 3, 2014 2699 bclement added default handle preference * Feb 7, 2014 2699 bclement removed handle validation + * Feb 11, 2014 2699 bclement require non-blank handle * * * @@ -155,7 +156,7 @@ public class CreateSessionDialog extends CaveSWTDialog { handleTF.setText(HandleUtil.getDefaultHandle()); gd = new GridData(SWT.FILL, SWT.FILL, true, true); handleTF.setLayoutData(gd); - handleTF.addVerifyListener(validNameListener); + handleTF.setToolTipText("Default handle configuration available in preferences."); label = new Label(body, SWT.NONE); label.setText("Subject: "); @@ -454,6 +455,12 @@ public class CreateSessionDialog extends CaveSWTDialog { errorMessages.add(err); } String handle = handleTF.getText().trim(); + if (handle.isEmpty()) { + if (focusField == null) { + focusField = handleTF; + } + errorMessages.add("Handle cannot be empty."); + } if (focusField == null) { CreateSessionData result = new CreateSessionData(); @@ -504,8 +511,6 @@ public class CreateSessionDialog extends CaveSWTDialog { } errorMessage.setText(sb.toString()); errorMessage.setVisible(true); - statusHandler.handle(Priority.ERROR, - "Session Creation Error: " + sb.toString()); event.doit = false; setReturnValue(null); focusField.setFocus(); diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/InviteDialog.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/InviteDialog.java index cd28bd6700..975ff3c686 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/InviteDialog.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/InviteDialog.java @@ -23,8 +23,6 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.custom.StyledText; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.VerifyEvent; -import org.eclipse.swt.events.VerifyListener; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.layout.GridData; @@ -60,6 +58,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialogBase; * Aug 14, 2012 lvenable Initial creation. * Jan 30, 2014 2698 bclement added logic to join room and reprompt if failed * Feb 3, 2014 2699 bclement added default handle preference + * Feb 11, 2014 2699 bclement require non-blank handle * * * @@ -192,16 +191,9 @@ public class InviteDialog extends CaveSWTDialogBase { handleText = new Text(labelTextComp, SWT.BORDER); handleText.setText(HandleUtil.getDefaultHandle()); handleText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - handleText.addVerifyListener(new VerifyListener() { + handleText + .setToolTipText("Default handle configuration available in preferences."); - @Override - public void verifyText(VerifyEvent e) { - if (" \t\"&'/,<>@".indexOf(e.character) >= 0) { - e.doit = false; - // Toolkit.getDefaultToolkit().beep(); - } - } - }); GridData gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL); gd.horizontalSpan = 2; @@ -264,8 +256,12 @@ public class InviteDialog extends CaveSWTDialogBase { public void widgetSelected(SelectionEvent se) { CollaborationConnection connection = CollaborationConnection .getConnection(); - String handle = handleText.getText(); + String handle = handleText.getText().trim(); try { + if (handle.isEmpty()) { + throw new CollaborationException( + "Handle cannot be empty."); + } if (sharedDisplay) { session = connection.joinCollaborationVenue(event, handle); diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/prefs/CollabPrefInitializer.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/prefs/CollabPrefInitializer.java index 387f03f495..5e026f216d 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/prefs/CollabPrefInitializer.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/prefs/CollabPrefInitializer.java @@ -38,6 +38,7 @@ import com.raytheon.uf.viz.collaboration.ui.Activator; * Jan 14, 2014 2630 bclement added away on idle defaults * Jan 27, 2014 2700 bclement added auto accept subscribe * Feb 3, 2014 2699 bclement added handle preferences + * Feb 11, 2014 2699 bclement handle defaults to userid * * * @@ -71,7 +72,7 @@ public class CollabPrefInitializer extends AbstractPreferenceInitializer { CollabPrefConstants.AWAY_TIMEOUT_DEFAULT); store.setDefault(CollabPrefConstants.AUTO_ACCEPT_SUBSCRIBE, false); store.setDefault(CollabPrefConstants.DEFAULT_HANDLE, - CollabPrefConstants.HandleOption.BLANK.name()); + CollabPrefConstants.HandleOption.USERNAME.name()); store.setDefault(CollabPrefConstants.CUSTOM_HANDLE, ""); }