Search in sources :

Example 1 with CoreService

use of com.mucommander.os.api.CoreService in project mucommander by mucommander.

the class CoreServiceTracker method addingService.

@Override
public CoreService addingService(ServiceReference<CoreService> reference) {
    CoreService service = super.addingService(reference);
    CoreServiceTracker.service = service;
    LOGGER.info("CoreService is registered: " + service);
    return service;
}
Also used : CoreService(com.mucommander.os.api.CoreService)

Example 2 with CoreService

use of com.mucommander.os.api.CoreService 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)

Example 3 with CoreService

use of com.mucommander.os.api.CoreService in project mucommander by mucommander.

the class Activator method start.

@Override
public void start(BundleContext context) throws Exception {
    LOGGER.debug("starting");
    this.context = context;
    // Register the application-specific 'bookmark' protocol.
    FileProtocolService bookmarksService = createBookmarkProtocolService();
    bookmarksRegistration = context.registerService(FileProtocolService.class, bookmarksService, null);
    // Listen to protocol panel services
    protocolPanelTracker = new ProtocolPanelProviderTracker(context);
    protocolPanelTracker.open();
    // Listen to translation service
    translationTracker = new TranslationTracker(context);
    translationTracker.open();
    // Listen to file viewer services
    viewersTracker = new FileViewerServiceTracker(context);
    viewersTracker.open();
    // Listen to file editor services
    editorsTracker = new FileEditorServiceTracker(context);
    editorsTracker.open();
    // Listen to operating system services
    osTracker = new OperatingSystemServiceTracker(context);
    osTracker.open();
    // Register core functionality service
    CoreService coreService = createCoreService();
    coreRegistration = context.registerService(CoreService.class, coreService, null);
    // Traps VM shutdown
    Runtime.getRuntime().addShutdownHook(shutdownHook = new ShutdownHook());
    Application.run(this);
}
Also used : ProtocolPanelProviderTracker(com.mucommander.ui.main.osgi.ProtocolPanelProviderTracker) FileEditorServiceTracker(com.mucommander.osgi.FileEditorServiceTracker) FileViewerServiceTracker(com.mucommander.osgi.FileViewerServiceTracker) TranslationTracker(com.mucommander.text.TranslationTracker) CoreService(com.mucommander.os.api.CoreService) OperatingSystemServiceTracker(com.mucommander.osgi.OperatingSystemServiceTracker) FileProtocolService(com.mucommander.commons.file.osgi.FileProtocolService)

Aggregations

CoreService (com.mucommander.os.api.CoreService)3 AbstractFile (com.mucommander.commons.file.AbstractFile)1 FileProtocolService (com.mucommander.commons.file.osgi.FileProtocolService)1 FileEditorServiceTracker (com.mucommander.osgi.FileEditorServiceTracker)1 FileViewerServiceTracker (com.mucommander.osgi.FileViewerServiceTracker)1 OperatingSystemServiceTracker (com.mucommander.osgi.OperatingSystemServiceTracker)1 TranslationTracker (com.mucommander.text.TranslationTracker)1 AboutDialog (com.mucommander.ui.dialog.about.AboutDialog)1 FolderPanel (com.mucommander.ui.main.FolderPanel)1 MainFrame (com.mucommander.ui.main.MainFrame)1 ProtocolPanelProviderTracker (com.mucommander.ui.main.osgi.ProtocolPanelProviderTracker)1