예제 #1
0
 /**
  * ********************************************************************************* 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());
   }
 }
예제 #2
0
 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();
 }
예제 #3
0
 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);
 }
예제 #4
0
 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;
 }
예제 #5
0
 /**
  * ********************************************************************************* 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);
     }
   }
 }
예제 #6
0
 public boolean updateMindmap(MapModel map) {
   return updateNodesRecursive(map.getRootNode());
 }