//# 0 errors, 389 messages
//#
/*
    //#KFileChooser.java:1:1: class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#KFileChooser.java:1:1: method: com.dmdirc.addons.dcc.kde.KFileChooser.com.dmdirc.addons.dcc.kde.KFileChooser__static_init
 * Copyright (c) 2006-2009 Chris Smith, Shane Mc Cormack, Gregory Holmes
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package com.dmdirc.addons.dcc.kde;

import com.dmdirc.addons.dcc.DCCPlugin;

import com.dmdirc.config.IdentityManager;

import java.awt.Component;
import java.awt.HeadlessException;
import java.io.File;
import java.util.ArrayList;
import java.util.List;

import javax.swing.JFileChooser;
import javax.swing.filechooser.FileSystemView;

/**
 * JFileChooser that uses KDialog to show the actual chooser.
 * This is quite hacky, and not guarenteed to behave identically to JFileChooser,
 * altho it tries to be as close as possible.
 * Almost a drop in replacement for JFileChooser, replace:
 *    new JFileChooser();
 * with:
 *    KFileChooser.getFileChooser();
 *
 * There are obviously some differences:
 * - File filters must be set using setKDEFileFilter() not using FileFilter objects.
 * - FileSystemView's are ignored
 * - showOpenDialog and showSaveDialog shell kdialog, so only options available
 *   in kdialog work.
 * - getFileChooser() will return a JFileChooser object unless the DCC plugin's
 *   config option "general.useKFileChooser" is set to "true" (defaults to false)
 *   and kdialog is in either /usr/bin or /bin
 * - Selection mode FILES_AND_DIRECTORIES can not be used
 */
public class KFileChooser extends JFileChooser {
	/**
	 * A version number for this class.
	 * It should be changed whenever the class structure is changed (or anything
	 * else that would prevent serialized objects being unserialized with the new 
	 * class).
	 */
	private static final long serialVersionUID = 200806141;
	
	/** File Filter */
	private String fileFilter = null;

    /** The plugin that this file chooser is for. */
    private final DCCPlugin plugin;
	
	/**
	 * Should a KFileChooser be used rather than a JFileChooser?
	 *
     * @param plugin The DCC Plugin that is requesting a chooser
	 * @return return true if getFileChooser() will return a KFileChooser not a
	 *         JFileChooser
	 */
	public static boolean useKFileChooser(final DCCPlugin plugin) {
		return KDialogProcess.hasKDialog() && IdentityManager.getGlobalConfig().getOptionBool(plugin.getDomain(), "general.useKFileChooser");
    //#KFileChooser.java:80: method: bool com.dmdirc.addons.dcc.kde.KFileChooser.useKFileChooser(DCCPlugin)
    //#KFileChooser.java:80: Warning: method not available - call not analyzed
    //#    call on ConfigManager com.dmdirc.config.IdentityManager:getGlobalConfig()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#    method: bool useKFileChooser(DCCPlugin)
    //#    unanalyzed callee: ConfigManager com.dmdirc.config.IdentityManager:getGlobalConfig()
    //#KFileChooser.java:80: Warning: method not available - call not analyzed
    //#    call on String com.dmdirc.addons.dcc.DCCPlugin:getDomain()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#    method: bool useKFileChooser(DCCPlugin)
    //#    unanalyzed callee: String com.dmdirc.addons.dcc.DCCPlugin:getDomain()
    //#KFileChooser.java:80: Warning: method not available - call not analyzed
    //#    call on bool com.dmdirc.config.ConfigManager:getOptionBool(String, String)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#    method: bool useKFileChooser(DCCPlugin)
    //#    unanalyzed callee: bool com.dmdirc.config.ConfigManager:getOptionBool(String, String)
    //#input(bool useKFileChooser(DCCPlugin)): com/dmdirc/addons/dcc/kde/KDialogProcess.hasKDialog
    //#input(bool useKFileChooser(DCCPlugin)): plugin
    //#output(bool useKFileChooser(DCCPlugin)): return_value
    //#pre[1] (bool useKFileChooser(DCCPlugin)): (soft) plugin != null
    //#presumption(bool useKFileChooser(DCCPlugin)): com.dmdirc.config.IdentityManager:getGlobalConfig(...)@80 != null
    //#post(bool useKFileChooser(DCCPlugin)): init'ed(return_value)
    //#KFileChooser.java:80: end of method: bool com.dmdirc.addons.dcc.kde.KFileChooser.useKFileChooser(DCCPlugin)
	}
	
	/**
	 * Constructs a FileChooser pointing to the user's default directory.
     *
     * @param plugin The DCC Plugin that is requesting a chooser
     * @return The relevant FileChooser
	 */
	public static JFileChooser getFileChooser(final DCCPlugin plugin) {
		return useKFileChooser(plugin) ? new KFileChooser(plugin) : new JFileChooser();
    //#KFileChooser.java:90: method: JFileChooser com.dmdirc.addons.dcc.kde.KFileChooser.getFileChooser(DCCPlugin)
    //#input(JFileChooser getFileChooser(DCCPlugin)): com/dmdirc/addons/dcc/kde/KDialogProcess.hasKDialog
    //#input(JFileChooser getFileChooser(DCCPlugin)): plugin
    //#output(JFileChooser getFileChooser(DCCPlugin)): new JFileChooser(getFileChooser#2) num objects
    //#output(JFileChooser getFileChooser(DCCPlugin)): new KFileChooser(getFileChooser#1) num objects
    //#output(JFileChooser getFileChooser(DCCPlugin)): new KFileChooser(getFileChooser#1).__Tag
    //#output(JFileChooser getFileChooser(DCCPlugin)): new KFileChooser(getFileChooser#1).fileFilter
    //#output(JFileChooser getFileChooser(DCCPlugin)): new KFileChooser(getFileChooser#1).plugin
    //#output(JFileChooser getFileChooser(DCCPlugin)): return_value
    //#new obj(JFileChooser getFileChooser(DCCPlugin)): new JFileChooser(getFileChooser#2)
    //#new obj(JFileChooser getFileChooser(DCCPlugin)): new KFileChooser(getFileChooser#1)
    //#pre[1] (JFileChooser getFileChooser(DCCPlugin)): (soft) plugin != null
    //#post(JFileChooser getFileChooser(DCCPlugin)): return_value == One-of{&new KFileChooser(getFileChooser#1), &new JFileChooser(getFileChooser#2)}
    //#post(JFileChooser getFileChooser(DCCPlugin)): return_value in Addr_Set{&new JFileChooser(getFileChooser#2),&new KFileChooser(getFileChooser#1)}
    //#post(JFileChooser getFileChooser(DCCPlugin)): new JFileChooser(getFileChooser#2) num objects <= 1
    //#post(JFileChooser getFileChooser(DCCPlugin)): new KFileChooser(getFileChooser#1) num objects <= 1
    //#post(JFileChooser getFileChooser(DCCPlugin)): new KFileChooser(getFileChooser#1).__Tag == com/dmdirc/addons/dcc/kde/KFileChooser
    //#post(JFileChooser getFileChooser(DCCPlugin)): new KFileChooser(getFileChooser#1).fileFilter == null
    //#post(JFileChooser getFileChooser(DCCPlugin)): new KFileChooser(getFileChooser#1).plugin == plugin
    //#post(JFileChooser getFileChooser(DCCPlugin)): new KFileChooser(getFileChooser#1).plugin != null
    //#unanalyzed(JFileChooser getFileChooser(DCCPlugin)): Effects-of-calling:com.dmdirc.config.IdentityManager:getGlobalConfig
    //#unanalyzed(JFileChooser getFileChooser(DCCPlugin)): Effects-of-calling:com.dmdirc.addons.dcc.DCCPlugin:getDomain
    //#unanalyzed(JFileChooser getFileChooser(DCCPlugin)): Effects-of-calling:com.dmdirc.config.ConfigManager:getOptionBool
    //#unanalyzed(JFileChooser getFileChooser(DCCPlugin)): Effects-of-calling:javax.swing.JFileChooser
    //#KFileChooser.java:90: end of method: JFileChooser com.dmdirc.addons.dcc.kde.KFileChooser.getFileChooser(DCCPlugin)
	}
	
