use of org.freeplane.core.ui.menubuilders.generic.Entry in project freeplane by freeplane.
the class ScriptingMenuEntryVisitor method findOrCreateEntry.
private Entry findOrCreateEntry(Entry rootEntry, final String path) {
Entry entry = entryNavigator.findChildByPath(rootEntry, path);
if (entry == null) {
// System.err.println("creating submenu " + path);
Entry parent = findOrCreateEntry(rootEntry, ScriptingMenuUtils.parentLocation(path));
Entry menuEntry = new Entry();
menuEntry.setName(lastPathElement(path));
menuEntry.setAttribute("text", scriptNameToMenuItemTitle(lastPathElement(path)));
parent.addChild(menuEntry);
return menuEntry;
}
return entry;
}
use of org.freeplane.core.ui.menubuilders.generic.Entry 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;
}
use of org.freeplane.core.ui.menubuilders.generic.Entry in project freeplane by freeplane.
the class ScriptingMenuEntryVisitor method addEntryForGivenLocation.
private void addEntryForGivenLocation(Entry rootEntry, final ScriptMetaData metaData, String scriptPath) {
for (final ExecutionMode executionMode : metaData.getExecutionModes()) {
final String location = metaData.getMenuLocation(executionMode);
if (registeredLocations.add(location + "/" + metaData.getScriptName())) {
Entry parentEntry = findOrCreateEntry(rootEntry, location);
if (parentEntry == null)
throw new RuntimeException("internal error: cannot add entry for " + location);
Entry entry = createEntry(metaData.getScriptName(), scriptPath, executionMode);
parentEntry.addChild(entry);
;
}
}
}
use of org.freeplane.core.ui.menubuilders.generic.Entry in project freeplane by freeplane.
the class ScriptingMenuEntryVisitor method createEntry.
private Entry createEntry(AFreeplaneAction action) {
final EntryAccessor entryAccessor = new EntryAccessor();
final Entry scriptEntry = new Entry();
scriptEntry.setName(action.getKey());
// System.err.println("registering " + scriptEntry.getName());
entryAccessor.setAction(scriptEntry, action);
return scriptEntry;
}
use of org.freeplane.core.ui.menubuilders.generic.Entry in project freeplane by freeplane.
the class MenuStructureXmlHandler method buildMenuStructure.
public static Entry buildMenuStructure(final Reader reader) {
XmlEntryStructureBuilder builder = new XmlEntryStructureBuilder(reader);
Entry initialMenuStructure = new Entry();
builder.visit(initialMenuStructure);
return initialMenuStructure;
}
Aggregations