Search in sources :

Example 1 with MFileManager

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);
    }
}
Also used : SHTMLEditorPane(com.lightdev.app.shtm.SHTMLEditorPane) MFileManager(org.freeplane.features.url.mindmapmode.MFileManager) URI(java.net.URI)

Example 2 with MFileManager

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;
}
Also used : Frame(java.awt.Frame) UrlManager(org.freeplane.features.url.UrlManager) MFileManager(org.freeplane.features.url.mindmapmode.MFileManager) Component(java.awt.Component) Point(java.awt.Point)

Example 3 with MFileManager

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);
    }
}
Also used : MFileManager(org.freeplane.features.url.mindmapmode.MFileManager) MapModel(org.freeplane.features.map.MapModel) MLogicalStyleController(org.freeplane.features.styles.mindmapmode.MLogicalStyleController) MTextController(org.freeplane.features.text.mindmapmode.MTextController) MapController(org.freeplane.features.map.MapController) Controller(org.freeplane.features.mode.Controller) TextController(org.freeplane.features.text.TextController) MLinkController(org.freeplane.features.link.mindmapmode.MLinkController) ClipboardController(org.freeplane.features.clipboard.ClipboardController) AddOnsController(org.freeplane.main.addons.AddOnsController) ResourceController(org.freeplane.core.resources.ResourceController) ViewController(org.freeplane.features.ui.ViewController) ModeController(org.freeplane.features.mode.ModeController) MLocationController(org.freeplane.features.nodelocation.mindmapmode.MLocationController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) URL(java.net.URL)

Example 4 with MFileManager

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);
}
Also used : Timer(java.util.Timer) MFileManager(org.freeplane.features.url.mindmapmode.MFileManager) DoAutomaticSave(org.freeplane.features.url.mindmapmode.DoAutomaticSave)

Example 5 with MFileManager

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());
}
Also used : MCloudController(org.freeplane.features.cloud.mindmapmode.MCloudController) MAttributeController(org.freeplane.features.attribute.mindmapmode.MAttributeController) MLocationController(org.freeplane.features.nodelocation.mindmapmode.MLocationController) ProgressFactory(org.freeplane.view.swing.features.progress.mindmapmode.ProgressFactory) MIconController(org.freeplane.features.icon.mindmapmode.MIconController) MMapController(org.freeplane.features.map.mindmapmode.MMapController) UserInputListenerFactory(org.freeplane.view.swing.ui.UserInputListenerFactory) MFileManager(org.freeplane.features.url.mindmapmode.MFileManager) EditAttributesAction(org.freeplane.view.swing.map.attribute.EditAttributesAction) AttributeController(org.freeplane.features.attribute.AttributeController) MNoteController(org.freeplane.features.note.mindmapmode.MNoteController) MEdgeController(org.freeplane.features.edge.mindmapmode.MEdgeController) MLogicalStyleController(org.freeplane.features.styles.mindmapmode.MLogicalStyleController) ViewerController(org.freeplane.view.swing.features.filepreview.ViewerController) ClipboardController(org.freeplane.features.clipboard.ClipboardController) NoteController(org.freeplane.features.note.NoteController) MTextController(org.freeplane.features.text.mindmapmode.MTextController) MEncryptionController(org.freeplane.features.encrypt.mindmapmode.MEncryptionController) ExportController(org.freeplane.features.export.mindmapmode.ExportController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) EdgeController(org.freeplane.features.edge.EdgeController) ChangeNodeLevelController(org.freeplane.features.map.mindmapmode.ChangeNodeLevelController) MMapController(org.freeplane.features.map.mindmapmode.MMapController) MAttributeController(org.freeplane.features.attribute.mindmapmode.MAttributeController) CloudController(org.freeplane.features.cloud.CloudController) LinkController(org.freeplane.features.link.LinkController) MCloudController(org.freeplane.features.cloud.mindmapmode.MCloudController) LocationController(org.freeplane.features.nodelocation.LocationController) MIconController(org.freeplane.features.icon.mindmapmode.MIconController) FoldingController(org.freeplane.features.map.FoldingController) Controller(org.freeplane.features.mode.Controller) MLocationController(org.freeplane.features.nodelocation.mindmapmode.MLocationController) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) MLinkController(org.freeplane.features.link.mindmapmode.MLinkController) AutomaticLayoutController(org.freeplane.features.styles.AutomaticLayoutController) MClipboardController(org.freeplane.features.clipboard.mindmapmode.MClipboardController) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) SpellCheckerController(org.freeplane.features.spellchecker.mindmapmode.SpellCheckerController) MNoteController(org.freeplane.features.note.mindmapmode.MNoteController) FoldingController(org.freeplane.features.map.FoldingController) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) MLinkController(org.freeplane.features.link.mindmapmode.MLinkController) MClipboardController(org.freeplane.features.clipboard.mindmapmode.MClipboardController) RevisionPlugin(org.freeplane.features.nodestyle.mindmapmode.RevisionPlugin) MTextController(org.freeplane.features.text.mindmapmode.MTextController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) MEdgeController(org.freeplane.features.edge.mindmapmode.MEdgeController) MLogicalStyleController(org.freeplane.features.styles.mindmapmode.MLogicalStyleController) ExportController(org.freeplane.features.export.mindmapmode.ExportController)

Aggregations

MFileManager (org.freeplane.features.url.mindmapmode.MFileManager)11 Controller (org.freeplane.features.mode.Controller)6 URL (java.net.URL)4 ResourceController (org.freeplane.core.resources.ResourceController)4 MLinkController (org.freeplane.features.link.mindmapmode.MLinkController)4 MMapController (org.freeplane.features.map.mindmapmode.MMapController)4 ModeController (org.freeplane.features.mode.ModeController)4 MModeController (org.freeplane.features.mode.mindmapmode.MModeController)4 MLocationController (org.freeplane.features.nodelocation.mindmapmode.MLocationController)4 MLogicalStyleController (org.freeplane.features.styles.mindmapmode.MLogicalStyleController)4 MTextController (org.freeplane.features.text.mindmapmode.MTextController)4 AttributeController (org.freeplane.features.attribute.AttributeController)3 MAttributeController (org.freeplane.features.attribute.mindmapmode.MAttributeController)3 ClipboardController (org.freeplane.features.clipboard.ClipboardController)3 CloudController (org.freeplane.features.cloud.CloudController)3 MCloudController (org.freeplane.features.cloud.mindmapmode.MCloudController)3 EdgeController (org.freeplane.features.edge.EdgeController)3 MEdgeController (org.freeplane.features.edge.mindmapmode.MEdgeController)3 MIconController (org.freeplane.features.icon.mindmapmode.MIconController)3 LinkController (org.freeplane.features.link.LinkController)3