Search in sources :

Example 1 with IModeControllerExtensionProvider

use of org.freeplane.main.osgi.IModeControllerExtensionProvider in project freeplane by freeplane.

the class Activator method registerMindMapModeExtension.

private void registerMindMapModeExtension(final BundleContext context) {
    final Hashtable<String, String[]> props = new Hashtable<String, String[]>();
    props.put("mode", new String[] { MModeController.MODENAME, SModeController.MODENAME });
    context.registerService(IModeControllerExtensionProvider.class.getName(), new IModeControllerExtensionProvider() {

        public void installExtension(final ModeController modeController) {
            // LattexNodeHook -> Menu insert
            final LatexNodeHook nodeHook = new LatexNodeHook();
            // 
            modeController.getExtension(TextController.class).addTextTransformer(new ConditionalContentTransformer(new LatexRenderer(), Activator.TOGGLE_PARSE_LATEX));
            modeController.getController().getExtension(FormatController.class).addPatternFormat(new LatexFormat());
            modeController.getController().getExtension(FormatController.class).addPatternFormat(new UnparsedLatexFormat());
            if (modeController.getModeName().equals("MindMap")) {
                modeController.addAction(new InsertLatexAction(nodeHook));
                modeController.addAction(new EditLatexAction(nodeHook));
                modeController.addAction(new DeleteLatexAction(nodeHook));
                addPreferencesToOptionPanel();
            }
        }

        private void addPreferencesToOptionPanel() {
            final URL preferences = this.getClass().getResource(PREFERENCES_RESOURCE);
            if (preferences == null)
                throw new RuntimeException("cannot open preferences");
            final Controller controller = Controller.getCurrentController();
            MModeController modeController = (MModeController) controller.getModeController();
            modeController.getOptionPanelBuilder().load(preferences);
        }
    }, props);
}
Also used : Hashtable(java.util.Hashtable) SModeController(org.freeplane.main.mindmapmode.stylemode.SModeController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) ModeController(org.freeplane.features.mode.ModeController) IModeControllerExtensionProvider(org.freeplane.main.osgi.IModeControllerExtensionProvider) SModeController(org.freeplane.main.mindmapmode.stylemode.SModeController) Controller(org.freeplane.features.mode.Controller) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) TextController(org.freeplane.features.text.TextController) ModeController(org.freeplane.features.mode.ModeController) FormatController(org.freeplane.features.format.FormatController) URL(java.net.URL) ConditionalContentTransformer(org.freeplane.features.text.mindmapmode.ConditionalContentTransformer) MModeController(org.freeplane.features.mode.mindmapmode.MModeController)

Example 2 with IModeControllerExtensionProvider

use of org.freeplane.main.osgi.IModeControllerExtensionProvider in project freeplane by freeplane.

the class Activator method start.

/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
	 */
public void start(final BundleContext context) throws Exception {
    final Hashtable<String, String[]> props = new Hashtable<String, String[]>();
    props.put("mode", new String[] { MModeController.MODENAME });
    context.registerService(IModeControllerExtensionProvider.class.getName(), new IModeControllerExtensionProvider() {

        public void installExtension(ModeController modeController) {
            new ScriptingRegistration(modeController);
        }
    }, props);
}
Also used : Hashtable(java.util.Hashtable) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) ModeController(org.freeplane.features.mode.ModeController) IModeControllerExtensionProvider(org.freeplane.main.osgi.IModeControllerExtensionProvider)

Example 3 with IModeControllerExtensionProvider

use of org.freeplane.main.osgi.IModeControllerExtensionProvider in project freeplane by freeplane.

the class Activator method registerMindMapModeExtension.

private void registerMindMapModeExtension(final BundleContext context) {
    final Hashtable<String, String[]> props = new Hashtable<String, String[]>();
    props.put("mode", new String[] { MModeController.MODENAME });
    context.registerService(IModeControllerExtensionProvider.class.getName(), new IModeControllerExtensionProvider() {

        public void installExtension(ModeController modeController) {
            final ExportController exportController = ExportController.getController(modeController);
            exportController.addExportEngine(new ExampleFileFilter("pdf", TextUtils.getText("export_pdf_text")), new ExportPdf());
            exportController.addExportEngine(new ExampleFileFilter("svg", TextUtils.getText("export_svg_text")), new ExportSvg());
            final ViewerController extension = (ViewerController) modeController.getExtension(ViewerController.class);
            extension.addFactory(new SvgViewerFactory());
        }
    }, props);
}
Also used : Hashtable(java.util.Hashtable) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) ModeController(org.freeplane.features.mode.ModeController) ViewerController(org.freeplane.view.swing.features.filepreview.ViewerController) IModeControllerExtensionProvider(org.freeplane.main.osgi.IModeControllerExtensionProvider) ExampleFileFilter(org.freeplane.core.ui.ExampleFileFilter) ExportController(org.freeplane.features.export.mindmapmode.ExportController)

Example 4 with IModeControllerExtensionProvider

use of org.freeplane.main.osgi.IModeControllerExtensionProvider in project freeplane by freeplane.

the class Activator method start.

/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
	 */
public void start(final BundleContext context) throws Exception {
    final Hashtable<String, String[]> props = new Hashtable<String, String[]>();
    props.put("mode", new String[] { MModeController.MODENAME });
    context.registerService(IModeControllerExtensionProvider.class.getName(), new IModeControllerExtensionProvider() {

        public void installExtension(ModeController modeController) {
            if (!modeController.getController().getViewController().isHeadless())
                initJSyntaxPane(context);
        // new ScriptingRegistration(modeController);
        }
    }, props);
}
Also used : Hashtable(java.util.Hashtable) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) ModeController(org.freeplane.features.mode.ModeController) IModeControllerExtensionProvider(org.freeplane.main.osgi.IModeControllerExtensionProvider)

Aggregations

Hashtable (java.util.Hashtable)4 ModeController (org.freeplane.features.mode.ModeController)4 MModeController (org.freeplane.features.mode.mindmapmode.MModeController)4 IModeControllerExtensionProvider (org.freeplane.main.osgi.IModeControllerExtensionProvider)4 URL (java.net.URL)1 ExampleFileFilter (org.freeplane.core.ui.ExampleFileFilter)1 ExportController (org.freeplane.features.export.mindmapmode.ExportController)1 FormatController (org.freeplane.features.format.FormatController)1 Controller (org.freeplane.features.mode.Controller)1 TextController (org.freeplane.features.text.TextController)1 ConditionalContentTransformer (org.freeplane.features.text.mindmapmode.ConditionalContentTransformer)1 SModeController (org.freeplane.main.mindmapmode.stylemode.SModeController)1 ViewerController (org.freeplane.view.swing.features.filepreview.ViewerController)1