/** * ********************************************************************************* METHODS * ******************************************************************************** */ public static void convertAnnotations(MapModel map) throws IOException { if (map == null) { throw new IllegalArgumentException("NULL"); } DocearFileBackupController.createBackupForConversion(map); synchronized (currentHandler) { currentHandler.convert(map); LogUtils.info("converted annotations for " + map.getTitle() + " - " + map.getFile()); } }
private void updateList(final MapModel map, final String restoreString) { // ignore documentation maps loaded using documentation actions if (map.containsExtension(DocuMapAttribute.class)) return; if (restoreString != null) { if (lastOpenedList.contains(restoreString)) { lastOpenedList.remove(restoreString); } lastOpenedList.add(0, restoreString); mRestorableToMapName.put(restoreString, map.getTitle()); } updateMenus(); }
public String getRestoreable(final MapModel map) { if (map == null) { return null; } // ignore documentation maps loaded using documentation actions if (map.containsExtension(DocuMapAttribute.class)) return null; final ModeController modeController = Controller.getCurrentModeController(); if (!modeController.getModeName().equals(MModeController.MODENAME)) { return null; } final File file = map.getFile(); return getRestorable(file); }
public Object transformContent(Object content, MapModel map) { if (!(content instanceof URI)) return content; final String string = content.toString(); if (!string.startsWith("#")) return content; final String nodeID = string.substring(1); final NodeModel target = map.getNodeForID(nodeID); if (target != null) { final String shortText = TextController.getController(modeController).getShortPlainText(target); final Icon icon = FrameController.localLinkIcon; return new ObjectAndIcon(shortText, icon); } else return content; }
/** * ********************************************************************************* REQUIRED * METHODS FOR INTERFACES * ******************************************************************************** */ public void onCreate(MapModel map) { if (DocearRequiredConversionController.hasRequiredConversion( ConvertAnnotationsExtension.class, map)) { try { if (map instanceof MMapModel) { MMapModel mmap = (MMapModel) map; if (mmap.getTimerForAutomaticSaving() != null) { mmap.getTimerForAutomaticSaving().cancel(); } } convertAnnotations(map); MMapIO mio = (MMapIO) Controller.getCurrentModeController().getExtension(MapIO.class); mio.writeToFile(map, map.getFile()); if (map instanceof MMapModel) { MMapModel mmap = (MMapModel) map; mmap.scheduleTimerForAutomaticSaving(); } } catch (IOException e) { LogUtils.warn(e); } } }
public boolean updateMindmap(MapModel map) { return updateNodesRecursive(map.getRootNode()); }