use of org.freeplane.features.text.mindmapmode.ConditionalContentTransformer 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);
}
Aggregations