use of org.freeplane.plugin.workspace.model.project.AWorkspaceProject in project freeplane by freeplane.
the class WorkspaceProjectOpenLocationAction method actionPerformed.
public void actionPerformed(ActionEvent event) {
AWorkspaceProject project = WorkspaceController.getCurrentProject();
if (project == null) {
return;
}
openFolder(URIUtils.getAbsoluteFile(project.getProjectHome()));
}
use of org.freeplane.plugin.workspace.model.project.AWorkspaceProject in project freeplane by freeplane.
the class WorkspaceRemoveProjectAction method actionPerformed.
/**
*********************************************************************************
* REQUIRED METHODS FOR INTERFACES
*********************************************************************************
*/
public void actionPerformed(ActionEvent e) {
AWorkspaceProject project = WorkspaceController.getCurrentProject();
if (project == null) {
return;
}
// WORKSPACE - todo: dialog that asks for physical deletion as well
int option = JOptionPane.showConfirmDialog(UITools.getFrame(), TextUtils.format("workspace.action.node.remove.confirm.text", project.getModel().getRoot().getName()), TextUtils.getRawText("workspace.action.node.remove.confirm.title"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (option == JOptionPane.YES_OPTION) {
// AWorkspaceTreeNode targetNode = getNodeFromActionEvent(e);
WorkspaceModel model = WorkspaceController.getCurrentModel();
// model.removeProject(model.getProject(targetNode.getModel()));
model.removeProject(project);
model.getRoot().getModel().requestSave();
}
}
use of org.freeplane.plugin.workspace.model.project.AWorkspaceProject in project freeplane by freeplane.
the class WorkspaceModelExtensionWriterReader method registerAttributeHandlers.
private void registerAttributeHandlers(ReadManager reader) {
reader.addAttributeHandler(MAP_EXTENSION_XML_TAG, PROJECT_ID_XML_TAG, new IAttributeHandler() {
public void setAttribute(Object map, String value) {
final MapModel mapModel = (MapModel) map;
WorkspaceMapModelExtension wmme = WorkspaceController.getMapModelExtension(mapModel);
if (wmme.getProject() == null) {
AWorkspaceProject prj = WorkspaceController.getCurrentModel().getProject(value);
if (prj == null) {
// WORKSPACE - todo: propagate exception
LogUtils.warn("project with id=" + value + " was not found");
return;
}
wmme.setProject(prj);
}
}
});
reader.addAttributeHandler(MAP_EXTENSION_XML_TAG, PROJECT_HOME_XML_TAG, new IAttributeHandler() {
public void setAttribute(Object map, String value) {
final MapModel mapModel = (MapModel) map;
WorkspaceMapModelExtension wmme = WorkspaceController.getMapModelExtension(mapModel);
if (wmme.getProject() == null) {
// WORKSPACE - todo: find project for uri?
// AWorkspaceProject prj = WorkspaceController.getCurrentModel().getProject(value);
// if(prj == null) {
// //WORKSPACE - todo: propagate exception
// LogUtils.warn("project with id="+value+" was not found");
// return;
// }
// wmme.setProject(prj);
} else {
// ignore
}
}
});
}
use of org.freeplane.plugin.workspace.model.project.AWorkspaceProject in project freeplane by freeplane.
the class WorkspaceModelExtensionWriterReader method writeAttributes.
public void writeAttributes(ITreeWriter writer, Object userObject, IExtension extension) {
final WorkspaceMapModelExtension wmme = extension != null ? (WorkspaceMapModelExtension) extension : WorkspaceController.getMapModelExtension(((NodeModel) userObject).getMap());
AWorkspaceProject prj = wmme.getProject();
if (prj == null) {
return;
}
writer.addAttribute(PROJECT_ID_XML_TAG, prj.getProjectID());
writer.addAttribute(PROJECT_HOME_XML_TAG, prj.getProjectHome().toString());
}
use of org.freeplane.plugin.workspace.model.project.AWorkspaceProject 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