	/**
	 * Constructs a FileChooser using the given File as the path.
	 *
     * @param plugin The DCC Plugin that is requesting a chooser
	 * @param currentDirectory Directory to use as the base directory
     * @return The relevant FileChooser
	 */
	public static JFileChooser getFileChooser(final DCCPlugin plugin, final File currentDirectory) {
		return useKFileChooser(plugin) ? new KFileChooser(plugin, currentDirectory) : new JFileChooser(currentDirectory);
    //#KFileChooser.java:101: method: JFileChooser com.dmdirc.addons.dcc.kde.KFileChooser.getFileChooser(DCCPlugin, File)
    //#input(JFileChooser getFileChooser(DCCPlugin, File)): com/dmdirc/addons/dcc/kde/KDialogProcess.hasKDialog
    //#input(JFileChooser getFileChooser(DCCPlugin, File)): currentDirectory
    //#input(JFileChooser getFileChooser(DCCPlugin, File)): plugin
    //#output(JFileChooser getFileChooser(DCCPlugin, File)): new JFileChooser(getFileChooser#2) num objects
    //#output(JFileChooser getFileChooser(DCCPlugin, File)): new KFileChooser(getFileChooser#1) num objects
    //#output(JFileChooser getFileChooser(DCCPlugin, File)): new KFileChooser(getFileChooser#1).__Tag
    //#output(JFileChooser getFileChooser(DCCPlugin, File)): new KFileChooser(getFileChooser#1).fileFilter
    //#output(JFileChooser getFileChooser(DCCPlugin, File)): new KFileChooser(getFileChooser#1).plugin
    //#output(JFileChooser getFileChooser(DCCPlugin, File)): return_value
    //#new obj(JFileChooser getFileChooser(DCCPlugin, File)): new JFileChooser(getFileChooser#2)
    //#new obj(JFileChooser getFileChooser(DCCPlugin, File)): new KFileChooser(getFileChooser#1)
    //#pre[2] (JFileChooser getFileChooser(DCCPlugin, File)): (soft) plugin != null
    //#post(JFileChooser getFileChooser(DCCPlugin, File)): return_value == One-of{&new KFileChooser(getFileChooser#1), &new JFileChooser(getFileChooser#2)}
    //#post(JFileChooser getFileChooser(DCCPlugin, File)): return_value in Addr_Set{&new JFileChooser(getFileChooser#2),&new KFileChooser(getFileChooser#1)}
    //#post(JFileChooser getFileChooser(DCCPlugin, File)): new JFileChooser(getFileChooser#2) num objects <= 1
    //#post(JFileChooser getFileChooser(DCCPlugin, File)): new KFileChooser(getFileChooser#1) num objects <= 1
    //#post(JFileChooser getFileChooser(DCCPlugin, File)): new KFileChooser(getFileChooser#1).__Tag == com/dmdirc/addons/dcc/kde/KFileChooser
    //#post(JFileChooser getFileChooser(DCCPlugin, File)): new KFileChooser(getFileChooser#1).fileFilter == null
    //#post(JFileChooser getFileChooser(DCCPlugin, File)): new KFileChooser(getFileChooser#1).plugin == plugin
    //#post(JFileChooser getFileChooser(DCCPlugin, File)): new KFileChooser(getFileChooser#1).plugin != null
    //#unanalyzed(JFileChooser getFileChooser(DCCPlugin, File)): Effects-of-calling:com.dmdirc.config.IdentityManager:getGlobalConfig
    //#unanalyzed(JFileChooser getFileChooser(DCCPlugin, File)): Effects-of-calling:com.dmdirc.addons.dcc.DCCPlugin:getDomain
    //#unanalyzed(JFileChooser getFileChooser(DCCPlugin, File)): Effects-of-calling:com.dmdirc.config.ConfigManager:getOptionBool
    //#unanalyzed(JFileChooser getFileChooser(DCCPlugin, File)): Effects-of-calling:javax.swing.JFileChooser
    //#KFileChooser.java:101: end of method: JFileChooser com.dmdirc.addons.dcc.kde.KFileChooser.getFileChooser(DCCPlugin, File)
	}
	
	/**
	 * Constructs a FileChooser using the given current directory and FileSystemView.
	 *
     * @param plugin The DCC Plugin that is requesting a chooser
	 * @param currentDirectory Directory to use as the base directory
	 * @param fsv The FileSystemView to use
     * @return The relevant FileChooser
	 */
	public static JFileChooser getFileChooser(final DCCPlugin plugin, final File currentDirectory, final FileSystemView fsv) {
		return useKFileChooser(plugin) ? new KFileChooser(plugin, currentDirectory, fsv) : new JFileChooser(currentDirectory, fsv);
    //#KFileChooser.java:113: method: JFileChooser com.dmdirc.addons.dcc.kde.KFileChooser.getFileChooser(DCCPlugin, File, FileSystemView)
    //#input(JFileChooser getFileChooser(DCCPlugin, File, FileSystemView)): com/dmdirc/addons/dcc/kde/KDialogProcess.hasKDialog
    //#input(JFileChooser getFileChooser(DCCPlugin, File, FileSystemView)): currentDirectory
    //#input(JFileChooser getFileChooser(DCCPlugin, File, FileSystemView)): fsv
    //#input(JFileChooser getFileChooser(DCCPlugin, File, FileSystemView)): plugin
    //#output(JFileChooser getFileChooser(DCCPlugin, File, FileSystemView)): new JFileChooser(getFileChooser#2) num objects
    //#output(JFileChooser getFileChooser(DCCPlugin, File, FileSystemView)): new KFileChooser(getFileChooser#1) num objects
    //#output(JFileChooser getFileChooser(DCCPlugin, File, FileSystemView)): new KFileChooser(getFileChooser#1).__Tag
    //#output(JFileChooser getFileChooser(DCCPlugin, File, FileSystemView)): new KFileChooser(getFileChooser#1).fileFilter
    //#output(JFileChooser getFileChooser(DCCPlugin, File, FileSystemView)): new KFileChooser(getFileChooser#1).plugin
    //#output(JFileChooser getFileChooser(DCCPlugin, File, FileSystemView)): return_value
    //#new obj(JFileChooser getFileChooser(DCCPlugin, File, FileSystemView)): new JFileChooser(getFileChooser#2)
    //#new obj(JFileChooser getFileChooser(DCCPlugin, File, FileSystemView)): new KFileChooser(getFileChooser#1)
    //#pre[3] (JFileChooser getFileChooser(DCCPlugin, File, FileSystemView)): (soft) plugin != null
    //#post(JFileChooser getFileChooser(DCCPlugin, File, FileSystemView)): return_value == One-of{&new KFileChooser(getFileChooser#1), &new JFileChooser(getFileChooser#2)}
    //#post(JFileChooser getFileChooser(DCCPlugin, File, FileSystemView)): return_value in Addr_Set{&new JFileChooser(getFileChooser#2),&new KFileChooser(getFileChooser#1)}
    //#post(JFileChooser getFileChooser(DCCPlugin, File, FileSystemView)): new JFileChooser(getFileChooser#2) num objects <= 1
    //#post(JFileChooser getFileChooser(DCCPlugin, File, FileSystemView)): new KFileChooser(getFileChooser#1) num objects <= 1
    //#post(JFileChooser getFileChooser(DCCPlugin, File, FileSystemView)): new KFileChooser(getFileChooser#1).__Tag == com/dmdirc/addons/dcc/kde/KFileChooser
    //#post(JFileChooser getFileChooser(DCCPlugin, File, FileSystemView)): new KFileChooser(getFileChooser#1).fileFilter == null
    //#post(JFileChooser getFileChooser(DCCPlugin, File, FileSystemView)): new KFileChooser(getFileChooser#1).plugin == plugin
    //#post(JFileChooser getFileChooser(DCCPlugin, File, FileSystemView)): new KFileChooser(getFileChooser#1).plugin != null
    //#unanalyzed(JFileChooser getFileChooser(DCCPlugin, File, FileSystemView)): Effects-of-calling:com.dmdirc.config.IdentityManager:getGlobalConfig
    //#unanalyzed(JFileChooser getFileChooser(DCCPlugin, File, FileSystemView)): Effects-of-calling:com.dmdirc.addons.dcc.DCCPlugin:getDomain
    //#unanalyzed(JFileChooser getFileChooser(DCCPlugin, File, FileSystemView)): Effects-of-calling:com.dmdirc.config.ConfigManager:getOptionBool
    //#unanalyzed(JFileChooser getFileChooser(DCCPlugin, File, FileSystemView)): Effects-of-calling:javax.swing.JFileChooser
    //#KFileChooser.java:113: end of method: JFileChooser com.dmdirc.addons.dcc.kde.KFileChooser.getFileChooser(DCCPlugin, File, FileSystemView)
	}
	
