setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
	public FtpBrowser(View view, Buffer buffer, int type)	{		super(view,jEdit.getProperty("vfs.ftp.browser."			+ (type == OPEN ? "open" : "save") + "-title"),true);		JPanel content = new JPanel(new BorderLayout());		content.setBorder(new EmptyBorder(12,12,12,0));		setContentPane(content);		this.view = view;		this.type = type;		// Get default values for fields from buffer's current		// settings		String host, user, password, path = null;		if(buffer.getVFS() instanceof FtpVFS)		{			FtpAddress address = new FtpAddress(buffer.getPath());			host = address.host + ":" + address.port;			user = address.user;			if(user == null)				user = (String)buffer.getProperty(FtpVFS.USERNAME_PROPERTY);			password = address.password;			if(password == null)				password = (String)buffer.getProperty(FtpVFS.PASSWORD_PROPERTY);			path = address.path;			if(type == OPEN)				path = MiscUtilities.getFileParent(path);		}		else		{			host = jEdit.getProperty("vfs.ftp.browser.host.value");			user = jEdit.getProperty("vfs.ftp.browser.user.value");			password = null;			path = null;		}		GridBagLayout layout = new GridBagLayout();		GridBagConstraints cons = new GridBagConstraints();		cons.gridwidth = cons.gridheight = 1;		cons.gridx = cons.gridy = 0;		cons.fill = GridBagConstraints.BOTH;		cons.insets = new Insets(0,0,6,12);		JPanel centerPanel = new JPanel(layout);		JLabel label = new JLabel(jEdit.getProperty("vfs.ftp.browser.host"),			SwingConstants.RIGHT);		layout.setConstraints(label,cons);		centerPanel.add(label);		cons.gridy++;		label = new JLabel(jEdit.getProperty("vfs.ftp.browser.username"),			SwingConstants.RIGHT);		layout.setConstraints(label,cons);		centerPanel.add(label);		cons.gridy++;		label = new JLabel(jEdit.getProperty("vfs.ftp.browser.password"),			SwingConstants.RIGHT);		layout.setConstraints(label,cons);		centerPanel.add(label);		cons.gridy = 0;		cons.gridx = 1;		cons.weightx = 1.0f;		hostField = new JTextField(host);		layout.setConstraints(hostField,cons);		centerPanel.add(hostField);		cons.gridy++;		userField = new JTextField(user);		layout.setConstraints(userField,cons);		centerPanel.add(userField);		cons.gridy++;		passwordField = new JPasswordField(password);		layout.setConstraints(passwordField,cons);		centerPanel.add(passwordField);		cons.gridy++;		cons.gridx = 0;		cons.gridwidth = 2;		cons.weighty = 1.0f;		list = new JList();		list.setVisibleRowCount(10);		list.addListSelectionListener(new ListHandler());		list.addMouseListener(new MouseHandler());		list.setCellRenderer(new FileCellRenderer());		JScrollPane listScroller = new JScrollPane(list);		layout.setConstraints(listScroller,cons);		centerPanel.add(listScroller);		cons.gridy++;		cons.gridwidth = 1;		cons.weightx = cons.weighty = 0.0f;		label = new JLabel(jEdit.getProperty("vfs.ftp.browser.path"),			SwingConstants.RIGHT);		layout.setConstraints(label,cons);		centerPanel.add(label);		cons.gridx = 1;		cons.weightx = 1.0f;		pathField = new JTextField(path);		layout.setConstraints(pathField,cons);		centerPanel.add(pathField);		content.add(BorderLayout.CENTER,centerPanel);		JPanel buttons = new JPanel();		buttons.setLayout(new BoxLayout(buttons,BoxLayout.X_AXIS));		buttons.setBorder(new EmptyBorder(6,0,0,12));		buttons.add(Box.createGlue());		ActionHandler actionHandler = new ActionHandler();		// the below locks the preferred size so that the buttons		// don't jump around		select = new JButton(jEdit.getProperty("vfs.ftp.browser.connect"));		select.setPreferredSize(select.getPreferredSize());		select.addActionListener(actionHandler);		buttons.add(select);		buttons.add(Box.createHorizontalStrut(6));		up = new JButton(jEdit.getProperty("vfs.ftp.browser.up"));		up.addActionListener(actionHandler);		buttons.add(up);		buttons.add(Box.createHorizontalStrut(6));		refresh = new JButton(jEdit.getProperty("vfs.ftp.browser.refresh"));		refresh.addActionListener(actionHandler);		buttons.add(refresh);		buttons.add(Box.createHorizontalStrut(6));		cancel = new JButton(jEdit.getProperty("common.cancel"));		cancel.addActionListener(actionHandler);		buttons.add(cancel);		buttons.add(Box.createGlue());		content.add(BorderLayout.SOUTH,buttons);		addWindowListener(new WindowHandler());		setDefaultCloseOperation(DISPOSE_ON_CLOSE);		update();		pack();		setLocationRelativeTo(view);		show();	}