use of org.freeplane.core.ui.AFreeplaneAction in project freeplane by freeplane.
the class WorkspaceController method replaceAction.
public static void replaceAction(final AFreeplaneAction action) {
AFreeplaneAction previousAction = getAction(action.getKey());
if (previousAction != null) {
removeAction(action.getKey());
}
addAction(action);
}
use of org.freeplane.core.ui.AFreeplaneAction in project freeplane by freeplane.
the class WorkspacePopupMenuBuilder method insertAction.
public static void insertAction(final WorkspacePopupMenu popupMenu, String actionKey, int index) {
assert actionKey != null;
assert popupMenu != null;
if (actionKey.equals(SEPARATOR)) {
popupMenu.add(new JPopupMenu.Separator(), index);
} else {
AFreeplaneAction action = Controller.getCurrentController().getAction(actionKey);
if (action == null) {
return;
}
final JMenuItem item;
if (action.getClass().getAnnotation(SelectableAction.class) != null) {
item = new JAutoCheckBoxMenuItem(action);
} else {
item = new JFreeplaneMenuItem(action);
}
popupMenu.add(item, index);
addListeners(popupMenu, action);
}
return;
}
use of org.freeplane.core.ui.AFreeplaneAction in project freeplane by freeplane.
the class AActionNode method handleAction.
public void handleAction(WorkspaceActionEvent event) {
if (event.getType() == WorkspaceActionEvent.WSNODE_OPEN_DOCUMENT) {
AFreeplaneAction action = Controller.getCurrentController().getAction(getType());
if (action == null) {
LogUtils.severe("No action '" + getType() + "' found");
return;
}
action.actionPerformed(new ActionEvent(this, 0, "execute"));
} else if (event.getType() == WorkspaceActionEvent.MOUSE_RIGHT_CLICK) {
showPopup((Component) event.getBaggage(), event.getX(), event.getY());
}
}
use of org.freeplane.core.ui.AFreeplaneAction in project freeplane by freeplane.
the class PresentationEditorController method createActionPanel.
private JComponent createActionPanel(ModeController modeController) {
AFreeplaneAction exportPresentationAction = modeController.getAction("ExportPresentationAction");
AFreeplaneAction exportAllPresentationsAction = modeController.getAction("ExportAllPresentationsAction");
JPanel controlButtons = new JPanel(new GridLayout(3, 1));
JButton btnExportPresentation = new JButton(exportPresentationAction);
btnExportPresentation.setAlignmentX(JButton.CENTER_ALIGNMENT);
controlButtons.add(btnExportPresentation);
JButton btnExportAllPresentations = new JButton(exportAllPresentationsAction);
btnExportAllPresentations.setAlignmentX(JButton.CENTER_ALIGNMENT);
controlButtons.add(btnExportAllPresentations);
AFreeplaneAction configureAction = modeController.getAction("ShowPreferencesAction");
JButton btnConfigure = new JButton(configureAction);
btnConfigure.setActionCommand(OptionPanel.OPTION_PANEL_RESOURCE_PREFIX + "Presentation");
btnConfigure.setAlignmentX(JButton.CENTER_ALIGNMENT);
controlButtons.add(btnConfigure);
final Dimension maximumSize = new Dimension(controlButtons.getPreferredSize());
maximumSize.width = Integer.MAX_VALUE;
controlButtons.setMaximumSize(maximumSize);
return controlButtons;
}
use of org.freeplane.core.ui.AFreeplaneAction in project freeplane by freeplane.
the class EntryAccessorTest method setsAction.
@Test
public void setsAction() throws Exception {
final AFreeplaneAction action = mock(AFreeplaneAction.class);
entryAccessor.setAction(entry, action);
final AFreeplaneAction entryAction = entryAccessor.getAction(entry);
Assert.assertThat(entryAction, equalTo(action));
}
Aggregations