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;
}
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);
}
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;
}
Aggregations