use of org.freeplane.plugin.workspace.handler.DefaultFileNodeIconHandler in project freeplane by freeplane.
the class MModeWorkspaceController method setupView.
private void setupView(ModeController modeController) {
FileSystemManager.setDirectoryConflictHandler(new DirectoryMergeConflictDialog());
FileSystemManager.setFileConflictHandler(new FileExistsConflictDialog());
boolean expanded = true;
try {
expanded = !Boolean.parseBoolean(settings.getProperty(WORKSPACE_VIEW_COLLAPSED, "false"));
} catch (Exception e) {
// ignore -> default is true
}
OneTouchCollapseResizer otcr = new OneTouchCollapseResizer(Direction.LEFT);
otcr.addCollapseListener(getWorkspaceView());
ResizerEventAdapter adapter = new ResizerEventAdapter() {
public void componentResized(ResizeEvent event) {
if (event.getSource().equals(getView())) {
settings.setProperty(WORKSPACE_VIEW_WIDTH, String.valueOf(((JComponent) event.getSource()).getPreferredSize().width));
}
}
public void componentCollapsed(ResizeEvent event) {
if (event.getSource().equals(getView())) {
settings.setProperty(WORKSPACE_VIEW_COLLAPSED, "true");
}
}
public void componentExpanded(ResizeEvent event) {
if (event.getSource().equals(getView())) {
settings.setProperty(WORKSPACE_VIEW_COLLAPSED, "false");
}
}
};
otcr.addResizerListener(adapter);
otcr.addCollapseListener(adapter);
Box resizableTools = Box.createHorizontalBox();
try {
int width = Integer.parseInt(settings.getProperty(WORKSPACE_VIEW_WIDTH, "250"));
getWorkspaceView().setPreferredSize(new Dimension(width, 40));
} catch (Exception e) {
// blindly accept
}
resizableTools.add(getWorkspaceView());
resizableTools.add(otcr);
otcr.setExpanded(expanded);
modeController.getUserInputListenerFactory().addToolBar("workspace", ViewController.LEFT, resizableTools);
getWorkspaceView().setModel(getModel());
getView().expandPath(getModel().getRoot().getTreePath());
for (AWorkspaceProject project : getModel().getProjects()) {
getView().expandPath(project.getModel().getRoot().getTreePath());
}
getView().getNodeTypeIconManager().addNodeTypeIconHandler(LinkTypeFileNode.class, new LinkTypeFileIconHandler());
getView().getNodeTypeIconManager().addNodeTypeIconHandler(DefaultFileNode.class, new DefaultFileNodeIconHandler());
getView().refreshView();
}
Aggregations