	/**
	 * Constructs a FileChooser using the given FileSystemView.
	 *
     * @param plugin The DCC Plugin that is requesting a chooser
	 * @param fsv The FileSystemView to use
     * @return The relevant FileChooser
	 */
	public static JFileChooser getFileChooser(final DCCPlugin plugin, final FileSystemView fsv) {
		return useKFileChooser(plugin) ? new KFileChooser(plugin, fsv) : new JFileChooser(fsv);
    //#KFileChooser.java:124: method: JFileChooser com.dmdirc.addons.dcc.kde.KFileChooser.getFileChooser(DCCPlugin, FileSystemView)
    //#input(JFileChooser getFileChooser(DCCPlugin, FileSystemView)): com/dmdirc/addons/dcc/kde/KDialogProcess.hasKDialog
    //#input(JFileChooser getFileChooser(DCCPlugin, FileSystemView)): fsv
    //#input(JFileChooser getFileChooser(DCCPlugin, FileSystemView)): plugin
    //#output(JFileChooser getFileChooser(DCCPlugin, FileSystemView)): new JFileChooser(getFileChooser#2) num objects
    //#output(JFileChooser getFileChooser(DCCPlugin, FileSystemView)): new KFileChooser(getFileChooser#1) num objects
    //#output(JFileChooser getFileChooser(DCCPlugin, FileSystemView)): new KFileChooser(getFileChooser#1).__Tag
    //#output(JFileChooser getFileChooser(DCCPlugin, FileSystemView)): new KFileChooser(getFileChooser#1).fileFilter
    //#output(JFileChooser getFileChooser(DCCPlugin, FileSystemView)): new KFileChooser(getFileChooser#1).plugin
    //#output(JFileChooser getFileChooser(DCCPlugin, FileSystemView)): return_value
    //#new obj(JFileChooser getFileChooser(DCCPlugin, FileSystemView)): new JFileChooser(getFileChooser#2)
    //#new obj(JFileChooser getFileChooser(DCCPlugin, FileSystemView)): new KFileChooser(getFileChooser#1)
    //#pre[2] (JFileChooser getFileChooser(DCCPlugin, FileSystemView)): (soft) plugin != null
    //#post(JFileChooser getFileChooser(DCCPlugin, FileSystemView)): return_value == One-of{&new KFileChooser(getFileChooser#1), &new JFileChooser(getFileChooser#2)}
    //#post(JFileChooser getFileChooser(DCCPlugin, FileSystemView)): return_value in Addr_Set{&new JFileChooser(getFileChooser#2),&new KFileChooser(getFileChooser#1)}
    //#post(JFileChooser getFileChooser(DCCPlugin, FileSystemView)): new JFileChooser(getFileChooser#2) num objects <= 1
    //#post(JFileChooser getFileChooser(DCCPlugin, FileSystemView)): new KFileChooser(getFileChooser#1) num objects <= 1
    //#post(JFileChooser getFileChooser(DCCPlugin, FileSystemView)): new KFileChooser(getFileChooser#1).__Tag == com/dmdirc/addons/dcc/kde/KFileChooser
    //#post(JFileChooser getFileChooser(DCCPlugin, FileSystemView)): new KFileChooser(getFileChooser#1).fileFilter == null
    //#post(JFileChooser getFileChooser(DCCPlugin, FileSystemView)): new KFileChooser(getFileChooser#1).plugin == plugin
    //#post(JFileChooser getFileChooser(DCCPlugin, FileSystemView)): new KFileChooser(getFileChooser#1).plugin != null
    //#unanalyzed(JFileChooser getFileChooser(DCCPlugin, FileSystemView)): Effects-of-calling:com.dmdirc.config.IdentityManager:getGlobalConfig
    //#unanalyzed(JFileChooser getFileChooser(DCCPlugin, FileSystemView)): Effects-of-calling:com.dmdirc.addons.dcc.DCCPlugin:getDomain
    //#unanalyzed(JFileChooser getFileChooser(DCCPlugin, FileSystemView)): Effects-of-calling:com.dmdirc.config.ConfigManager:getOptionBool
    //#unanalyzed(JFileChooser getFileChooser(DCCPlugin, FileSystemView)): Effects-of-calling:javax.swing.JFileChooser
    //#KFileChooser.java:124: end of method: JFileChooser com.dmdirc.addons.dcc.kde.KFileChooser.getFileChooser(DCCPlugin, FileSystemView)
	}
	
	/**
	 * Constructs a FileChooser using the given path.
	 *
     * @param plugin The DCC Plugin that is requesting a chooser
	 * @param currentDirectoryPath Directory to use as the base directory
     * @return The relevant FileChooser
	 */
	public static JFileChooser getFileChooser(final DCCPlugin plugin, final String currentDirectoryPath) {
		return useKFileChooser(plugin) ? new KFileChooser(plugin, currentDirectoryPath) : new JFileChooser(currentDirectoryPath);
    //#KFileChooser.java:135: method: JFileChooser com.dmdirc.addons.dcc.kde.KFileChooser.getFileChooser(DCCPlugin, String)
    //#input(JFileChooser getFileChooser(DCCPlugin, String)): com/dmdirc/addons/dcc/kde/KDialogProcess.hasKDialog
    //#input(JFileChooser getFileChooser(DCCPlugin, String)): currentDirectoryPath
    //#input(JFileChooser getFileChooser(DCCPlugin, String)): plugin
    //#output(JFileChooser getFileChooser(DCCPlugin, String)): new JFileChooser(getFileChooser#2) num objects
    //#output(JFileChooser getFileChooser(DCCPlugin, String)): new KFileChooser(getFileChooser#1) num objects
    //#output(JFileChooser getFileChooser(DCCPlugin, String)): new KFileChooser(getFileChooser#1).__Tag
    //#output(JFileChooser getFileChooser(DCCPlugin, String)): new KFileChooser(getFileChooser#1).fileFilter
    //#output(JFileChooser getFileChooser(DCCPlugin, String)): new KFileChooser(getFileChooser#1).plugin
    //#output(JFileChooser getFileChooser(DCCPlugin, String)): return_value
    //#new obj(JFileChooser getFileChooser(DCCPlugin, String)): new JFileChooser(getFileChooser#2)
    //#new obj(JFileChooser getFileChooser(DCCPlugin, String)): new KFileChooser(getFileChooser#1)
    //#pre[2] (JFileChooser getFileChooser(DCCPlugin, String)): (soft) plugin != null
    //#post(JFileChooser getFileChooser(DCCPlugin, String)): return_value == One-of{&new KFileChooser(getFileChooser#1), &new JFileChooser(getFileChooser#2)}
    //#post(JFileChooser getFileChooser(DCCPlugin, String)): return_value in Addr_Set{&new JFileChooser(getFileChooser#2),&new KFileChooser(getFileChooser#1)}
    //#post(JFileChooser getFileChooser(DCCPlugin, String)): new JFileChooser(getFileChooser#2) num objects <= 1
    //#post(JFileChooser getFileChooser(DCCPlugin, String)): new KFileChooser(getFileChooser#1) num objects <= 1
    //#post(JFileChooser getFileChooser(DCCPlugin, String)): new KFileChooser(getFileChooser#1).__Tag == com/dmdirc/addons/dcc/kde/KFileChooser
    //#post(JFileChooser getFileChooser(DCCPlugin, String)): new KFileChooser(getFileChooser#1).fileFilter == null
    //#post(JFileChooser getFileChooser(DCCPlugin, String)): new KFileChooser(getFileChooser#1).plugin == plugin
    //#post(JFileChooser getFileChooser(DCCPlugin, String)): new KFileChooser(getFileChooser#1).plugin != null
    //#unanalyzed(JFileChooser getFileChooser(DCCPlugin, String)): Effects-of-calling:com.dmdirc.config.IdentityManager:getGlobalConfig
    //#unanalyzed(JFileChooser getFileChooser(DCCPlugin, String)): Effects-of-calling:com.dmdirc.addons.dcc.DCCPlugin:getDomain
    //#unanalyzed(JFileChooser getFileChooser(DCCPlugin, String)): Effects-of-calling:com.dmdirc.config.ConfigManager:getOptionBool
    //#unanalyzed(JFileChooser getFileChooser(DCCPlugin, String)): Effects-of-calling:javax.swing.JFileChooser
    //#KFileChooser.java:135: end of method: JFileChooser com.dmdirc.addons.dcc.kde.KFileChooser.getFileChooser(DCCPlugin, String)
	}
	
