Search in sources :

Example 1 with Command

use of com.mucommander.command.Command in project mucommander by mucommander.

the class ActionManager method registerActions.

public static void registerActions() {
    registerAction(new AddBookmarkAction.Descriptor(), AddBookmarkAction::new);
    registerAction(new NewTabAction.Descriptor(), NewTabAction::new);
    registerAction(new BatchRenameAction.Descriptor(), BatchRenameAction::new);
    registerAction(new BringAllToFrontAction.Descriptor(), BringAllToFrontAction::new);
    registerAction(new CalculateChecksumAction.Descriptor(), CalculateChecksumAction::new);
    registerAction(new ChangeDateAction.Descriptor(), ChangeDateAction::new);
    registerAction(new ChangeLocationAction.Descriptor(), ChangeLocationAction::new);
    registerAction(new ChangePermissionsAction.Descriptor(), ChangePermissionsAction::new);
    registerAction(new CheckForUpdatesAction.Descriptor(), CheckForUpdatesAction::new);
    registerAction(new CloneTabToOtherPanelAction.Descriptor(), CloneTabToOtherPanelAction::new);
    registerAction(new CloseDuplicateTabsAction.Descriptor(), CloseDuplicateTabsAction::new);
    registerAction(new CloseOtherTabsAction.Descriptor(), CloseOtherTabsAction::new);
    registerAction(new CloseWindowAction.Descriptor(), CloseWindowAction::new);
    registerAction(new CloseTabAction.Descriptor(), CloseTabAction::new);
    // registerAction(new CommandAction.Descriptor(),           		     new CommandAction::new);
    registerAction(new CompareFoldersAction.Descriptor(), CompareFoldersAction::new);
    registerAction(new ConnectToServerAction.Descriptor(), ConnectToServerAction::new);
    registerAction(new CopyAction.Descriptor(), CopyAction::new);
    registerAction(new CopyFileBaseNamesAction.Descriptor(), CopyFileBaseNamesAction::new);
    registerAction(new CopyFileNamesAction.Descriptor(), CopyFileNamesAction::new);
    registerAction(new CopyFilePathsAction.Descriptor(), CopyFilePathsAction::new);
    registerAction(new CopyFilesToClipboardAction.Descriptor(), CopyFilesToClipboardAction::new);
    registerAction(new FindAction.Descriptor(), FindAction::new);
    registerAction(new FocusPreviousAction.Descriptor(), FocusPreviousAction::new);
    registerAction(new FocusNextAction.Descriptor(), FocusNextAction::new);
    registerAction(new DeleteAction.Descriptor(), DeleteAction::new);
    registerAction(new DonateAction.Descriptor(), DonateAction::new);
    registerAction(new DuplicateTabAction.Descriptor(), DuplicateTabAction::new);
    registerAction(new EditAction.Descriptor(), EditAction::new);
    registerAction(new EditBookmarksAction.Descriptor(), EditBookmarksAction::new);
    registerAction(new EditCredentialsAction.Descriptor(), EditCredentialsAction::new);
    registerAction(new EmailAction.Descriptor(), EmailAction::new);
    registerAction(new EmptyTrashAction.Descriptor(), EmptyTrashAction::new);
    registerAction(new ExploreBookmarksAction.Descriptor(), ExploreBookmarksAction::new);
    // registerAction(new GarbageCollectAction.Descriptor(),               GarbageCollectAction::new);
    registerAction(new GoBackAction.Descriptor(), GoBackAction::new);
    registerAction(new GoForwardAction.Descriptor(), GoForwardAction::new);
    registerAction(new GoToDocumentationAction.Descriptor(), GoToDocumentationAction::new);
    registerAction(new GoToForumsAction.Descriptor(), GoToForumsAction::new);
    registerAction(new GoToHomeAction.Descriptor(), GoToHomeAction::new);
    registerAction(new GoToParentAction.Descriptor(), GoToParentAction::new);
    registerAction(new GoToParentInBothPanelsAction.Descriptor(), GoToParentInBothPanelsAction::new);
    registerAction(new GoToParentInOtherPanelAction.Descriptor(), GoToParentInOtherPanelAction::new);
    registerAction(new GoToRootAction.Descriptor(), GoToRootAction::new);
    registerAction(new GoToWebsiteAction.Descriptor(), GoToWebsiteAction::new);
    registerAction(new InternalEditAction.Descriptor(), InternalEditAction::new);
    registerAction(new InternalViewAction.Descriptor(), InternalViewAction::new);
    registerAction(new InvertSelectionAction.Descriptor(), InvertSelectionAction::new);
    registerAction(new LocalCopyAction.Descriptor(), LocalCopyAction::new);
    registerAction(new MarkAllAction.Descriptor(), MarkAllAction::new);
    registerAction(new MarkExtensionAction.Descriptor(), MarkExtensionAction::new);
    registerAction(new MarkGroupAction.Descriptor(), MarkGroupAction::new);
    registerAction(new MarkNextBlockAction.Descriptor(), MarkNextBlockAction::new);
    registerAction(new MarkNextPageAction.Descriptor(), MarkNextPageAction::new);
    registerAction(new MarkNextRowAction.Descriptor(), MarkNextRowAction::new);
    registerAction(new MarkPreviousBlockAction.Descriptor(), MarkPreviousBlockAction::new);
    registerAction(new MarkPreviousPageAction.Descriptor(), MarkPreviousPageAction::new);
    registerAction(new MarkPreviousRowAction.Descriptor(), MarkPreviousRowAction::new);
    registerAction(new MarkSelectedFileAction.Descriptor(), MarkSelectedFileAction::new);
    registerAction(new MarkToFirstRowAction.Descriptor(), MarkToFirstRowAction::new);
    registerAction(new MarkToLastRowAction.Descriptor(), MarkToLastRowAction::new);
    registerAction(new MaximizeWindowAction.Descriptor(), MaximizeWindowAction::new);
    registerAction(new CombineFilesAction.Descriptor(), CombineFilesAction::new);
    registerAction(new MinimizeWindowAction.Descriptor(), MinimizeWindowAction::new);
    registerAction(new MkdirAction.Descriptor(), MkdirAction::new);
    registerAction(new MkfileAction.Descriptor(), MkfileAction::new);
    registerAction(new MoveAction.Descriptor(), MoveAction::new);
    registerAction(new MoveTabToOtherPanelAction.Descriptor(), MoveTabToOtherPanelAction::new);
    registerAction(new NewWindowAction.Descriptor(), NewWindowAction::new);
    registerAction(new NextTabAction.Descriptor(), NextTabAction::new);
    registerAction(new OpenAction.Descriptor(), OpenAction::new);
    registerAction(new OpenAsAction.Descriptor(), OpenAsAction::new);
    registerAction(new OpenCommandPromptAction.Descriptor(), OpenCommandPromptAction::new);
    registerAction(new OpenInBothPanelsAction.Descriptor(), OpenInBothPanelsAction::new);
    registerAction(new OpenInNewTabAction.Descriptor(), OpenInNewTabAction::new);
    registerAction(new OpenInOtherPanelAction.Descriptor(), OpenInOtherPanelAction::new);
    // registerAction(new OpenLocationAction.Descriptor(),          	    OpenLocationAction::new);
    registerAction(new OpenNativelyAction.Descriptor(), OpenNativelyAction::new);
    registerAction(new OpenTrashAction.Descriptor(), OpenTrashAction::new);
    registerAction(new OpenURLInBrowserAction.Descriptor(), OpenURLInBrowserAction::new);
    registerAction(new PackAction.Descriptor(), PackAction::new);
    registerAction(new PasteClipboardFilesAction.Descriptor(), PasteClipboardFilesAction::new);
    registerAction(new PermanentDeleteAction.Descriptor(), PermanentDeleteAction::new);
    registerAction(new PopupLeftDriveButtonAction.Descriptor(), PopupLeftDriveButtonAction::new);
    registerAction(new PopupRightDriveButtonAction.Descriptor(), PopupRightDriveButtonAction::new);
    registerAction(new PreviousTabAction.Descriptor(), PreviousTabAction::new);
    registerAction(new QuickFindAction.Descriptor(), QuickFindAction::new);
    registerAction(new QuitAction.Descriptor(), QuitAction::new);
    registerAction(new RecallNextWindowAction.Descriptor(), RecallNextWindowAction::new);
    registerAction(new RecallPreviousWindowAction.Descriptor(), RecallPreviousWindowAction::new);
    registerAction(new RecallWindow10Action.Descriptor(), RecallWindow10Action::new);
    registerAction(new RecallWindow1Action.Descriptor(), RecallWindow1Action::new);
    registerAction(new RecallWindow2Action.Descriptor(), RecallWindow2Action::new);
    registerAction(new RecallWindow3Action.Descriptor(), RecallWindow3Action::new);
    registerAction(new RecallWindow4Action.Descriptor(), RecallWindow4Action::new);
    registerAction(new RecallWindow5Action.Descriptor(), RecallWindow5Action::new);
    registerAction(new RecallWindow6Action.Descriptor(), RecallWindow6Action::new);
    registerAction(new RecallWindow7Action.Descriptor(), RecallWindow7Action::new);
    registerAction(new RecallWindow8Action.Descriptor(), RecallWindow8Action::new);
    registerAction(new RecallWindow9Action.Descriptor(), RecallWindow9Action::new);
    registerAction(new RecallWindowAction.Descriptor(), RecallWindowAction::new);
    registerAction(new RefreshAction.Descriptor(), RefreshAction::new);
    registerAction(new RenameAction.Descriptor(), RenameAction::new);
    registerAction(new ReportBugAction.Descriptor(), ReportBugAction::new);
    registerAction(new RevealInDesktopAction.Descriptor(), RevealInDesktopAction::new);
    registerAction(new ReverseSortOrderAction.Descriptor(), ReverseSortOrderAction::new);
    registerAction(new RunCommandAction.Descriptor(), RunCommandAction::new);
    registerAction(new ShowInEnclosingFolderAction.Descriptor(), ShowInEnclosingFolderAction::new);
    registerAction(new SelectPreviousBlockAction.Descriptor(), SelectPreviousBlockAction::new);
    registerAction(new SelectPreviousPageAction.Descriptor(), SelectPreviousPageAction::new);
    registerAction(new SelectPreviousRowAction.Descriptor(), SelectPreviousRowAction::new);
    registerAction(new SelectNextBlockAction.Descriptor(), SelectNextBlockAction::new);
    registerAction(new SelectNextPageAction.Descriptor(), SelectNextPageAction::new);
    registerAction(new SelectNextRowAction.Descriptor(), SelectNextRowAction::new);
    registerAction(new SelectFirstRowAction.Descriptor(), SelectFirstRowAction::new);
    registerAction(new SelectLastRowAction.Descriptor(), SelectLastRowAction::new);
    registerAction(new SetSameFolderAction.Descriptor(), SetSameFolderAction::new);
    registerAction(new SetTabTitleAction.Descriptor(), SetTabTitleAction::new);
    registerAction(new ShowAboutAction.Descriptor(), ShowAboutAction::new);
    registerAction(new ShowBookmarksQLAction.Descriptor(), ShowBookmarksQLAction::new);
    registerAction(new CustomizeCommandBarAction.Descriptor(), CustomizeCommandBarAction::new);
    registerAction(new ShowDebugConsoleAction.Descriptor(), ShowDebugConsoleAction::new);
    registerAction(new ShowFilePropertiesAction.Descriptor(), ShowFilePropertiesAction::new);
    registerAction(new ShowFilePopupMenuAction.Descriptor(), ShowFilePopupMenuAction::new);
    registerAction(new ShowKeyboardShortcutsAction.Descriptor(), ShowKeyboardShortcutsAction::new);
    registerAction(new ShowParentFoldersQLAction.Descriptor(), ShowParentFoldersQLAction::new);
    registerAction(new ShowPreferencesAction.Descriptor(), ShowPreferencesAction::new);
    registerAction(new ShowRecentExecutedFilesQLAction.Descriptor(), ShowRecentExecutedFilesQLAction::new);
    registerAction(new ShowRecentLocationsQLAction.Descriptor(), ShowRecentLocationsQLAction::new);
    registerAction(new ShowRootFoldersQLAction.Descriptor(), ShowRootFoldersQLAction::new);
    registerAction(new ShowServerConnectionsAction.Descriptor(), ShowServerConnectionsAction::new);
    registerAction(new ShowTabsQLAction.Descriptor(), ShowTabsQLAction::new);
    registerAction(new SortByDateAction.Descriptor(), SortByDateAction::new);
    registerAction(new SortByExtensionAction.Descriptor(), SortByExtensionAction::new);
    registerAction(new SortByGroupAction.Descriptor(), SortByGroupAction::new);
    registerAction(new SortByNameAction.Descriptor(), SortByNameAction::new);
    registerAction(new SortByOwnerAction.Descriptor(), SortByOwnerAction::new);
    registerAction(new SortByPermissionsAction.Descriptor(), SortByPermissionsAction::new);
    registerAction(new SortBySizeAction.Descriptor(), SortBySizeAction::new);
    registerAction(new SplitEquallyAction.Descriptor(), SplitEquallyAction::new);
    registerAction(new SplitFileAction.Descriptor(), SplitFileAction::new);
    registerAction(new SplitHorizontallyAction.Descriptor(), SplitHorizontallyAction::new);
    registerAction(new SplitVerticallyAction.Descriptor(), SplitVerticallyAction::new);
    registerAction(new ToggleUseSinglePanelAction.Descriptor(), ToggleUseSinglePanelAction::new);
    registerAction(new StopAction.Descriptor(), StopAction::new);
    registerAction(new SwapFoldersAction.Descriptor(), SwapFoldersAction::new);
    registerAction(new SwitchActiveTableAction.Descriptor(), SwitchActiveTableAction::new);
    registerAction(new ToggleAutoSizeAction.Descriptor(), ToggleAutoSizeAction::new);
    // registerAction(new ToggleColumnAction.Descriptor(),           	    ToggleColumnAction::new);
    registerAction(new ToggleCommandBarAction.Descriptor(), ToggleCommandBarAction::new);
    registerAction(new ToggleDateColumnAction.Descriptor(), ToggleDateColumnAction::new);
    registerAction(new ToggleExtensionColumnAction.Descriptor(), ToggleExtensionColumnAction::new);
    registerAction(new ToggleGroupColumnAction.Descriptor(), ToggleGroupColumnAction::new);
    registerAction(new ToggleHiddenFilesAction.Descriptor(), ToggleHiddenFilesAction::new);
    registerAction(new ToggleLockTabAction.Descriptor(), ToggleLockTabAction::new);
    registerAction(new ToggleOwnerColumnAction.Descriptor(), ToggleOwnerColumnAction::new);
    registerAction(new TogglePermissionsColumnAction.Descriptor(), TogglePermissionsColumnAction::new);
    registerAction(new ToggleShowFoldersFirstAction.Descriptor(), ToggleShowFoldersFirstAction::new);
    registerAction(new ToggleSizeColumnAction.Descriptor(), ToggleSizeColumnAction::new);
    registerAction(new ToggleStatusBarAction.Descriptor(), ToggleStatusBarAction::new);
    registerAction(new ToggleToolBarAction.Descriptor(), ToggleToolBarAction::new);
    registerAction(new ToggleTreeAction.Descriptor(), ToggleTreeAction::new);
    registerAction(new UnmarkAllAction.Descriptor(), UnmarkAllAction::new);
    registerAction(new UnmarkGroupAction.Descriptor(), UnmarkGroupAction::new);
    registerAction(new UnpackAction.Descriptor(), UnpackAction::new);
    registerAction(new ViewAction.Descriptor(), ViewAction::new);
    // register "open with" commands as actions, to allow for keyboard shortcuts for them
    for (Command command : CommandManager.commands()) {
        if (command.getType() == CommandType.NORMAL_COMMAND) {
            ActionManager.registerAction(new CommandAction.Descriptor(command), (mainFrame, properties) -> new CommandAction(mainFrame, properties, command));
        }
    }
}
Also used : Command(com.mucommander.command.Command)

