Community
Participate
Working Groups
Creating a new Text field with style SWT.PASSWORD does not keep the user from doing a normal copy/paste of the password value to another text field to reveal the true password. Is there any plan in the future to not let a user copy the value in a SWT.PASSWORD styled text field? Or is it up to implementers to override the behavior? If so what is the recommended way of doing this? Obviously can't just listen for cmd+c or cmd+x as copy/paste commands could change.
It looks like this is only in Carbon, correct? I can't reproduce it with 3.7 HEAD of Cocoa. I consider this a serious bug, and not something a developer should have to worry about.
I am running 10.6.6. I haven't tried 3.7 HEAD. If I have time I will try to give it a shot. Jar in question: org.eclipse.swt.cocoa.macosx.x86_64_3.6.1.v3655c.jar code snippet: This is a sample createSection method from extending org.eclipse.wst.server.ui.editor.ServerEditorSection public void createSection(Composite parent) { super.createSection(parent); FormToolkit toolkit = getFormToolkit(parent.getDisplay()); Section section = toolkit.createSection(parent, Section.TWISTIE | Section.EXPANDED); section.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); Composite comp = toolkit.createComposite(section); toolkit.createText(comp, "", SWT.PASSWORD | SWT.SINGLE | SWT.BORDER); }
Actually, this snippet will reproduce it in 3.6.1 and 3.7: /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.swt.snippets; /* * Button example snippet: set the default button * * For a list of all SWT example snippets see * http://www.eclipse.org/swt/snippets/ */ import org.eclipse.swt.*; import org.eclipse.swt.widgets.*; import org.eclipse.swt.events.*; import org.eclipse.swt.layout.*; public class PasswordCopyTest { public static void main (String [] args) { Display display = new Display (); Shell shell = new Shell (display); Label label = new Label (shell, SWT.NONE); label.setText ("Enter your password:"); final Text text = new Text (shell, SWT.BORDER | SWT.SINGLE | SWT.PASSWORD); text.setLayoutData (new RowData (100, SWT.DEFAULT)); Button copy = new Button (shell, SWT.PUSH); copy.setText ("Copy"); copy.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { text.selectAll(); text.copy(); } }); Button cut = new Button (shell, SWT.PUSH); cut.setText ("Cut"); cut.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { text.selectAll(); text.cut(); } }); shell.setDefaultButton (cut); shell.setLayout (new RowLayout ()); shell.pack (); shell.open (); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); } }
Created attachment 187888 [details] Fix for HEAD Fix based on HEAD from 1/28/11. This should go into the 3.6 stream, too.
Created attachment 187892 [details] Fix for 3.6.2 Essentially the same patch for 3.6 branch.
Created attachment 187893 [details] Carbon fix Carbon has the same bug for cut(). copy() was taken care of in bug 243012.
Created attachment 187894 [details] Carbon fix for 3.6.2 Same patch as Carbon HEAD.
Scott, if you could get this out today that would be great. I'd like to do a 3.6.2 build submission tonight. Thanks!
Thanks, guys! Fixed in Carbon and Cocoa for R_3_6_maintenance and HEAD > 20110131.