	/**
	 * Constructs a FileChooser using the given current directory path and FileSystemView.
	 *
     * @param plugin The DCC Plugin that is requesting a chooser
	 * @param currentDirectoryPath Directory to use as the base directory
	 * @param fsv The FileSystemView to use
     * @return The relevant FileChooser
	 */
	public static JFileChooser getFileChooser(final DCCPlugin plugin, final String currentDirectoryPath, final FileSystemView fsv) {
		return useKFileChooser(plugin) ? new KFileChooser(plugin, currentDirectoryPath, fsv) : new JFileChooser(currentDirectoryPath, fsv);
    //#KFileChooser.java:147: method: JFileChooser com.dmdirc.addons.dcc.kde.KFileChooser.getFileChooser(DCCPlugin, String, FileSystemView)
    //#input(JFileChooser getFileChooser(DCCPlugin, String, FileSystemView)): com/dmdirc/addons/dcc/kde/KDialogProcess.hasKDialog
    //#input(JFileChooser getFileChooser(DCCPlugin, String, FileSystemView)): currentDirectoryPath
    //#input(JFileChooser getFileChooser(DCCPlugin, String, FileSystemView)): fsv
    //#input(JFileChooser getFileChooser(DCCPlugin, String, FileSystemView)): plugin
    //#output(JFileChooser getFileChooser(DCCPlugin, String, FileSystemView)): new JFileChooser(getFileChooser#2) num objects
    //#output(JFileChooser getFileChooser(DCCPlugin, String, FileSystemView)): new KFileChooser(getFileChooser#1) num objects
    //#output(JFileChooser getFileChooser(DCCPlugin, String, FileSystemView)): new KFileChooser(getFileChooser#1).__Tag
    //#output(JFileChooser getFileChooser(DCCPlugin, String, FileSystemView)): new KFileChooser(getFileChooser#1).fileFilter
    //#output(JFileChooser getFileChooser(DCCPlugin, String, FileSystemView)): new KFileChooser(getFileChooser#1).plugin
    //#output(JFileChooser getFileChooser(DCCPlugin, String, FileSystemView)): return_value
    //#new obj(JFileChooser getFileChooser(DCCPlugin, String, FileSystemView)): new JFileChooser(getFileChooser#2)
    //#new obj(JFileChooser getFileChooser(DCCPlugin, String, FileSystemView)): new KFileChooser(getFileChooser#1)
    //#pre[3] (JFileChooser getFileChooser(DCCPlugin, String, FileSystemView)): (soft) plugin != null
    //#post(JFileChooser getFileChooser(DCCPlugin, String, FileSystemView)): return_value == One-of{&new KFileChooser(getFileChooser#1), &new JFileChooser(getFileChooser#2)}
    //#post(JFileChooser getFileChooser(DCCPlugin, String, FileSystemView)): return_value in Addr_Set{&new JFileChooser(getFileChooser#2),&new KFileChooser(getFileChooser#1)}
    //#post(JFileChooser getFileChooser(DCCPlugin, String, FileSystemView)): new JFileChooser(getFileChooser#2) num objects <= 1
    //#post(JFileChooser getFileChooser(DCCPlugin, String, FileSystemView)): new KFileChooser(getFileChooser#1) num objects <= 1
    //#post(JFileChooser getFileChooser(DCCPlugin, String, FileSystemView)): new KFileChooser(getFileChooser#1).__Tag == com/dmdirc/addons/dcc/kde/KFileChooser
    //#post(JFileChooser getFileChooser(DCCPlugin, String, FileSystemView)): new KFileChooser(getFileChooser#1).fileFilter == null
    //#post(JFileChooser getFileChooser(DCCPlugin, String, FileSystemView)): new KFileChooser(getFileChooser#1).plugin == plugin
    //#post(JFileChooser getFileChooser(DCCPlugin, String, FileSystemView)): new KFileChooser(getFileChooser#1).plugin != null
    //#unanalyzed(JFileChooser getFileChooser(DCCPlugin, String, FileSystemView)): Effects-of-calling:com.dmdirc.config.IdentityManager:getGlobalConfig
    //#unanalyzed(JFileChooser getFileChooser(DCCPlugin, String, FileSystemView)): Effects-of-calling:com.dmdirc.addons.dcc.DCCPlugin:getDomain
    //#unanalyzed(JFileChooser getFileChooser(DCCPlugin, String, FileSystemView)): Effects-of-calling:com.dmdirc.config.ConfigManager:getOptionBool
    //#unanalyzed(JFileChooser getFileChooser(DCCPlugin, String, FileSystemView)): Effects-of-calling:javax.swing.JFileChooser
    //#KFileChooser.java:147: end of method: JFileChooser com.dmdirc.addons.dcc.kde.KFileChooser.getFileChooser(DCCPlugin, String, FileSystemView)
	}
	
	/**
	 * Constructs a FileChooser pointing to the user's default directory.
     *
     * @param plugin The plugin that owns this KFileChooser
	 */
	private KFileChooser(final DCCPlugin plugin) {
		super();
    //#KFileChooser.java:156: method: void com.dmdirc.addons.dcc.kde.KFileChooser.com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin)
    //#input(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin)): plugin
    //#input(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin)): this
    //#output(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin)): this.fileFilter
    //#output(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin)): this.plugin
    //#post(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin)): this.fileFilter == null
    //#post(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin)): this.plugin == plugin
    //#post(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin)): init'ed(this.plugin)

        this.plugin = plugin;
	}
    //#KFileChooser.java:159: end of method: void com.dmdirc.addons.dcc.kde.KFileChooser.com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin)
	
	/**
	 * Constructs a FileChooser using the given File as the path.
	 *
     * @param plugin The plugin that owns this KFileChooser
	 * @param currentDirectory Directory to use as the base directory
	 */
	private KFileChooser(final DCCPlugin plugin, final File currentDirectory) {
		super(currentDirectory);
    //#KFileChooser.java:168: method: void com.dmdirc.addons.dcc.kde.KFileChooser.com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, File)
    //#input(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, File)): currentDirectory
    //#input(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, File)): plugin
    //#input(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, File)): this
    //#output(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, File)): this.fileFilter
    //#output(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, File)): this.plugin
    //#post(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, File)): this.fileFilter == null
    //#post(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, File)): this.plugin == plugin
    //#post(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, File)): init'ed(this.plugin)

        this.plugin = plugin;
	}
    //#KFileChooser.java:171: end of method: void com.dmdirc.addons.dcc.kde.KFileChooser.com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, File)
	
	/**
	 * Constructs a FileChooser using the given current directory and FileSystemView.
	 *
     * @param plugin The plugin that owns this KFileChooser
	 * @param currentDirectory Directory to use as the base directory
	 * @param fsv The FileSystemView to use
	 */
	private KFileChooser(final DCCPlugin plugin, final File currentDirectory, final FileSystemView fsv) {
		super(currentDirectory, fsv);
    //#KFileChooser.java:181: method: void com.dmdirc.addons.dcc.kde.KFileChooser.com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, File, FileSystemView)
    //#input(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, File, FileSystemView)): currentDirectory
    //#input(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, File, FileSystemView)): fsv
    //#input(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, File, FileSystemView)): plugin
    //#input(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, File, FileSystemView)): this
    //#output(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, File, FileSystemView)): this.fileFilter
    //#output(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, File, FileSystemView)): this.plugin
    //#post(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, File, FileSystemView)): this.fileFilter == null
    //#post(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, File, FileSystemView)): this.plugin == plugin
    //#post(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, File, FileSystemView)): init'ed(this.plugin)

        this.plugin = plugin;
	}
    //#KFileChooser.java:184: end of method: void com.dmdirc.addons.dcc.kde.KFileChooser.com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, File, FileSystemView)
	
