use of org.freeplane.features.url.mindmapmode.MFileManager in project freeplane by freeplane.
the class SHTMLSetLinkByFileChooserAction method setLinkByFileChooser.
public void setLinkByFileChooser() {
final URI relative = ((MFileManager) UrlManager.getController()).getLinkByFileChooser(Controller.getCurrentController().getMap());
if (relative != null) {
SHTMLEditorPane editor = panel.getSHTMLEditorPane();
editor.setLink(null, relative.toString(), null);
}
}
use of org.freeplane.features.url.mindmapmode.MFileManager in project freeplane by freeplane.
the class MMapController method close.
public boolean close(final MapModel map) {
if (!map.isSaved()) {
Controller.getCurrentController().getMapViewManager().changeToMap(map);
final String text = TextUtils.getText("save_unsaved") + "\n" + map.getTitle();
final String title = TextUtils.getText("SaveAction.text");
Component dialogParent;
final Frame viewFrame = UITools.getCurrentFrame();
if (viewFrame != null && viewFrame.isShowing() && viewFrame.getExtendedState() != Frame.ICONIFIED)
dialogParent = viewFrame;
else
dialogParent = UITools.getCurrentRootComponent();
final int returnVal = JOptionPane.showOptionDialog(dialogParent, text, title, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
if (returnVal == JOptionPane.YES_OPTION) {
final boolean savingNotCancelled = ((MFileManager) getModeController().getExtension(UrlManager.class)).save(map);
if (!savingNotCancelled) {
return false;
}
} else if ((returnVal == JOptionPane.CANCEL_OPTION) || (returnVal == JOptionPane.CLOSED_OPTION)) {
return false;
}
}
closeWithoutSaving(map);
return true;
}
use of org.freeplane.features.url.mindmapmode.MFileManager in project freeplane by freeplane.
the class MMapController method restoreCurrentMap.
/**
*@throws XMLException
* @deprecated -- use MMapIO
*/
@Deprecated
public boolean restoreCurrentMap() throws FileNotFoundException, IOException, URISyntaxException, XMLException {
final Controller controller = Controller.getCurrentController();
final MapModel map = controller.getMap();
final URL url = map.getURL();
if (url == null) {
UITools.errorMessage(TextUtils.getText("map_not_saved"));
return false;
}
if (map.containsExtension(DocuMapAttribute.class)) {
closeWithoutSaving(map);
return newDocumentationMap(url);
}
final URL alternativeURL = MFileManager.getController(getMModeController()).getAlternativeURL(url, AlternativeFileMode.ALL);
if (alternativeURL == null)
return false;
controller.getViewController().setWaitingCursor(true);
try {
final MapModel newModel = new MMapModel();
((MFileManager) MFileManager.getController()).loadAndLock(alternativeURL, newModel);
newModel.setURL(url);
newModel.setSaved(alternativeURL.equals(url));
fireMapCreated(newModel);
closeWithoutSaving(map);
newMapView(newModel);
return true;
} finally {
controller.getViewController().setWaitingCursor(false);
}
}
use of org.freeplane.features.url.mindmapmode.MFileManager in project freeplane by freeplane.
the class MMapModel method scheduleTimerForAutomaticSaving.
public void scheduleTimerForAutomaticSaving() {
if (!(UrlManager.getController() instanceof MFileManager)) {
return;
}
final int numberOfTempFiles = Integer.parseInt(ResourceController.getResourceController().getProperty("number_of_different_files_for_automatic_save"));
if (numberOfTempFiles == 0) {
return;
}
final boolean filesShouldBeDeletedAfterShutdown = ResourceController.getResourceController().getBooleanProperty("delete_automatic_saves_at_exit");
final int delay = ResourceController.getResourceController().getTimeProperty("time_for_automatic_save");
if (delay == 0) {
return;
}
final boolean useSingleBackupDirectory = ResourceController.getResourceController().getBooleanProperty("single_backup_directory");
final String singleBackupDirectory = ResourceController.getResourceController().getProperty("single_backup_directory_path");
final Timer timer = SysUtils.createTimer("TimerForAutomaticSaving");
timer.schedule(new DoAutomaticSave(this, numberOfTempFiles, filesShouldBeDeletedAfterShutdown, useSingleBackupDirectory, singleBackupDirectory), delay, delay);
this.setTimerForAutomaticSaving(timer);
}
use of org.freeplane.features.url.mindmapmode.MFileManager in project freeplane by freeplane.
the class HeadlessMModeControllerFactory method createStandardControllers.
private void createStandardControllers() {
final Controller controller = Controller.getCurrentController();
modeController = new MModeController(controller);
modeController.setUserInputListenerFactory(new UserInputListenerFactory(modeController));
controller.addModeController(modeController);
controller.selectModeForBuild(modeController);
new MMapController(modeController);
final MFileManager fileManager = new MFileManager();
UrlManager.install(fileManager);
MMapIO.install(modeController);
controller.getMapViewManager().addMapViewChangeListener(fileManager);
new MIconController(modeController).install(modeController);
new ProgressFactory().installActions(modeController);
EdgeController.install(new MEdgeController(modeController));
CloudController.install(new MCloudController(modeController));
NoteController.install(new MNoteController(modeController));
new MTextController(modeController).install(modeController);
LinkController.install(new MLinkController(modeController));
NodeStyleController.install(new MNodeStyleController(modeController));
ClipboardController.install(new MClipboardController());
LocationController.install(new MLocationController());
final MLogicalStyleController logicalStyleController = new MLogicalStyleController(modeController);
LogicalStyleController.install(logicalStyleController);
logicalStyleController.initM();
AttributeController.install(new MAttributeController(modeController));
modeController.addAction(new EditAttributesAction());
SpellCheckerController.install(modeController);
ExportController.install(new ExportController("/xml/ExportWithXSLT.xml"));
MapStyle.install(true);
new RevisionPlugin();
FoldingController.install(new FoldingController());
}
Aggregations