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;
}
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);
}
};
}
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);
}
Aggregations