	/**
	 * Constructs a FileChooser using the given FileSystemView.
	 *
     * @param plugin The plugin that owns this KFileChooser
	 * @param fsv The FileSystemView to use
	 */
	private KFileChooser(final DCCPlugin plugin, final FileSystemView fsv) {
		super(fsv);
    //#KFileChooser.java:193: method: void com.dmdirc.addons.dcc.kde.KFileChooser.com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, FileSystemView)
    //#input(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, FileSystemView)): fsv
    //#input(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, FileSystemView)): plugin
    //#input(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, FileSystemView)): this
    //#output(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, FileSystemView)): this.fileFilter
    //#output(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, FileSystemView)): this.plugin
    //#post(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, FileSystemView)): this.fileFilter == null
    //#post(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, FileSystemView)): this.plugin == plugin
    //#post(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, FileSystemView)): init'ed(this.plugin)

        this.plugin = plugin;
	}
    //#KFileChooser.java:196: end of method: void com.dmdirc.addons.dcc.kde.KFileChooser.com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, FileSystemView)
	
	/**
	 * Constructs a FileChooser using the given path.
	 *
     * @param plugin The plugin that owns this KFileChooser
	 * @param currentDirectoryPath Directory to use as the base directory
	 */
	private KFileChooser(final DCCPlugin plugin, final String currentDirectoryPath) {
		super(currentDirectoryPath);
    //#KFileChooser.java:205: method: void com.dmdirc.addons.dcc.kde.KFileChooser.com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, String)
    //#input(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, String)): currentDirectoryPath
    //#input(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, String)): plugin
    //#input(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, String)): this
    //#output(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, String)): this.fileFilter
    //#output(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, String)): this.plugin
    //#post(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, String)): this.fileFilter == null
    //#post(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, String)): this.plugin == plugin
    //#post(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, String)): init'ed(this.plugin)

        this.plugin = plugin;
	}
    //#KFileChooser.java:208: end of method: void com.dmdirc.addons.dcc.kde.KFileChooser.com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, String)
	
	/**
	 * Constructs a FileChooser using the given current directory path and FileSystemView.
	 *
     * @param plugin The plugin that owns this KFileChooser
	 * @param currentDirectoryPath Directory to use as the base directory
	 * @param fsv The FileSystemView to use
	 */
	private KFileChooser(final DCCPlugin plugin, final String currentDirectoryPath, final FileSystemView fsv) {
		super(currentDirectoryPath, fsv);
    //#KFileChooser.java:218: method: void com.dmdirc.addons.dcc.kde.KFileChooser.com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, String, FileSystemView)
    //#input(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, String, FileSystemView)): currentDirectoryPath
    //#input(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, String, FileSystemView)): fsv
    //#input(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, String, FileSystemView)): plugin
    //#input(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, String, FileSystemView)): this
    //#output(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, String, FileSystemView)): this.fileFilter
    //#output(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, String, FileSystemView)): this.plugin
    //#post(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, String, FileSystemView)): this.fileFilter == null
    //#post(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, String, FileSystemView)): this.plugin == plugin
    //#post(void com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, String, FileSystemView)): init'ed(this.plugin)

        this.plugin = plugin;
	}
    //#KFileChooser.java:221: end of method: void com.dmdirc.addons.dcc.kde.KFileChooser.com.dmdirc.addons.dcc.kde.KFileChooser(DCCPlugin, String, FileSystemView)
	
	/**
	 * Set the file filter.
	 *
	 * @param fileFilter File filter (eg "*.php *.jpg" or null for no filter)
	 */
	public void setKDEFileFilter(final String fileFilter) {
		this.fileFilter = fileFilter;
    //#KFileChooser.java:229: method: void com.dmdirc.addons.dcc.kde.KFileChooser.setKDEFileFilter(String)
    //#input(void setKDEFileFilter(String)): fileFilter
    //#input(void setKDEFileFilter(String)): this
    //#output(void setKDEFileFilter(String)): this.fileFilter
    //#post(void setKDEFileFilter(String)): this.fileFilter == fileFilter
    //#post(void setKDEFileFilter(String)): init'ed(this.fileFilter)
	}
    //#KFileChooser.java:230: end of method: void com.dmdirc.addons.dcc.kde.KFileChooser.setKDEFileFilter(String)
	
	/**
	 * Get the file filter.
	 *
	 * @return File filter (eg "*.php *.jpg" or null for no filter)
	 */
	public String getKDEFileFilter() {
		return fileFilter;
    //#KFileChooser.java:238: method: String com.dmdirc.addons.dcc.kde.KFileChooser.getKDEFileFilter()
    //#input(String getKDEFileFilter()): this
    //#input(String getKDEFileFilter()): this.fileFilter
    //#output(String getKDEFileFilter()): return_value
    //#pre[2] (String getKDEFileFilter()): init'ed(this.fileFilter)
    //#post(String getKDEFileFilter()): return_value == this.fileFilter
    //#post(String getKDEFileFilter()): init'ed(return_value)
    //#KFileChooser.java:238: end of method: String com.dmdirc.addons.dcc.kde.KFileChooser.getKDEFileFilter()
	}
	