Example 2 with Command

use of com.mucommander.command.Command 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 Command

use of com.mucommander.command.Command in project mucommander by mucommander.

the class AbstractViewerAction method performAction.

// - AbstractAction implementation ---------------------------------------------------
// -----------------------------------------------------------------------------------
/**
 * Edits the currently selected file.
 */
@Override
public synchronized void performAction() {
    AbstractFile file;
    Command customCommand;
    file = mainFrame.getActiveTable().getSelectedFile(false, true);
    // viewer/editor implementations will decide whether they allow a particular file or not.
    if (file != null) {
        customCommand = getCustomCommand();
        // If we're using a custom command...
        if (customCommand != null) {
            // If it's local, run the custom editor on it.
            if (file.hasAncestor(LocalFile.class)) {
                try {
                    InformationDialog.showErrorDialogIfNeeded(getMainFrame(), ProcessRunner.executeAsync(customCommand.getTokens(file), file));
                } catch (Exception e) {
                    InformationDialog.showErrorDialog(mainFrame);
                }
            } else // If it's distant, copies it locally before running the custom editor on it.
            {
                ProgressDialog progressDialog = new ProgressDialog(mainFrame, Translator.get("copy_dialog.copying"));
                TempOpenWithJob job = new TempOpenWithJob(progressDialog, mainFrame, file, customCommand);
                progressDialog.start(job);
            }
        } else
            // If we're not using a custom editor, this action behaves exactly like its parent.
            performInternalAction(file);
    }
}
Also used : AbstractFile(com.mucommander.commons.file.AbstractFile) Command(com.mucommander.command.Command) ProgressDialog(com.mucommander.ui.dialog.file.ProgressDialog) TempOpenWithJob(com.mucommander.job.impl.TempOpenWithJob)

Example 4 with Command

use of com.mucommander.command.Command 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 5 with Command

use of com.mucommander.command.Command 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)

Aggregations

Command (com.mucommander.command.Command)8 CommandException (com.mucommander.command.CommandException)5 DesktopInitialisationException (com.mucommander.desktop.DesktopInitialisationException)4 AbstractFile (com.mucommander.commons.file.AbstractFile)2 FileFilter (com.mucommander.commons.file.filter.FileFilter)1 RegexpFilenameFilter (com.mucommander.commons.file.filter.RegexpFilenameFilter)1 TempOpenWithJob (com.mucommander.job.impl.TempOpenWithJob)1 ProgressDialog (com.mucommander.ui.dialog.file.ProgressDialog)1 OSXIntegration (com.mucommander.ui.macos.OSXIntegration)1