use of org.freeplane.plugin.workspace.components.menu.WorkspacePopupMenu in project freeplane by freeplane.
the class AWorkspaceAction method getSelectedNodes.
protected AWorkspaceTreeNode[] getSelectedNodes(ActionEvent e) {
JTree tree = null;
if (e.getSource() instanceof JTree) {
tree = (JTree) e.getSource();
} else {
WorkspacePopupMenu pop = getRootPopupMenu((Component) e.getSource());
if (pop == null) {
return null;
}
tree = (JTree) pop.getInvoker();
}
AWorkspaceTreeNode[] nodes = new AWorkspaceTreeNode[tree.getSelectionPaths().length];
int i = 0;
for (TreePath path : tree.getSelectionPaths()) {
nodes[i++] = (AWorkspaceTreeNode) path.getLastPathComponent();
}
return nodes;
}
use of org.freeplane.plugin.workspace.components.menu.WorkspacePopupMenu in project freeplane by freeplane.
the class AWorkspaceAction method getNodeFromActionEvent.
protected AWorkspaceTreeNode getNodeFromActionEvent(ActionEvent e) {
JTree tree = null;
TreePath path = null;
if (e.getSource() instanceof JTree) {
tree = (JTree) e.getSource();
path = tree.getSelectionPath();
} else {
WorkspacePopupMenu pop = getRootPopupMenu((Component) e.getSource());
if (pop == null) {
return null;
}
tree = (JTree) pop.getInvoker();
int x = pop.getInvokerLocation().x;
int y = pop.getInvokerLocation().y;
path = tree.getClosestPathForLocation(x, y);
}
if (path == null) {
return null;
}
return (AWorkspaceTreeNode) path.getLastPathComponent();
}
use of org.freeplane.plugin.workspace.components.menu.WorkspacePopupMenu in project freeplane by freeplane.
the class LinkTypeFileNode method initializePopup.
public void initializePopup() {
if (popupMenu == null) {
popupMenu = new WorkspacePopupMenu();
WorkspacePopupMenuBuilder.addActions(popupMenu, new String[] { "workspace.action.node.cut", "workspace.action.node.copy", "workspace.action.node.paste", WorkspacePopupMenuBuilder.SEPARATOR, "workspace.action.node.rename", "workspace.action.node.remove", "workspace.action.file.delete", WorkspacePopupMenuBuilder.SEPARATOR, "workspace.action.node.refresh" });
}
}
use of org.freeplane.plugin.workspace.components.menu.WorkspacePopupMenu in project freeplane by freeplane.
the class DefaultFileNode method initializePopup.
public void initializePopup() {
if (popupMenu == null) {
popupMenu = new WorkspacePopupMenu();
WorkspacePopupMenuBuilder.addActions(popupMenu, new String[] { "workspace.action.node.cut", "workspace.action.node.copy", "workspace.action.node.paste", WorkspacePopupMenuBuilder.SEPARATOR, "workspace.action.node.rename", "workspace.action.file.delete", WorkspacePopupMenuBuilder.SEPARATOR, "workspace.action.node.refresh" });
}
}
use of org.freeplane.plugin.workspace.components.menu.WorkspacePopupMenu in project freeplane by freeplane.
the class AWorkspaceTreeNode method showPopup.
public void showPopup(Component component, int x, int y) {
final WorkspacePopupMenu popupMenu = getContextMenu();
if (popupMenu == null) {
return;
}
popupMenu.setInvokerLocation(new Point(x, y));
if (popupMenu != null) {
popupMenu.show(component, x, y);
}
}
Aggregations