Search in sources :

Example 1 with WorkspaceMapModelExtension

use of org.freeplane.plugin.workspace.features.WorkspaceMapModelExtension in project freeplane by freeplane.

the class WorkspaceController method getMapModelExtension.

public static WorkspaceMapModelExtension getMapModelExtension(MapModel map, boolean createIfNotExists) {
    WorkspaceMapModelExtension wmme = map.getExtension(WorkspaceMapModelExtension.class);
    if (createIfNotExists && wmme == null) {
        wmme = new WorkspaceMapModelExtension();
        map.addExtension(WorkspaceMapModelExtension.class, wmme);
    }
    return wmme;
}
Also used : WorkspaceMapModelExtension(org.freeplane.plugin.workspace.features.WorkspaceMapModelExtension)

Example 2 with WorkspaceMapModelExtension

use of org.freeplane.plugin.workspace.features.WorkspaceMapModelExtension in project freeplane by freeplane.

the class MModeWorkspaceLinkController method setLink.

public void setLink(final NodeModel node, final URI argUri, final int linkType) {
    URI uri = argUri;
    int finalLinkType = linkType;
    if (linkType == LINK_RELATIVE_TO_PROJECT) {
        WorkspaceMapModelExtension mapExt = WorkspaceController.getMapModelExtension(node.getMap());
        if (mapExt != null && mapExt.getProject() != null) {
            uri = mapExt.getProject().getRelativeURI(argUri);
            if (uri == null) {
                uri = argUri;
            } else {
                finalLinkType = LINK_ABSOLUTE;
            }
        } else {
            if (node.getMap().getFile() != null) {
                finalLinkType = LINK_RELATIVE_TO_MINDMAP;
            } else {
                finalLinkType = LINK_ABSOLUTE;
            }
        }
    }
    super.setLink(node, uri, finalLinkType);
}
Also used : WorkspaceMapModelExtension(org.freeplane.plugin.workspace.features.WorkspaceMapModelExtension) URI(java.net.URI)

Example 3 with WorkspaceMapModelExtension

use of org.freeplane.plugin.workspace.features.WorkspaceMapModelExtension in project freeplane by freeplane.

the class WorkspaceController method addMapToProject.

public static AWorkspaceProject addMapToProject(MapModel map, AWorkspaceProject project, boolean overwrite) {
    if (map == null || project == null) {
        throw new IllegalArgumentException("NULL");
    }
    WorkspaceMapModelExtension wmme = getMapModelExtension(map);
    AWorkspaceProject oldProject = wmme.getProject();
    if (overwrite || oldProject == null) {
        wmme.setProject(project);
    }
    return oldProject;
}
Also used : AWorkspaceProject(org.freeplane.plugin.workspace.model.project.AWorkspaceProject) WorkspaceMapModelExtension(org.freeplane.plugin.workspace.features.WorkspaceMapModelExtension)

Aggregations

WorkspaceMapModelExtension (org.freeplane.plugin.workspace.features.WorkspaceMapModelExtension)3 URI (java.net.URI)1 AWorkspaceProject (org.freeplane.plugin.workspace.model.project.AWorkspaceProject)1