	/** {@inheritDoc} */
    @Override
	public int showOpenDialog(final Component parent) throws HeadlessException {
		if (!useKFileChooser(plugin)) {
    //#KFileChooser.java:244: method: int com.dmdirc.addons.dcc.kde.KFileChooser.showOpenDialog(Component)
    //#input(int showOpenDialog(Component)): com/dmdirc/addons/dcc/kde/KDialogProcess.__Descendant_Table[com/dmdirc/addons/dcc/kde/KDialogProcess]
    //#input(int showOpenDialog(Component)): com/dmdirc/addons/dcc/kde/KDialogProcess.__Dispatch_Table.getProcess()Ljava/lang/Process;
    //#input(int showOpenDialog(Component)): com/dmdirc/addons/dcc/kde/KDialogProcess.__Dispatch_Table.getStdOutStream()Lcom/dmdirc/addons/dcc/kde/StreamReader;
    //#input(int showOpenDialog(Component)): com/dmdirc/addons/dcc/kde/KDialogProcess.__Dispatch_Table.waitFor()V
    //#input(int showOpenDialog(Component)): com/dmdirc/addons/dcc/kde/KDialogProcess.hasKDialog
    //#input(int showOpenDialog(Component)): com/dmdirc/addons/dcc/kde/KDialogProcess.isBin
    //#input(int showOpenDialog(Component)): com/dmdirc/addons/dcc/kde/StreamReader.__Descendant_Table[com/dmdirc/addons/dcc/kde/StreamReader]
    //#input(int showOpenDialog(Component)): com/dmdirc/addons/dcc/kde/StreamReader.__Dispatch_Table.getList()Ljava/util/List;
    //#input(int showOpenDialog(Component)): java.io.File.separator
    //#input(int showOpenDialog(Component)): java.io.File.separator._tainted
    //#input(int showOpenDialog(Component)): parent
    //#input(int showOpenDialog(Component)): this
    //#input(int showOpenDialog(Component)): this.fileFilter
    //#input(int showOpenDialog(Component)): this.plugin
    //#output(int showOpenDialog(Component)): return_value
    //#pre[3] (int showOpenDialog(Component)): (soft) init'ed(this.fileFilter)
    //#pre[4] (int showOpenDialog(Component)): (soft) this.plugin != null
    //#presumption(int showOpenDialog(Component)): com.dmdirc.addons.dcc.kde.KFileChooser:getCurrentDirectory(...)@263 != null
    //#presumption(int showOpenDialog(Component)): com.dmdirc.addons.dcc.kde.KFileChooser:getCurrentDirectory(...)@268 != null
    //#presumption(int showOpenDialog(Component)): com.dmdirc.addons.dcc.kde.KFileChooser:getDialogTitle(...)@252 != null
    //#presumption(int showOpenDialog(Component)): com.dmdirc.addons.dcc.kde.KFileChooser:getSelectedFile(...)@261 != null
    //#presumption(int showOpenDialog(Component)): com.dmdirc.addons.dcc.kde.KFileChooser:getSelectedFile(...)@262 != null
    //#presumption(int showOpenDialog(Component)): com.dmdirc.addons.dcc.kde.KFileChooser:getSelectedFile(...)@263 != null
    //#presumption(int showOpenDialog(Component)): com.dmdirc.addons.dcc.kde.KFileChooser:getSelectedFile(...)@265 != null
    //#presumption(int showOpenDialog(Component)): init'ed(java.io.File.separator)
    //#presumption(int showOpenDialog(Component)): java.io.File:getPath(...)@261 != null
    //#presumption(int showOpenDialog(Component)): java.io.File:getPath(...)@262 != null
    //#presumption(int showOpenDialog(Component)): java.util.ArrayList:toArray(...)@275 != null
    //#presumption(int showOpenDialog(Component)): java.util.List:size(...)@284 >= 0
    //#presumption(int showOpenDialog(Component)): java.util.List:size(...)@285 - java.util.List:size(...)@284 in {-6_442_450_943..0}
    //#post(int showOpenDialog(Component)): init'ed(return_value)
    //#unanalyzed(int showOpenDialog(Component)): Effects-of-calling:com.dmdirc.config.IdentityManager:getGlobalConfig
    //#unanalyzed(int showOpenDialog(Component)): Effects-of-calling:com.dmdirc.addons.dcc.DCCPlugin:getDomain
    //#unanalyzed(int showOpenDialog(Component)): Effects-of-calling:com.dmdirc.config.ConfigManager:getOptionBool
    //#unanalyzed(int showOpenDialog(Component)): Effects-of-calling:java.lang.Runtime:getRuntime
    //#unanalyzed(int showOpenDialog(Component)): Effects-of-calling:java.lang.Runtime:exec
    //#unanalyzed(int showOpenDialog(Component)): Effects-of-calling:java.lang.Process:getInputStream
    //#unanalyzed(int showOpenDialog(Component)): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(int showOpenDialog(Component)): Effects-of-calling:java.lang.Thread
    //#unanalyzed(int showOpenDialog(Component)): Effects-of-calling:java.lang.Process:getErrorStream
    //#unanalyzed(int showOpenDialog(Component)): Effects-of-calling:com.dmdirc.addons.dcc.kde.StreamReader:start
    //#unanalyzed(int showOpenDialog(Component)): Effects-of-calling:java.lang.Process:waitFor
    //#test_vector(int showOpenDialog(Component)): this.fileFilter: Addr_Set{null}, Inverse{null}
    //#test_vector(int showOpenDialog(Component)): com.dmdirc.addons.dcc.kde.KFileChooser:getCurrentDirectory(...)@267: Addr_Set{null}, Inverse{null}
    //#test_vector(int showOpenDialog(Component)): com.dmdirc.addons.dcc.kde.KFileChooser:getDialogTitle(...)@252: Addr_Set{null}, Inverse{null}
    //#test_vector(int showOpenDialog(Component)): com.dmdirc.addons.dcc.kde.KFileChooser:getFileSelectionMode(...)@256: {-2_147_483_648..0, 2..4_294_967_295}, {1}
    //#test_vector(int showOpenDialog(Component)): com.dmdirc.addons.dcc.kde.KFileChooser:getFileSelectionMode(...)@261: {1}, {-2_147_483_648..0, 2..4_294_967_295}
    //#test_vector(int showOpenDialog(Component)): com.dmdirc.addons.dcc.kde.KFileChooser:getFileSelectionMode(...)@270: {1}, {-2_147_483_648..0, 2..4_294_967_295}
    //#test_vector(int showOpenDialog(Component)): com.dmdirc.addons.dcc.kde.KFileChooser:getSelectedFile(...)@261: Addr_Set{null}, Inverse{null}
    //#test_vector(int showOpenDialog(Component)): com.dmdirc.addons.dcc.kde.KFileChooser:isMultiSelectionEnabled(...)@248: {0}, {1}
    //#test_vector(int showOpenDialog(Component)): com.dmdirc.addons.dcc.kde.KFileChooser:isMultiSelectionEnabled(...)@282: {0}, {1}
    //#test_vector(int showOpenDialog(Component)): java.lang.Process:exitValue(...)@281: {-2_147_483_648..-1, 1..4_294_967_295}, {0}
    //#test_vector(int showOpenDialog(Component)): java.lang.String:charAt(...)@262: {47}, {0..46, 48..65_535}
    //#test_vector(int showOpenDialog(Component)): java.lang.String:isEmpty(...)@252: {1}, {0}
    //#test_vector(int showOpenDialog(Component)): java.lang.String:isEmpty(...)@261: {1}, {0}
    //#test_vector(int showOpenDialog(Component)): java.lang.String:isEmpty(...)@270: {1}, {0}
			return super.showOpenDialog(parent);
		}
		final ArrayList<String> params = new ArrayList<String>();
		if (isMultiSelectionEnabled()) {
    //#KFileChooser.java:248: Warning: method not available - call not analyzed
    //#    call on bool com.dmdirc.addons.dcc.kde.KFileChooser:isMultiSelectionEnabled()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#    method: int showOpenDialog(Component)
    //#    unanalyzed callee: bool com.dmdirc.addons.dcc.kde.KFileChooser:isMultiSelectionEnabled()
			params.add("--multiple");
			params.add("--separate-output");
		}
		if (getDialogTitle() != null && !getDialogTitle().isEmpty()) {
    //#KFileChooser.java:252: Warning: method not available - call not analyzed
    //#    call on String com.dmdirc.addons.dcc.kde.KFileChooser:getDialogTitle()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#    method: int showOpenDialog(Component)
    //#    unanalyzed callee: String com.dmdirc.addons.dcc.kde.KFileChooser:getDialogTitle()
			params.add("--caption");
			params.add(getDialogTitle());
    //#KFileChooser.java:254: Warning: method not available - call not analyzed
    //#    call on String com.dmdirc.addons.dcc.kde.KFileChooser:getDialogTitle()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#    method: int showOpenDialog(Component)
    //#    unanalyzed callee: String com.dmdirc.addons.dcc.kde.KFileChooser:getDialogTitle()
		}
		if (getFileSelectionMode() == DIRECTORIES_ONLY) {
    //#KFileChooser.java:256: Warning: method not available - call not analyzed
    //#    call on int com.dmdirc.addons.dcc.kde.KFileChooser:getFileSelectionMode()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#    method: int showOpenDialog(Component)
    //#    unanalyzed callee: int com.dmdirc.addons.dcc.kde.KFileChooser:getFileSelectionMode()
			params.add("--getexistingdirectory");
		} else {
			params.add("--getopenfilename");
		}
		if (getSelectedFile() != null && getFileSelectionMode() != DIRECTORIES_ONLY && !getSelectedFile().getPath().isEmpty()) {
    //#KFileChooser.java:261: Warning: method not available - call not analyzed
    //#    call on File com.dmdirc.addons.dcc.kde.KFileChooser:getSelectedFile()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#    method: int showOpenDialog(Component)
    //#    unanalyzed callee: File com.dmdirc.addons.dcc.kde.KFileChooser:getSelectedFile()
    //#KFileChooser.java:261: Warning: method not available - call not analyzed
    //#    call on int com.dmdirc.addons.dcc.kde.KFileChooser:getFileSelectionMode()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#    method: int showOpenDialog(Component)
    //#    unanalyzed callee: int com.dmdirc.addons.dcc.kde.KFileChooser:getFileSelectionMode()
			if (getSelectedFile().getPath().charAt(0) != '/') {
    //#KFileChooser.java:262: Warning: method not available - call not analyzed
    //#    call on File com.dmdirc.addons.dcc.kde.KFileChooser:getSelectedFile()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#    method: int showOpenDialog(Component)
    //#    unanalyzed callee: File com.dmdirc.addons.dcc.kde.KFileChooser:getSelectedFile()
				params.add(getCurrentDirectory().getPath() + File.separator + getSelectedFile().getPath());
    //#KFileChooser.java:263: Warning: method not available - call not analyzed
    //#    call on File com.dmdirc.addons.dcc.kde.KFileChooser:getCurrentDirectory()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#    method: int showOpenDialog(Component)
    //#    unanalyzed callee: File com.dmdirc.addons.dcc.kde.KFileChooser:getCurrentDirectory()
    //#KFileChooser.java:263: Warning: method not available - call not analyzed
    //#    call on File com.dmdirc.addons.dcc.kde.KFileChooser:getSelectedFile()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#    method: int showOpenDialog(Component)
    //#    unanalyzed callee: File com.dmdirc.addons.dcc.kde.KFileChooser:getSelectedFile()
			} else {
				params.add(getSelectedFile().getPath());
    //#KFileChooser.java:265: Warning: method not available - call not analyzed
    //#    call on File com.dmdirc.addons.dcc.kde.KFileChooser:getSelectedFile()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#    method: int showOpenDialog(Component)
    //#    unanalyzed callee: File com.dmdirc.addons.dcc.kde.KFileChooser:getSelectedFile()
			}
		} else if (getCurrentDirectory() != null) {
    //#KFileChooser.java:267: Warning: method not available - call not analyzed
    //#    call on File com.dmdirc.addons.dcc.kde.KFileChooser:getCurrentDirectory()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#    method: int showOpenDialog(Component)
    //#    unanalyzed callee: File com.dmdirc.addons.dcc.kde.KFileChooser:getCurrentDirectory()
			params.add(getCurrentDirectory().getPath());
    //#KFileChooser.java:268: Warning: method not available - call not analyzed
    //#    call on File com.dmdirc.addons.dcc.kde.KFileChooser:getCurrentDirectory()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#    method: int showOpenDialog(Component)
    //#    unanalyzed callee: File com.dmdirc.addons.dcc.kde.KFileChooser:getCurrentDirectory()
		}
		if (getFileSelectionMode() != DIRECTORIES_ONLY && fileFilter != null && !fileFilter.isEmpty()) {
    //#KFileChooser.java:270: Warning: method not available - call not analyzed
    //#    call on int com.dmdirc.addons.dcc.kde.KFileChooser:getFileSelectionMode()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#    method: int showOpenDialog(Component)
    //#    unanalyzed callee: int com.dmdirc.addons.dcc.kde.KFileChooser:getFileSelectionMode()
			params.add(fileFilter);
		}
		KDialogProcess kdp;
		try {
			kdp = new KDialogProcess(params.toArray(new String[0]));
			kdp.waitFor();
		} catch (Exception e) {
			return JFileChooser.ERROR_OPTION;
		}
		
		if (kdp.getProcess().exitValue() == 0) {
			if (isMultiSelectionEnabled()) {
    //#KFileChooser.java:282: Warning: method not available - call not analyzed
    //#    call on bool com.dmdirc.addons.dcc.kde.KFileChooser:isMultiSelectionEnabled()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#    method: int showOpenDialog(Component)
    //#    unanalyzed callee: bool com.dmdirc.addons.dcc.kde.KFileChooser:isMultiSelectionEnabled()
				final List<String> list = kdp.getStdOutStream().getList();
				final File[] fileList = new File[list.size()];
				for (int i = 0; i < list.size(); ++i) {
					fileList[i] = new File(list.get(i));
				}
				setSelectedFiles(fileList);
    //#KFileChooser.java:288: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.dcc.kde.KFileChooser:setSelectedFiles(File[])
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#    method: int showOpenDialog(Component)
    //#    unanalyzed callee: void com.dmdirc.addons.dcc.kde.KFileChooser:setSelectedFiles(File[])
			} else {
				setSelectedFile(new File(kdp.getStdOutStream().getList().get(0)));
    //#KFileChooser.java:290: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.dcc.kde.KFileChooser:setSelectedFile(File)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#    method: int showOpenDialog(Component)
    //#    unanalyzed callee: void com.dmdirc.addons.dcc.kde.KFileChooser:setSelectedFile(File)
			}
			return JFileChooser.APPROVE_OPTION;
		} else {
			return JFileChooser.ERROR_OPTION;
    //#KFileChooser.java:294: end of method: int com.dmdirc.addons.dcc.kde.KFileChooser.showOpenDialog(Component)
		}
	}
	
