Search in sources :

Example 31 with Entry

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;
}
Also used : Entry(org.freeplane.core.ui.menubuilders.generic.Entry)

Example 32 with 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;
}
Also used : Entry(org.freeplane.core.ui.menubuilders.generic.Entry) AFreeplaneAction(org.freeplane.core.ui.AFreeplaneAction) ActionEvent(java.awt.event.ActionEvent) EntryAccessor(org.freeplane.core.ui.menubuilders.generic.EntryAccessor)

Example 33 with 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);
            ;
        }
    }
}
Also used : Entry(org.freeplane.core.ui.menubuilders.generic.Entry) ExecutionMode(org.freeplane.plugin.script.ExecuteScriptAction.ExecutionMode)

Example 34 with 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;
}
Also used : Entry(org.freeplane.core.ui.menubuilders.generic.Entry) EntryAccessor(org.freeplane.core.ui.menubuilders.generic.EntryAccessor)

Example 35 with Entry

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;
}
Also used : Entry(org.freeplane.core.ui.menubuilders.generic.Entry)

Aggregations

Entry (org.freeplane.core.ui.menubuilders.generic.Entry)64 Test (org.junit.Test)49 EntryAccessor (org.freeplane.core.ui.menubuilders.generic.EntryAccessor)36 AFreeplaneAction (org.freeplane.core.ui.AFreeplaneAction)22 JMenu (javax.swing.JMenu)9 Container (java.awt.Container)5 PhaseProcessor (org.freeplane.core.ui.menubuilders.generic.PhaseProcessor)5 SubtreeProcessor (org.freeplane.core.ui.menubuilders.generic.SubtreeProcessor)4 JComponent (javax.swing.JComponent)3 JMenuItem (javax.swing.JMenuItem)3 JPanel (javax.swing.JPanel)3 JToolBar (javax.swing.JToolBar)3 FreeplaneToolBar (org.freeplane.core.ui.components.FreeplaneToolBar)3 JToolbarComponentBuilder (org.freeplane.core.ui.menubuilders.menu.JToolbarComponentBuilder)3 Component (java.awt.Component)2 Collection (java.util.Collection)2 JButton (javax.swing.JButton)2 IUserInputListenerFactory (org.freeplane.core.ui.IUserInputListenerFactory)2 FreeplaneMenuBar (org.freeplane.core.ui.components.FreeplaneMenuBar)2 AcceleratebleActionProvider (org.freeplane.core.ui.menubuilders.action.AcceleratebleActionProvider)2