Search in sources :

Example 1 with DesktopInitialisationException

use of com.mucommander.desktop.DesktopInitialisationException in project mucommander by mucommander.

the class WindowsDesktopAdapter method init.

@Override
public void init(boolean install) throws DesktopInitialisationException {
    try {
        CommandManager.registerDefaultCommand(new WindowsCmdCommand(CommandManager.FILE_OPENER_ALIAS, FILE_OPENER_COMMAND, CommandType.SYSTEM_COMMAND, null));
        CommandManager.registerDefaultCommand(new WindowsCmdCommand(CommandManager.URL_OPENER_ALIAS, FILE_OPENER_COMMAND, CommandType.SYSTEM_COMMAND, null));
        CommandManager.registerDefaultCommand(new WindowsCmdCommand(CommandManager.FILE_MANAGER_ALIAS, EXPLORER_COMMAND, CommandType.SYSTEM_COMMAND, EXPLORER_NAME));
        CommandManager.registerDefaultCommand(new WindowsCmdCommand(CommandManager.EXE_OPENER_ALIAS, EXE_OPENER_COMMAND, CommandType.SYSTEM_COMMAND, null));
        CommandManager.registerDefaultCommand(new WindowsCmdCommand(CommandManager.CMD_OPENER_ALIAS, CMD_OPENER_COMMAND, CommandType.SYSTEM_COMMAND, null));
        CommandManager.registerDefaultAssociation(CommandManager.EXE_OPENER_ALIAS, new RegexpFilenameFilter(EXE_REGEXP, false));
    } catch (CommandException e) {
        throw new DesktopInitialisationException(e);
    }
}
Also used : RegexpFilenameFilter(com.mucommander.commons.file.filter.RegexpFilenameFilter) CommandException(com.mucommander.command.CommandException) DesktopInitialisationException(com.mucommander.desktop.DesktopInitialisationException)

Example 2 with DesktopInitialisationException

use of com.mucommander.desktop.DesktopInitialisationException in project mucommander by mucommander.

the class XfceDesktopAdapter method init.

@Override
public void init(boolean install) throws DesktopInitialisationException {
    // Registers KDE specific commands.
    try {
        CommandManager.registerDefaultCommand(new Command(CommandManager.FILE_OPENER_ALIAS, FILE_OPENER, CommandType.SYSTEM_COMMAND, null));
        CommandManager.registerDefaultCommand(new Command(CommandManager.URL_OPENER_ALIAS, FILE_OPENER, CommandType.SYSTEM_COMMAND, null));
        CommandManager.registerDefaultCommand(new Command(CommandManager.EXE_OPENER_ALIAS, EXE_OPENER, CommandType.SYSTEM_COMMAND, null));
        CommandManager.registerDefaultCommand(new Command(CommandManager.FILE_MANAGER_ALIAS, FILE_OPENER, CommandType.SYSTEM_COMMAND, FILE_MANAGER_NAME));
    } catch (CommandException e) {
        throw new DesktopInitialisationException(e);
    }
}
Also used : Command(com.mucommander.command.Command) CommandException(com.mucommander.command.CommandException) DesktopInitialisationException(com.mucommander.desktop.DesktopInitialisationException)

Example 3 with DesktopInitialisationException

use of com.mucommander.desktop.DesktopInitialisationException in project mucommander by mucommander.

the class GnomeDesktopAdapter method init.

@Override
public void init(boolean install) throws DesktopInitialisationException {
    String fileOpener = String.format("%s $f", getFileOpenerCommand());
    try {
        CommandManager.registerDefaultCommand(new Command(CommandManager.FILE_OPENER_ALIAS, fileOpener, CommandType.SYSTEM_COMMAND, null));
        CommandManager.registerDefaultCommand(new Command(CommandManager.URL_OPENER_ALIAS, fileOpener, CommandType.SYSTEM_COMMAND, null));
        CommandManager.registerDefaultCommand(new Command(CommandManager.EXE_OPENER_ALIAS, EXE_OPENER, CommandType.SYSTEM_COMMAND, null));
        CommandManager.registerDefaultCommand(new Command(CommandManager.FILE_MANAGER_ALIAS, fileOpener, CommandType.SYSTEM_COMMAND, FILE_MANAGER_NAME));
        CommandManager.registerDefaultCommand(new Command(CommandManager.CMD_OPENER_ALIAS, CMD_OPENER_COMMAND, CommandType.SYSTEM_COMMAND, null));
        // Disabled actual permissions checking as this will break normal +x files.
        // With this, a +x PDF file will not be opened.
        /*
            // Identifies which kind of filter should be used to match executable files.
            if(JavaVersion.JAVA_6.isCurrentOrHigher())
                filter = new PermissionsFileFilter(PermissionTypes.EXECUTE_PERMISSION, true);
            else
            */
        FileFilter filter = new RegexpFilenameFilter("[^.]+", true);
        CommandManager.registerDefaultAssociation(CommandManager.EXE_OPENER_ALIAS, filter);
        // Multi-click interval retrieval
        try {
            String value = GnomeConfig.getValue(DOUBLE_CLICK_CONFIG_KEY);
            if (value == null)
                multiClickInterval = super.getMultiClickInterval();
            multiClickInterval = Integer.parseInt(value);
        } catch (Exception e) {
            LOGGER.debug("Error while retrieving double-click interval from gconftool", e);
            multiClickInterval = super.getMultiClickInterval();
        }
    } catch (CommandException e) {
        throw new DesktopInitialisationException(e);
    }
}
Also used : Command(com.mucommander.command.Command) RegexpFilenameFilter(com.mucommander.commons.file.filter.RegexpFilenameFilter) CommandException(com.mucommander.command.CommandException) DesktopInitialisationException(com.mucommander.desktop.DesktopInitialisationException) FileFilter(com.mucommander.commons.file.filter.FileFilter) DesktopInitialisationException(com.mucommander.desktop.DesktopInitialisationException) CommandException(com.mucommander.command.CommandException)

