use of org.freeplane.core.ui.AFreeplaneAction in project freeplane by freeplane.
the class ActionSelectListenerTest method activatesSelectOnPopup_forCheckSelectionOnPopup.
@Test
public void activatesSelectOnPopup_forCheckSelectionOnPopup() {
Entry menuEntry = new Entry();
Entry actionEntry = new Entry();
menuEntry.addChild(actionEntry);
final AFreeplaneAction someAction = Mockito.mock(AFreeplaneAction.class);
when(someAction.checkSelectionOnPopup()).thenReturn(true);
when(someAction.isEnabled()).thenReturn(true);
new EntryAccessor().setAction(actionEntry, someAction);
final EntryPopupListenerCollection entryPopupListenerCollection = new EntryPopupListenerCollection();
final ActionSelectListener actionSelectListener = new ActionSelectListener();
entryPopupListenerCollection.addEntryPopupListener(actionSelectListener);
entryPopupListenerCollection.childEntriesWillBecomeVisible(menuEntry);
verify(someAction).setSelected();
}
use of org.freeplane.core.ui.AFreeplaneAction in project freeplane by freeplane.
the class EntriesForActionTest method returnsEmptyListIfNoActionWasRegistered.
@Test
public void returnsEmptyListIfNoActionWasRegistered() throws Exception {
final EntriesForAction entriesForAction = new EntriesForAction();
AFreeplaneAction action = mock(AFreeplaneAction.class);
Collection<Entry> entries = entriesForAction.entries(action);
assertThat(entries.isEmpty(), equalTo(true));
}
use of org.freeplane.core.ui.AFreeplaneAction in project freeplane by freeplane.
the class EntriesForActionTest method returnsListWithRegisteredAction.
@Test
public void returnsListWithRegisteredAction() throws Exception {
final EntriesForAction entriesForAction = new EntriesForAction();
AFreeplaneAction action = mock(AFreeplaneAction.class);
final Entry actionEntry = new Entry();
entriesForAction.registerEntry(action, actionEntry);
Collection<Entry> entries = entriesForAction.entries(action);
assertThat(entries, equalTo((Collection<Entry>) asList(actionEntry)));
}
use of org.freeplane.core.ui.AFreeplaneAction in project freeplane by freeplane.
the class ScriptingMenuEntryVisitor method createAction.
private AFreeplaneAction createAction(final String scriptName, final String scriptPath, ExecutionMode executionMode, final ScriptMetaData metaData, final String title) {
final String key = ExecuteScriptAction.makeMenuItemKey(scriptName, executionMode);
final AFreeplaneAction alreadyRegisteredAction = modeController.getAction(key);
if (alreadyRegisteredAction == null) {
String longTitle = createTooltip(title, executionMode);
String menuItemTitle = hasMultipleExcecutionModes(metaData) ? longTitle : title;
AFreeplaneAction action = new ExecuteScriptAction(scriptName, menuItemTitle, scriptPath, executionMode, metaData.getPermissions());
action.putValue(Action.SHORT_DESCRIPTION, longTitle);
action.putValue(Action.LONG_DESCRIPTION, longTitle);
modeController.addAction(action);
return action;
} else {
return alreadyRegisteredAction;
}
}
use of org.freeplane.core.ui.AFreeplaneAction in project freeplane by freeplane.
the class ScriptingMenuEntryVisitor method createNoScriptsAvailableAction.
private Entry createNoScriptsAvailableAction() {
final Entry entry = new Entry();
entry.setName("NoScriptsAvailableAction");
@SuppressWarnings("serial") final AFreeplaneAction noScriptsAvailableAction = new AFreeplaneAction("NoScriptsAvailableAction", noScriptsAvailableMessage(), null) {
@Override
public void actionPerformed(ActionEvent e) {
}
};
new EntryAccessor().setAction(entry, noScriptsAvailableAction);
return entry;
}
Aggregations