use of org.freeplane.core.ui.components.FreeplaneMenuBar in project freeplane by freeplane.
the class UserInputListenerFactory method updateMenus.
public void updateMenus(String menuStructureResource, Set<String> plugins) {
mapsPopupMenu = new JPopupMenu();
getMenuBuilder(MenuBuilder.class).addPopupMenu(mapsPopupMenu, FreeplaneMenuBar.MAP_POPUP_MENU);
getMenuBuilder(MenuBuilder.class).addPopupMenu(getNodePopupMenu(), UserInputListenerFactory.NODE_POPUP);
final URL popupStructure = ResourceController.getResourceController().getResource(menuStructureResource.replace("menu.xml", "popup.xml"));
loadStructure(plugins, popupStructure);
if (useRibbonMenu()) {
final URL ribbonStructure = ResourceController.getResourceController().getResource(menuStructureResource.replace("menu.xml", "ribbon.xml"));
if (ribbonStructure != null) {
getMenuBuilder(RibbonBuilder.class).updateRibbon(ribbonStructure);
}
} else {
final FreeplaneMenuBar menuBar = getMenuBar();
getMenuBuilder(MenuBuilder.class).addMenuBar(menuBar, FreeplaneMenuBar.MENU_BAR_PREFIX);
getMenuBuilder(MenuBuilder.class).addToolbar((JToolBar) getToolBar("/main_toolbar"), "/main_toolbar");
final URL menuStructure = ResourceController.getResourceController().getResource(menuStructureResource);
loadStructure(plugins, menuStructure);
final URL toolbarStructure = ResourceController.getResourceController().getResource(menuStructureResource.replace("menu.xml", "toolbar.xml"));
loadStructure(plugins, toolbarStructure);
final IMapViewManager viewController = Controller.getCurrentController().getMapViewManager();
viewController.updateMenus(getMenuBuilder(MenuBuilder.class));
}
mapsPopupMenu.setName(TextUtils.getText("mindmaps"));
}
use of org.freeplane.core.ui.components.FreeplaneMenuBar in project freeplane by freeplane.
the class JMenuItemBuilderTest method createsMainMenuWithoutAction.
@Test
public void createsMainMenuWithoutAction() {
Entry parentMenuEntry = new Entry();
final FreeplaneMenuBar parentMenu = TestMenuBarFactory.createFreeplaneMenuBar();
new EntryAccessor().setComponent(parentMenuEntry, parentMenu);
parentMenuEntry.addChild(menuEntry);
menuEntry.addChild(actionEntry);
menuActionGroupBuilder.visit(menuEntry);
JMenu item = (JMenu) new EntryAccessor().getComponent(menuEntry);
assertThat(item.getParent(), CoreMatchers.<Container>equalTo(parentMenu));
}
use of org.freeplane.core.ui.components.FreeplaneMenuBar in project freeplane by freeplane.
the class JMenubarBuilder method visit.
@Override
public void visit(Entry target) {
final FreeplaneMenuBar menuBar = userInputListenerFactory.getMenuBar();
addMnemonicsBeforeShowing(menuBar);
new EntryAccessor().setComponent(target, menuBar);
}
use of org.freeplane.core.ui.components.FreeplaneMenuBar in project freeplane by freeplane.
the class JMenubarBuilderTest method createsEmptyToolbarComponent.
@Test
public void createsEmptyToolbarComponent() {
Entry toolbarEntry = new Entry();
final IUserInputListenerFactory userInputListenerFactory = mock(IUserInputListenerFactory.class);
final FreeplaneMenuBar menubar = TestMenuBarFactory.createFreeplaneMenuBar();
when(userInputListenerFactory.getMenuBar()).thenReturn(menubar);
final JMenubarBuilder toolbarBuilder = new JMenubarBuilder(userInputListenerFactory);
toolbarBuilder.visit(toolbarEntry);
assertThat(new EntryAccessor().getComponent(toolbarEntry), CoreMatchers.<Object>is(menubar));
}
use of org.freeplane.core.ui.components.FreeplaneMenuBar in project freeplane by freeplane.
the class MenuBuildProcessFactoryTest method setup.
@Before
public void setup() {
freeplaneActions = mock(FreeplaneActions.class);
final ResourceAccessor resourceAccessorMock = mock(ResourceAccessor.class);
when(resourceAccessorMock.getRawText(Matchers.anyString())).thenReturn("text");
final IUserInputListenerFactory userInputListenerFactory = mock(IUserInputListenerFactory.class);
final FreeplaneMenuBar menubar = TestMenuBarFactory.createFreeplaneMenuBar();
when(userInputListenerFactory.getMenuBar()).thenReturn(menubar);
phaseProcessor = new MenuBuildProcessFactory(userInputListenerFactory, freeplaneActions, resourceAccessorMock, mock(IAcceleratorMap.class), new EntriesForAction(), Collections.<BuildPhaseListener>emptyList()).getBuildProcessor();
}
Aggregations