FileDocCategorySizeDatePackage
DirectoryParameter.javaAPI DocAzureus 3.0.3.43259Mon Jan 15 22:37:24 GMT 2007org.gudy.azureus2.ui.swt.config

DirectoryParameter

public class DirectoryParameter extends Parameter
author
parg

Fields Summary
org.eclipse.swt.widgets.Control[]
controls
StringParameter
sp
Constructors Summary
public DirectoryParameter(org.eclipse.swt.widgets.Composite pluginGroup, String name, String defaultValue)

  
  	super(name);
	  	controls = new Control[2];
	           	    
	    sp = new StringParameter(pluginGroup, name, defaultValue);
	    
	    controls[0] = sp.getControl();
	    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
	    controls[0].setLayoutData(gridData);
	    
	    Button browse = new Button(pluginGroup, SWT.PUSH);
	    Image imgOpenFolder = ImageRepository.getImage(getBrowseImageResource());
	    browse.setImage(imgOpenFolder);
	    imgOpenFolder.setBackground(browse.getBackground());
	    browse.setToolTipText(MessageText.getString("ConfigView.button.browse"));

	    browse.addListener(SWT.Selection, new Listener() {
	      public void handleEvent(Event event) {
	    	  String path = DirectoryParameter.this.openDialog(pluginGroup.getShell(), sp.getValue());
	    	  if (path != null) {
	    		  sp.setValue(path);
	    	  }
	      }
	    });
	    controls[1] = browse;
	  
Methods Summary
protected java.lang.StringgetBrowseImageResource()

		return "openFolderButton";
	
public org.eclipse.swt.widgets.ControlgetControl()

		return( controls[0]);
	
public org.eclipse.swt.widgets.Control[]getControls()

	    return controls;
	
protected java.lang.StringopenDialog(org.eclipse.swt.widgets.Shell shell, java.lang.String old_value)

        DirectoryDialog dialog = new DirectoryDialog(shell, SWT.APPLICATION_MODAL);
        dialog.setFilterPath(old_value);        
        return dialog.open();
	
public voidsetLayoutData(java.lang.Object layoutData)

	
public voidsetValue(java.lang.Object value)

  	if (value instanceof String) {
  		sp.setValue((String)value);
  	}