super(new BorderLayout());  listenerList = new EventListenerList();  this.mode = mode; this.multipleSelection = multipleSelection; this.floating = floating; this.view = view;  ActionHandler actionHandler = new ActionHandler();  Box topBox = new Box(BoxLayout.Y_AXIS);       toolbarBox = new Box(mode == BROWSER ? BoxLayout.Y_AXIS : BoxLayout.X_AXIS); JPanel menuBar = createMenuBar(); if(mode == BROWSER) menuBar.add(Box.createGlue()); toolbarBox.add(menuBar); if(mode != BROWSER) { toolbarBox.add(Box.createHorizontalStrut(6)); toolbarBox.add(createToolBar()); toolbarBox.add(Box.createGlue()); }  topBox.add(toolbarBox);  GridBagLayout layout = new GridBagLayout(); JPanel pathAndFilterPanel = new JPanel(layout);  GridBagConstraints cons = new GridBagConstraints(); cons.gridwidth = cons.gridheight = 1; cons.gridx = cons.gridy = 0; cons.fill = GridBagConstraints.BOTH; cons.anchor = GridBagConstraints.EAST; JLabel label = new JLabel(jEdit.getProperty("vfs.browser.path"), SwingConstants.RIGHT); label.setBorder(new EmptyBorder(0,0,0,12)); layout.setConstraints(label,cons); pathAndFilterPanel.add(label);  pathField = new HistoryTextField("vfs.browser.path"); pathField.setInstantPopups(true); pathField.setEnterAddsToHistory(false); pathField.setSelectAllOnFocus(true);  if(floating) { label.setDisplayedMnemonic(jEdit.getProperty( "vfs.browser.path.mnemonic").charAt(0)); label.setLabelFor(pathField); }     Dimension prefSize = pathField.getPreferredSize(); prefSize.width = 0; pathField.setPreferredSize(prefSize); pathField.addActionListener(actionHandler); cons.gridx = 1; cons.weightx = 1.0f;  layout.setConstraints(pathField,cons); pathAndFilterPanel.add(pathField);  filterCheckbox = new JCheckBox(jEdit.getProperty("vfs.browser.filter")); filterCheckbox.setMargin(new Insets(0,0,0,0)); filterCheckbox.setRequestFocusEnabled(false); filterCheckbox.setBorder(new EmptyBorder(0,0,0,12)); filterCheckbox.setSelected(mode != BROWSER || jEdit.getBooleanProperty("vfs.browser.filter-enabled"));  filterCheckbox.addActionListener(actionHandler);  if(mode != CHOOSE_DIRECTORY_DIALOG) { cons.gridx = 0; cons.weightx = 0.0f; cons.gridy = 1; layout.setConstraints(filterCheckbox,cons); pathAndFilterPanel.add(filterCheckbox); }  filterField = new HistoryTextField("vfs.browser.filter"); filterField.setInstantPopups(true); filterField.setSelectAllOnFocus(true); filterField.addActionListener(actionHandler);  if(mode != CHOOSE_DIRECTORY_DIALOG) { cons.gridx = 1; cons.weightx = 1.0f; layout.setConstraints(filterField,cons); pathAndFilterPanel.add(filterField); }  topBox.add(pathAndFilterPanel); add(BorderLayout.NORTH,topBox);  boolean splitHorizontally = false; if(jEdit.getBooleanProperty("vfs.browser.splitHorizontally") && mode != BROWSER) splitHorizontally = true; add(BorderLayout.CENTER,browserView = new BrowserView(this,splitHorizontally));  propertiesChanged();  HistoryModel filterModel = HistoryModel.getModel("vfs.browser.filter"); String filter = jEdit.getProperty("vfs.browser.last-filter"); if(filter == null) filter = jEdit.getProperty("vfs.browser.default-filter");  filterField.setText(filter); filterField.addCurrentToHistory();  updateFilterEnabled();   if(path == null) path = jEdit.getProperty("vfs.browser.path.tmp");  if(path == null || path.length() == 0) { String userHome = System.getProperty("user.home"); String defaultPath = jEdit.getProperty("vfs.browser.defaultPath"); if(defaultPath.equals("home")) path = userHome; else if(defaultPath.equals("buffer")) { if(view != null) { Buffer buffer = view.getBuffer(); path = buffer.getVFS().getParentOfPath( buffer.getPath()); } else path = userHome; } else if(defaultPath.equals("last")) { HistoryModel pathModel = HistoryModel.getModel("vfs.browser.path"); if(pathModel.getSize() == 0) path = "~"; else path = pathModel.getItem(0); } else if(defaultPath.equals("favorites")) path = "favorites:"; else {  path = userHome; } }  currentEncoding = jEdit.getProperty("buffer.encoding", System.getProperty("file.encoding"));  final String _path = path;  SwingUtilities.invokeLater(new Runnable() { public void run() { setDirectory(_path); } });
this(view,null,BROWSER,true,false);
	public VFSBrowser(View view, String path, int mode, boolean multipleSelection,		boolean floating)	{		super(new BorderLayout());		listenerList = new EventListenerList();		this.mode = mode;		this.multipleSelection = multipleSelection;		this.floating = floating;		this.view = view;		ActionHandler actionHandler = new ActionHandler();		Box topBox = new Box(BoxLayout.Y_AXIS);		// this is tricky, because in BROWSER mode, the menu bar		// and tool bar are stacked on top of each other, and		// the user can toggle the tool bar. In dialog modes,		// the two are side by side and the tool bar is always		// visible.		toolbarBox = new Box(mode == BROWSER			? BoxLayout.Y_AXIS			: BoxLayout.X_AXIS);		JPanel menuBar = createMenuBar();		if(mode == BROWSER)			menuBar.add(Box.createGlue());		toolbarBox.add(menuBar);		if(mode != BROWSER)		{			toolbarBox.add(Box.createHorizontalStrut(6));			toolbarBox.add(createToolBar());			toolbarBox.add(Box.createGlue());		}		topBox.add(toolbarBox);		GridBagLayout layout = new GridBagLayout();		JPanel pathAndFilterPanel = new JPanel(layout);		GridBagConstraints cons = new GridBagConstraints();		cons.gridwidth = cons.gridheight = 1;		cons.gridx = cons.gridy = 0;		cons.fill = GridBagConstraints.BOTH;		cons.anchor = GridBagConstraints.EAST;		JLabel label = new JLabel(jEdit.getProperty("vfs.browser.path"),			SwingConstants.RIGHT);		label.setBorder(new EmptyBorder(0,0,0,12));		layout.setConstraints(label,cons);		pathAndFilterPanel.add(label);		pathField = new HistoryTextField("vfs.browser.path");		pathField.setInstantPopups(true);		pathField.setEnterAddsToHistory(false);		pathField.setSelectAllOnFocus(true);		if(floating)		{			label.setDisplayedMnemonic(jEdit.getProperty(				"vfs.browser.path.mnemonic").charAt(0));			label.setLabelFor(pathField);		}		// because its preferred size can be quite wide, we		// don't want it to make the browser way too big,		// so set the preferred width to 0.		Dimension prefSize = pathField.getPreferredSize();		prefSize.width = 0;		pathField.setPreferredSize(prefSize);		pathField.addActionListener(actionHandler);		cons.gridx = 1;		cons.weightx = 1.0f;		layout.setConstraints(pathField,cons);		pathAndFilterPanel.add(pathField);		filterCheckbox = new JCheckBox(jEdit.getProperty("vfs.browser.filter"));		filterCheckbox.setMargin(new Insets(0,0,0,0));		filterCheckbox.setRequestFocusEnabled(false);		filterCheckbox.setBorder(new EmptyBorder(0,0,0,12));		filterCheckbox.setSelected(mode != BROWSER ||			jEdit.getBooleanProperty("vfs.browser.filter-enabled"));		filterCheckbox.addActionListener(actionHandler);		if(mode != CHOOSE_DIRECTORY_DIALOG)		{			cons.gridx = 0;			cons.weightx = 0.0f;			cons.gridy = 1;			layout.setConstraints(filterCheckbox,cons);			pathAndFilterPanel.add(filterCheckbox);		}		filterField = new HistoryTextField("vfs.browser.filter");		filterField.setInstantPopups(true);		filterField.setSelectAllOnFocus(true);		filterField.addActionListener(actionHandler);		if(mode != CHOOSE_DIRECTORY_DIALOG)		{			cons.gridx = 1;			cons.weightx = 1.0f;			layout.setConstraints(filterField,cons);			pathAndFilterPanel.add(filterField);		}		topBox.add(pathAndFilterPanel);		add(BorderLayout.NORTH,topBox);		boolean splitHorizontally = false;		if(jEdit.getBooleanProperty("vfs.browser.splitHorizontally") && mode != BROWSER)			splitHorizontally = true;		add(BorderLayout.CENTER,browserView = new BrowserView(this,splitHorizontally));		propertiesChanged();		HistoryModel filterModel = HistoryModel.getModel("vfs.browser.filter");		String filter = jEdit.getProperty("vfs.browser.last-filter");		if(filter == null)			filter = jEdit.getProperty("vfs.browser.default-filter");		filterField.setText(filter);		filterField.addCurrentToHistory();		updateFilterEnabled();		// see VFSBrowser.browseDirectory()		if(path == null)			path = jEdit.getProperty("vfs.browser.path.tmp");		if(path == null || path.length() == 0)		{			String userHome = System.getProperty("user.home");			String defaultPath = jEdit.getProperty("vfs.browser.defaultPath");			if(defaultPath.equals("home"))				path = userHome;			else if(defaultPath.equals("buffer"))			{				if(view != null)				{					Buffer buffer = view.getBuffer();					path = buffer.getVFS().getParentOfPath(						buffer.getPath());				}				else					path = userHome;			}			else if(defaultPath.equals("last"))			{				HistoryModel pathModel = HistoryModel.getModel("vfs.browser.path");				if(pathModel.getSize() == 0)					path = "~";				else					path = pathModel.getItem(0);			}			else if(defaultPath.equals("favorites"))				path = "favorites:";			else			{				// unknown value??!!!				path = userHome;			}		}		currentEncoding = jEdit.getProperty("buffer.encoding",			System.getProperty("file.encoding"));		final String _path = path;		SwingUtilities.invokeLater(new Runnable()		{			public void run()			{				setDirectory(_path);			}		});	} //}}}