Example 4 with DesktopInitialisationException

use of com.mucommander.desktop.DesktopInitialisationException in project mucommander by mucommander.

the class OSXDesktopAdapter method init.

@Override
public void init(boolean install) throws DesktopInitialisationException {
    // Registers OS X specific commands.
    try {
        CommandManager.registerDefaultCommand(new Command(CommandManager.FILE_OPENER_ALIAS, OPENER_COMMAND, CommandType.SYSTEM_COMMAND, null));
        CommandManager.registerDefaultCommand(new Command(CommandManager.URL_OPENER_ALIAS, OPENER_COMMAND, CommandType.SYSTEM_COMMAND, null));
        CommandManager.registerDefaultCommand(new Command(CommandManager.FILE_MANAGER_ALIAS, FINDER_COMMAND, CommandType.SYSTEM_COMMAND, FINDER_NAME));
        CommandManager.registerDefaultCommand(new Command(CommandManager.CMD_OPENER_ALIAS, CMD_OPENER_COMMAND, CommandType.SYSTEM_COMMAND, null));
        new OSXIntegration();
    } catch (CommandException e) {
        throw new DesktopInitialisationException(e);
    }
}
Also used : OSXIntegration(com.mucommander.ui.macos.OSXIntegration) Command(com.mucommander.command.Command) CommandException(com.mucommander.command.CommandException) DesktopInitialisationException(com.mucommander.desktop.DesktopInitialisationException)

Example 5 with DesktopInitialisationException

use of com.mucommander.desktop.DesktopInitialisationException in project mucommander by mucommander.

the class KdeDesktopAdapter method init.

@Override
public void init(boolean install) throws DesktopInitialisationException {
    // Registers KDE specific commands.
    try {
        String execCommand = getBaseCommand() + " exec $f";
        CommandManager.registerDefaultCommand(new Command(CommandManager.FILE_OPENER_ALIAS, execCommand, CommandType.SYSTEM_COMMAND, null));
        CommandManager.registerDefaultCommand(new Command(CommandManager.URL_OPENER_ALIAS, execCommand, CommandType.SYSTEM_COMMAND, null));
        CommandManager.registerDefaultCommand(new Command(CommandManager.FILE_MANAGER_ALIAS, execCommand, CommandType.SYSTEM_COMMAND, getFileManagerName()));
        CommandManager.registerDefaultCommand(new Command(CommandManager.CMD_OPENER_ALIAS, CMD_OPENER_COMMAND, CommandType.SYSTEM_COMMAND, null));
    } catch (CommandException e) {
        throw new DesktopInitialisationException(e);
    }
    // Multi-click interval retrieval
    try {
        String value = KdeConfig.getValue(DOUBLE_CLICK_CONFIG_KEY);
        if (value == null)
            multiClickInterval = super.getMultiClickInterval();
        multiClickInterval = Integer.parseInt(value);
    } catch (Exception e) {
        LOGGER.debug("Error while retrieving double-click interval from gconftool", e);
        multiClickInterval = super.getMultiClickInterval();
    }
}
Also used : Command(com.mucommander.command.Command) CommandException(com.mucommander.command.CommandException) DesktopInitialisationException(com.mucommander.desktop.DesktopInitialisationException) DesktopInitialisationException(com.mucommander.desktop.DesktopInitialisationException) CommandException(com.mucommander.command.CommandException)

Aggregations

CommandException (com.mucommander.command.CommandException)5 DesktopInitialisationException (com.mucommander.desktop.DesktopInitialisationException)5 Command (com.mucommander.command.Command)4 RegexpFilenameFilter (com.mucommander.commons.file.filter.RegexpFilenameFilter)2 FileFilter (com.mucommander.commons.file.filter.FileFilter)1 OSXIntegration (com.mucommander.ui.macos.OSXIntegration)1