Mode mode = modes[i]; String clazz = mode.getClass().getName(); modeNames[i + 1] = jEdit.getModeName(mode) + " (" + clazz.substring(clazz.lastIndexOf('.') + 1) + ")";
modeNames[i + 1] = jEdit.getModeName(modes[i]);
	public BufferOptions(View view)	{		super(view,jEdit.getProperty("buffer_options.title"),true);		this.view = view;		this.buffer = view.getBuffer();		JPanel panel = new JPanel();		GridBagLayout layout = new GridBagLayout();		panel.setLayout(layout);		GridBagConstraints cons = new GridBagConstraints();		cons.gridx = cons.gridy = 0;		cons.gridwidth = 3;		cons.gridheight = 1;		cons.fill = GridBagConstraints.BOTH;		cons.weightx = 1.0f;		// Tab size		JLabel label = new JLabel(jEdit.getProperty(			"buffer_options.tabSize"),SwingConstants.RIGHT);		layout.setConstraints(label,cons);		panel.add(label);		cons.gridx = 3;		cons.gridwidth = 1;		String[] tabSizes = { "8", "4" };		tabSize = new JComboBox(tabSizes);		tabSize.setEditable(true);		tabSize.setSelectedItem(buffer.getProperty("tabSize"));		layout.setConstraints(tabSize,cons);		panel.add(tabSize);		// Edit mode		cons.gridx = 0;		cons.gridy = 1;		cons.gridwidth = 3;		label = new JLabel(jEdit.getProperty(			"buffer_options.mode"),SwingConstants.RIGHT);		layout.setConstraints(label,cons);		panel.add(label);		cons.gridx = 3;		cons.gridwidth = 1;		modes = jEdit.getModes();		String[] modeNames = new String[modes.length + 1];		modeNames[0] = jEdit.getModeName(null) + " (none)";		for(int i = 0; i < modes.length; i++)		{			Mode mode = modes[i];			String clazz = mode.getClass().getName();			modeNames[i + 1] = jEdit.getModeName(mode)				+ " (" + clazz.substring(clazz.lastIndexOf('.') + 1)				+ ")";		}		mode = new JComboBox(modeNames);		mode.setSelectedItem(buffer.getModeName());		layout.setConstraints(mode,cons);		panel.add(mode);		// Line separator		cons.gridx = 0;		cons.gridy = 2;		cons.gridwidth = 3;		label = new JLabel(jEdit.getProperty("buffer_options.lineSeparator"),			SwingConstants.RIGHT);		layout.setConstraints(label,cons);		panel.add(label);		cons.gridx = 3;		cons.gridwidth = 1;		String[] lineSeps = { jEdit.getProperty("lineSep.unix"),			jEdit.getProperty("lineSep.windows"),			jEdit.getProperty("lineSep.mac") };		lineSeparator = new JComboBox(lineSeps);		String lineSep = (String)buffer.getProperty(Buffer.LINESEP);		if(lineSep == null)			lineSep = System.getProperty("line.separator");		if("\n".equals(lineSep))			lineSeparator.setSelectedIndex(0);		else if("\r\n".equals(lineSep))			lineSeparator.setSelectedIndex(1);		else if("\r".equals(lineSep))			lineSeparator.setSelectedIndex(2);		layout.setConstraints(lineSeparator,cons);		panel.add(lineSeparator);		// Soft tabs		cons.gridx = 0;		cons.gridy = 3;		cons.gridwidth = cons.REMAINDER;		cons.fill = GridBagConstraints.NONE;		cons.anchor = GridBagConstraints.WEST;		noTabs = new JCheckBox(jEdit.getProperty(			"buffer_options.noTabs"));		noTabs.getModel().setSelected("yes".equals(			buffer.getProperty("noTabs")));		layout.setConstraints(noTabs,cons);		panel.add(noTabs);		getContentPane().setLayout(new BorderLayout());		getContentPane().add(BorderLayout.CENTER,panel);		BufferOptionsActionListener actionListener =			new BufferOptionsActionListener();		panel = new JPanel();		ok = new JButton(jEdit.getProperty("common.ok"));		ok.addActionListener(actionListener);		getRootPane().setDefaultButton(ok);		panel.add(ok);		cancel = new JButton(jEdit.getProperty("common.cancel"));		cancel.addActionListener(actionListener);		panel.add(cancel);		getContentPane().add(BorderLayout.SOUTH,panel);		addKeyListener(new BufferOptionsKeyListener());		setDefaultCloseOperation(DISPOSE_ON_CLOSE);		Dimension screen = getToolkit().getScreenSize();		pack();		setLocation((screen.width - getSize().width) / 2,			(screen.height - getSize().height) / 2);		show();	}