|
From: Matthias K <mat...@us...> - 2006-04-20 17:05:41
|
Update of /cvsroot/jcommander/plugins/org.jcommander.ui.filepanel/src/org/jcommander/ui/filepanel/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20396/src/org/jcommander/ui/filepanel/actions Modified Files: SimpleOpenURLAction.java Log Message: - changed title - combo for Protokoll - combo with history for host and directory Index: SimpleOpenURLAction.java =================================================================== RCS file: /cvsroot/jcommander/plugins/org.jcommander.ui.filepanel/src/org/jcommander/ui/filepanel/actions/SimpleOpenURLAction.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SimpleOpenURLAction.java 20 Apr 2006 08:48:22 -0000 1.2 --- SimpleOpenURLAction.java 20 Apr 2006 17:05:30 -0000 1.3 *************** *** 14,17 **** --- 14,18 ---- import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; + import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; *************** *** 24,27 **** --- 25,29 ---- import org.jcommander.ui.filepanel.FilePanelManagerProvider; import org.jcommander.ui.logger.LoggerPlugin; + import org.jcommander.ui.utils.FixedSizeQueue; import org.jcommander.vfsextensions.VfsManagerExtension; *************** *** 34,42 **** private IWorkbenchWindow window; ! private Text protokollText; ! private Text hostText; private Text userNameText; private Text userPasswordText; ! private Text dirText; private String protokoll; --- 36,44 ---- private IWorkbenchWindow window; ! private Combo protokollCombo; ! private Combo hostCombo; private Text userNameText; private Text userPasswordText; ! private Combo dirCombo; private String protokoll; *************** *** 52,55 **** --- 54,63 ---- private int messageHeight = 60; + protected static final int MAX_URL_HISTORY_SIZE = 20; + + protected static FixedSizeQueue hostHistory = new FixedSizeQueue(MAX_URL_HISTORY_SIZE); + protected static FixedSizeQueue dirHistory = new FixedSizeQueue(MAX_URL_HISTORY_SIZE); + + private class EnterTargetDialog extends TitleAreaDialog { *************** *** 77,99 **** } - // @Override protected Control createDialogArea(Composite parent) { ! setTitle("Open VFS directory"); Composite dialogAreaSub = (Composite)super.createDialogArea(parent); Composite dialogArea = new Composite(dialogAreaSub, SWT.NONE); dialogArea.setLayout(new GridLayout(2,false)); dialogArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL,true,false)); Label protokolLabel = new Label(dialogArea, SWT.NONE); protokolLabel.setText("Protokoll"); ! protokollText = new Text(dialogArea, SWT.BORDER); ! protokollText.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT,true,false)); Label hostLabel = new Label(dialogArea, SWT.NONE); hostLabel.setText("Host"); ! hostText = new Text(dialogArea, SWT.BORDER); ! hostText.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT,true,false)); Label usernameLabel = new Label(dialogArea, SWT.NONE); usernameLabel.setText("Username"); userNameText = new Text(dialogArea, SWT.BORDER); userNameText.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT,true,false)); Label userPasswordLabel = new Label(dialogArea, SWT.NONE); userPasswordLabel.setText("Password"); --- 85,120 ---- } protected Control createDialogArea(Composite parent) { ! getShell().setText("Open VFS directory"); ! setTitle("Specify a location"); Composite dialogAreaSub = (Composite)super.createDialogArea(parent); Composite dialogArea = new Composite(dialogAreaSub, SWT.NONE); dialogArea.setLayout(new GridLayout(2,false)); dialogArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL,true,false)); + Label protokolLabel = new Label(dialogArea, SWT.NONE); protokolLabel.setText("Protokoll"); ! protokollCombo = new Combo(dialogArea, SWT.BORDER);//new Text(dialogArea, SWT.BORDER); ! protokollCombo.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT,true,false)); ! protokollCombo.add("sftp"); ! protokollCombo.add("ftp"); ! protokollCombo.add("https"); ! protokollCombo.add("http"); ! protokollCombo.select(0); ! Label hostLabel = new Label(dialogArea, SWT.NONE); hostLabel.setText("Host"); ! hostCombo = new Combo(dialogArea, SWT.BORDER); ! hostCombo.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT,true,false)); ! Object[] hostHistoryItems = hostHistory.getItems(); ! for(int i=0;i<hostHistoryItems.length;i++) { ! hostCombo.add(hostHistoryItems[i].toString()); ! } ! Label usernameLabel = new Label(dialogArea, SWT.NONE); usernameLabel.setText("Username"); userNameText = new Text(dialogArea, SWT.BORDER); userNameText.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT,true,false)); + Label userPasswordLabel = new Label(dialogArea, SWT.NONE); userPasswordLabel.setText("Password"); *************** *** 101,110 **** userPasswordText.setEchoChar('*'); userPasswordText.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT,true,false)); Label dirLabel = new Label(dialogArea, SWT.NONE); dirLabel.setText("Directory"); ! dirText = new Text(dialogArea, SWT.BORDER); ! dirText.setText("/"); ! dirText.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT,true,false)); ! messageArea=new Composite(dialogArea, SWT.NONE); GridData messageData=new GridData(); --- 122,136 ---- userPasswordText.setEchoChar('*'); userPasswordText.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT,true,false)); + Label dirLabel = new Label(dialogArea, SWT.NONE); dirLabel.setText("Directory"); ! dirCombo = new Combo(dialogArea, SWT.BORDER); ! dirCombo.setText("/"); ! dirCombo.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT,true,false)); ! Object[] dirHistoryItems = dirHistory.getItems(); ! for(int i=0;i<dirHistoryItems.length;i++) { ! dirCombo.add(dirHistoryItems[i].toString()); ! } ! messageArea=new Composite(dialogArea, SWT.NONE); GridData messageData=new GridData(); *************** *** 133,146 **** // } ! protokoll=protokollText.getText(); userName=userNameText.getText(); userPassword=userPasswordText.getText(); ! host=hostText.getText(); ! dir=dirText.getText(); String userData=""; if (userName!="") userData=userName; if (userPassword!="") userData=userData+":"+userPassword; if (userData!="") userData=userData+"@"; ! String url=protokoll+"://"+userData+host+"/"+dir; if (performOk(url)) { super.okPressed(); --- 159,172 ---- // } ! protokoll=protokollCombo.getText(); userName=userNameText.getText(); userPassword=userPasswordText.getText(); ! host=hostCombo.getText(); ! dir=dirCombo.getText(); String userData=""; if (userName!="") userData=userName; if (userPassword!="") userData=userData+":"+userPassword; if (userData!="") userData=userData+"@"; ! String url=protokoll+"://"+userData+host+dir; if (performOk(url)) { super.okPressed(); *************** *** 170,174 **** .refresh(); ! //urlHistory.add(selectedDirectory); return true; } else { --- 196,201 ---- .refresh(); ! hostHistory.add(host); ! dirHistory.add(dir); return true; } else { *************** *** 187,190 **** --- 214,220 ---- cause=cause.getCause(); } + if (userPassword!="") { + message = message.replaceAll(":([^@:]*)@", "@"); + } setMessage("The directory could not be opened.", IMessageProvider.ERROR); setError(message); |