@Override
	public void itemStateChanged(ItemEvent e) {
		if (textEntryField == null) {
			// We we're unable to find a JTextField component that was a decendant of this
			// JFileChooser so we need to abort.
			return;
		}
		
		String filename = textEntryField.getText();
		
		if (filename == null || filename.equals("")) {
			return;
		}
		
		// Get the file format
		FileFormat format;
		if (e.getSource() == saveFormatComboBox) {
			format = Outliner.fileFormatManager.getSaveFormat(getSaveFileFormat());
		} else if (e.getSource() == exportFormatComboBox) {
			format = Outliner.fileFormatManager.getExportFormat(getExportFileFormat());
		} else {
			// Unknown source;
			System.out.println("Unknown source for itemStateChanged in OutlinerFileChooser.");
			return;
		}
		
		if (format == null) {
			System.out.println("Format is null for itemStateChanged in OutlinerFileChooser.");
			return;
		}
		
		// Get extension
		String extension = format.getDefaultExtension();
		
		// Abort if we don't have an extension.
		if (extension == null || extension.equals("")) {
			return;
		}

		// trim any extension off the file name
		String newFileName = StringTools.trimExtension(filename, Preferences.EXTENSION_SEPARATOR);
		
		// Set the filename in the Chooser
		textEntryField.setText(new StringBuffer().append(newFileName).append(Preferences.EXTENSION_SEPARATOR).append(extension).toString());
	}