	/** {@inheritDoc} */
    @Override
	public int showSaveDialog(final Component parent) throws HeadlessException {
		if (!useKFileChooser(plugin)) {
    //#KFileChooser.java:301: method: int com.dmdirc.addons.dcc.kde.KFileChooser.showSaveDialog(Component)
    //#input(int showSaveDialog(Component)): com/dmdirc/addons/dcc/kde/KDialogProcess.__Descendant_Table[com/dmdirc/addons/dcc/kde/KDialogProcess]
    //#input(int showSaveDialog(Component)): com/dmdirc/addons/dcc/kde/KDialogProcess.__Dispatch_Table.getProcess()Ljava/lang/Process;
    //#input(int showSaveDialog(Component)): com/dmdirc/addons/dcc/kde/KDialogProcess.__Dispatch_Table.getStdOutStream()Lcom/dmdirc/addons/dcc/kde/StreamReader;
    //#input(int showSaveDialog(Component)): com/dmdirc/addons/dcc/kde/KDialogProcess.__Dispatch_Table.waitFor()V
    //#input(int showSaveDialog(Component)): com/dmdirc/addons/dcc/kde/KDialogProcess.hasKDialog
    //#input(int showSaveDialog(Component)): com/dmdirc/addons/dcc/kde/KDialogProcess.isBin
    //#input(int showSaveDialog(Component)): com/dmdirc/addons/dcc/kde/StreamReader.__Descendant_Table[com/dmdirc/addons/dcc/kde/StreamReader]
    //#input(int showSaveDialog(Component)): com/dmdirc/addons/dcc/kde/StreamReader.__Dispatch_Table.getList()Ljava/util/List;
    //#input(int showSaveDialog(Component)): java.io.File.separator
    //#input(int showSaveDialog(Component)): java.io.File.separator._tainted
    //#input(int showSaveDialog(Component)): parent
    //#input(int showSaveDialog(Component)): this
    //#input(int showSaveDialog(Component)): this.plugin
    //#output(int showSaveDialog(Component)): return_value
    //#pre[3] (int showSaveDialog(Component)): (soft) this.plugin != null
    //#presumption(int showSaveDialog(Component)): com.dmdirc.addons.dcc.kde.KFileChooser:getCurrentDirectory(...)@312 != null
    //#presumption(int showSaveDialog(Component)): com.dmdirc.addons.dcc.kde.KFileChooser:getCurrentDirectory(...)@317 != null
    //#presumption(int showSaveDialog(Component)): com.dmdirc.addons.dcc.kde.KFileChooser:getDialogTitle(...)@305 != null
    //#presumption(int showSaveDialog(Component)): com.dmdirc.addons.dcc.kde.KFileChooser:getSelectedFile(...)@310 != null
    //#presumption(int showSaveDialog(Component)): com.dmdirc.addons.dcc.kde.KFileChooser:getSelectedFile(...)@311 != null
    //#presumption(int showSaveDialog(Component)): com.dmdirc.addons.dcc.kde.KFileChooser:getSelectedFile(...)@312 != null
    //#presumption(int showSaveDialog(Component)): com.dmdirc.addons.dcc.kde.KFileChooser:getSelectedFile(...)@314 != null
    //#presumption(int showSaveDialog(Component)): init'ed(java.io.File.separator)
    //#presumption(int showSaveDialog(Component)): java.io.File:getPath(...)@310 != null
    //#presumption(int showSaveDialog(Component)): java.io.File:getPath(...)@311 != null
    //#presumption(int showSaveDialog(Component)): java.util.ArrayList:toArray(...)@321 != null
    //#post(int showSaveDialog(Component)): init'ed(return_value)
    //#unanalyzed(int showSaveDialog(Component)): Effects-of-calling:com.dmdirc.config.IdentityManager:getGlobalConfig
    //#unanalyzed(int showSaveDialog(Component)): Effects-of-calling:com.dmdirc.addons.dcc.DCCPlugin:getDomain
    //#unanalyzed(int showSaveDialog(Component)): Effects-of-calling:com.dmdirc.config.ConfigManager:getOptionBool
    //#unanalyzed(int showSaveDialog(Component)): Effects-of-calling:java.lang.Runtime:getRuntime
    //#unanalyzed(int showSaveDialog(Component)): Effects-of-calling:java.lang.Runtime:exec
    //#unanalyzed(int showSaveDialog(Component)): Effects-of-calling:java.lang.Process:getInputStream
    //#unanalyzed(int showSaveDialog(Component)): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(int showSaveDialog(Component)): Effects-of-calling:java.lang.Thread
    //#unanalyzed(int showSaveDialog(Component)): Effects-of-calling:java.lang.Process:getErrorStream
    //#unanalyzed(int showSaveDialog(Component)): Effects-of-calling:com.dmdirc.addons.dcc.kde.StreamReader:start
    //#unanalyzed(int showSaveDialog(Component)): Effects-of-calling:java.lang.Process:waitFor
    //#test_vector(int showSaveDialog(Component)): com.dmdirc.addons.dcc.kde.KFileChooser:getCurrentDirectory(...)@316: Addr_Set{null}, Inverse{null}
    //#test_vector(int showSaveDialog(Component)): com.dmdirc.addons.dcc.kde.KFileChooser:getDialogTitle(...)@305: Addr_Set{null}, Inverse{null}
    //#test_vector(int showSaveDialog(Component)): com.dmdirc.addons.dcc.kde.KFileChooser:getSelectedFile(...)@310: Addr_Set{null}, Inverse{null}
    //#test_vector(int showSaveDialog(Component)): java.lang.Process:exitValue(...)@327: {-2_147_483_648..-1, 1..4_294_967_295}, {0}
    //#test_vector(int showSaveDialog(Component)): java.lang.String:charAt(...)@311: {47}, {0..46, 48..65_535}
    //#test_vector(int showSaveDialog(Component)): java.lang.String:isEmpty(...)@305: {1}, {0}
    //#test_vector(int showSaveDialog(Component)): java.lang.String:isEmpty(...)@310: {1}, {0}
			return super.showSaveDialog(parent);
		}
		final ArrayList<String> params = new ArrayList<String>();
		if (getDialogTitle() != null && !getDialogTitle().isEmpty()) {
    //#KFileChooser.java:305: Warning: method not available - call not analyzed
    //#    call on String com.dmdirc.addons.dcc.kde.KFileChooser:getDialogTitle()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#    method: int showSaveDialog(Component)
    //#    unanalyzed callee: String com.dmdirc.addons.dcc.kde.KFileChooser:getDialogTitle()
			params.add("--caption");
			params.add(getDialogTitle());
    //#KFileChooser.java:307: Warning: method not available - call not analyzed
    //#    call on String com.dmdirc.addons.dcc.kde.KFileChooser:getDialogTitle()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#    method: int showSaveDialog(Component)
    //#    unanalyzed callee: String com.dmdirc.addons.dcc.kde.KFileChooser:getDialogTitle()
		}
		params.add("--getsavefilename");
		if (getSelectedFile() != null && !getSelectedFile().getPath().isEmpty()) {
    //#KFileChooser.java:310: Warning: method not available - call not analyzed
    //#    call on File com.dmdirc.addons.dcc.kde.KFileChooser:getSelectedFile()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#    method: int showSaveDialog(Component)
    //#    unanalyzed callee: File com.dmdirc.addons.dcc.kde.KFileChooser:getSelectedFile()
			if (getSelectedFile().getPath().charAt(0) != '/') {
    //#KFileChooser.java:311: Warning: method not available - call not analyzed
    //#    call on File com.dmdirc.addons.dcc.kde.KFileChooser:getSelectedFile()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#    method: int showSaveDialog(Component)
    //#    unanalyzed callee: File com.dmdirc.addons.dcc.kde.KFileChooser:getSelectedFile()
				params.add(getCurrentDirectory().getPath()  + File.separator +  getSelectedFile().getPath());
    //#KFileChooser.java:312: Warning: method not available - call not analyzed
    //#    call on File com.dmdirc.addons.dcc.kde.KFileChooser:getCurrentDirectory()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#    method: int showSaveDialog(Component)
    //#    unanalyzed callee: File com.dmdirc.addons.dcc.kde.KFileChooser:getCurrentDirectory()
    //#KFileChooser.java:312: Warning: method not available - call not analyzed
    //#    call on File com.dmdirc.addons.dcc.kde.KFileChooser:getSelectedFile()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#    method: int showSaveDialog(Component)
    //#    unanalyzed callee: File com.dmdirc.addons.dcc.kde.KFileChooser:getSelectedFile()
			} else {
				params.add(getSelectedFile().getPath());
    //#KFileChooser.java:314: Warning: method not available - call not analyzed
    //#    call on File com.dmdirc.addons.dcc.kde.KFileChooser:getSelectedFile()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#    method: int showSaveDialog(Component)
    //#    unanalyzed callee: File com.dmdirc.addons.dcc.kde.KFileChooser:getSelectedFile()
			}
		} else if (getCurrentDirectory() != null) {
    //#KFileChooser.java:316: Warning: method not available - call not analyzed
    //#    call on File com.dmdirc.addons.dcc.kde.KFileChooser:getCurrentDirectory()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#    method: int showSaveDialog(Component)
    //#    unanalyzed callee: File com.dmdirc.addons.dcc.kde.KFileChooser:getCurrentDirectory()
			params.add(getCurrentDirectory().getPath());
    //#KFileChooser.java:317: Warning: method not available - call not analyzed
    //#    call on File com.dmdirc.addons.dcc.kde.KFileChooser:getCurrentDirectory()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#    method: int showSaveDialog(Component)
    //#    unanalyzed callee: File com.dmdirc.addons.dcc.kde.KFileChooser:getCurrentDirectory()
		}
		KDialogProcess kdp;
		try {
			kdp = new KDialogProcess(params.toArray(new String[0]));
			kdp.waitFor();
		} catch (Exception e) {
			return JFileChooser.ERROR_OPTION;
		}
		
		if (kdp.getProcess().exitValue() == 0) {
			setSelectedFile(new File(kdp.getStdOutStream().getList().get(0)));
    //#KFileChooser.java:328: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.dcc.kde.KFileChooser:setSelectedFile(File)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.dcc.kde.KFileChooser
    //#    method: int showSaveDialog(Component)
    //#    unanalyzed callee: void com.dmdirc.addons.dcc.kde.KFileChooser:setSelectedFile(File)
			return JFileChooser.APPROVE_OPTION;
		} else {
			return JFileChooser.ERROR_OPTION;
    //#KFileChooser.java:331: end of method: int com.dmdirc.addons.dcc.kde.KFileChooser.showSaveDialog(Component)
		}
	}
}    //#output(com.dmdirc.addons.dcc.kde.KFileChooser__static_init): __Descendant_Table[com/dmdirc/addons/dcc/kde/KFileChooser]
    //#output(com.dmdirc.addons.dcc.kde.KFileChooser__static_init): __Dispatch_Table.getKDEFileFilter()Ljava/lang/String;
    //#output(com.dmdirc.addons.dcc.kde.KFileChooser__static_init): __Dispatch_Table.setKDEFileFilter(Ljava/lang/String;)V
    //#output(com.dmdirc.addons.dcc.kde.KFileChooser__static_init): __Dispatch_Table.showOpenDialog(Ljava/awt/Component;)I
    //#output(com.dmdirc.addons.dcc.kde.KFileChooser__static_init): __Dispatch_Table.showSaveDialog(Ljava/awt/Component;)I
    //#post(com.dmdirc.addons.dcc.kde.KFileChooser__static_init): __Descendant_Table[com/dmdirc/addons/dcc/kde/KFileChooser] == &__Dispatch_Table
    //#post(com.dmdirc.addons.dcc.kde.KFileChooser__static_init): __Dispatch_Table.getKDEFileFilter()Ljava/lang/String; == &getKDEFileFilter
    //#post(com.dmdirc.addons.dcc.kde.KFileChooser__static_init): __Dispatch_Table.setKDEFileFilter(Ljava/lang/String;)V == &setKDEFileFilter
    //#post(com.dmdirc.addons.dcc.kde.KFileChooser__static_init): __Dispatch_Table.showOpenDialog(Ljava/awt/Component;)I == &showOpenDialog
    //#post(com.dmdirc.addons.dcc.kde.KFileChooser__static_init): __Dispatch_Table.showSaveDialog(Ljava/awt/Component;)I == &showSaveDialog
    //#KFileChooser.java:: end of method: com.dmdirc.addons.dcc.kde.KFileChooser.com.dmdirc.addons.dcc.kde.KFileChooser__static_init
    //#KFileChooser.java:: end of class: com.dmdirc.addons.dcc.kde.KFileChooser
