Search in sources :

Example 1 with AboutDialog

use of com.mucommander.ui.dialog.about.AboutDialog in project mucommander by mucommander.

the class Activator method createCoreService.

private CoreService createCoreService() {
    return new CoreService() {

        @Override
        public void showAbout() {
            MainFrame mainFrame = WindowManager.getCurrentMainFrame();
            // Do nothing (return) when in 'no events mode'
            if (mainFrame.getNoEventsMode())
                return;
            new AboutDialog(mainFrame).showDialog();
        }

        @Override
        public void showPreferences() {
            MainFrame mainFrame = WindowManager.getCurrentMainFrame();
            // Do nothing (return) when in 'no events mode'
            if (mainFrame.getNoEventsMode())
                return;
            ActionManager.performAction(com.mucommander.ui.action.impl.ShowPreferencesAction.Descriptor.ACTION_ID, mainFrame);
        }

        @Override
        public boolean doQuit() {
            // Ask the user for confirmation and abort if user refused to quit.
            if (!QuitDialog.confirmQuit())
                return false;
            // We got a green -> quit!
            Application.initiateShutdown();
            return true;
        }

        @Override
        public void openFile(String path) {
            // Wait until the application has been launched. This step is required to properly handle the case where the
            // application is launched with a file to open, for instance when drag-n-dropping a file to the Dock icon
            // when muCommander is not started yet. In this case, this method is called while Launcher is still busy
            // launching the application (no mainframe exists yet).
            Application.waitUntilLaunched();
            AbstractFile file = FileFactory.getFile(path);
            FolderPanel activePanel = WindowManager.getCurrentMainFrame().getActivePanel();
            if (file.isBrowsable())
                activePanel.tryChangeCurrentFolder(file);
            else
                activePanel.tryChangeCurrentFolder(file.getParent(), file, false);
        }
    };
}
Also used : AboutDialog(com.mucommander.ui.dialog.about.AboutDialog) AbstractFile(com.mucommander.commons.file.AbstractFile) CoreService(com.mucommander.os.api.CoreService) MainFrame(com.mucommander.ui.main.MainFrame) FolderPanel(com.mucommander.ui.main.FolderPanel)

Aggregations

AbstractFile (com.mucommander.commons.file.AbstractFile)1 CoreService (com.mucommander.os.api.CoreService)1 AboutDialog (com.mucommander.ui.dialog.about.AboutDialog)1 FolderPanel (com.mucommander.ui.main.FolderPanel)1 MainFrame (com.mucommander.ui.main.MainFrame)1