How to add custom menu after sub-Window menu in Eclipse RCP? - menu

I have a sub-menu under the "Window" menu and I want to add my custom menu under it.
I can add my custom menu under "Window" menu with menuContribution's LocationURI:menu:window?after=additions.
The problem is that sub-menu is generated on ActionBarAdvisor class with this lines
#Override
protected void fillWindowMenu(IMenuManager windowMenu) {
IWorkbenchWindow window = getActionBarConfigurer().getWindowConfigurer().getWindow();
windowMenu.add(new GroupMarker(IWorkbenchActionConstants.WB_START));
IMenuManager perspectiveMenu = new MenuManager(
lineer.toplulastirma.Messages.ToplulastirmaActionBarAdvisor_4,
ContributionItemFactory.PERSPECTIVES_SHORTLIST.getId());
perspectiveMenu.add(ContributionItemFactory.PERSPECTIVES_SHORTLIST.create(window));
windowMenu.add(perspectiveMenu);
IMenuManager viewMenu = new MenuManager(lineer.toplulastirma.Messages.ToplulastirmaActionBarAdvisor_5,
ContributionItemFactory.VIEWS_SHORTLIST.getId());
viewMenu.add(ContributionItemFactory.VIEWS_SHORTLIST.create(window));
windowMenu.add(viewMenu);
windowMenu.add( new Separator());
}
So I don't know how to access its id to edit my LocationURI.
I tried these:
menu:window?after=lineer.toplulastirma.Messages.ToplulastirmaActionBarAdvisor_5
menu:lineer.toplulastirma.Messages.ToplulastirmaActionBarAdvisor_5?after=additions
menu:viewMenu?after=additions
menu:window?after=viewMenu
They didn't work.

Related

BarButtonItems not visible in iOS 11

I have an iOS app developed using Xamarin. Now I am trying to migrate it to iOS 11. My problem is that none of the BarButtonItems in navigation bars are visible in any controller, yet they are functional and I can tap them.
some of those button items are set in storyboard, by adding Navigation Item into the controller. titles of those button items are also invisible. even the standard back button.
the other bar button items are set in code by SetRightBarButtonItem or SetLeftBarButtonItem. I have both custom icon buttons and system item buttons. an example for system item button is:
this.NavigationItem.SetLeftBarButtonItem(new UIBarButtonItem(UIBarButtonSystemItem.Stop, (sender, e) => { ... }), true);
and another with custom icon button:
this.NavigationItem.SetRightBarButtonItem(new UIBarButtonItem(UIImage.FromBundle("gear"), UIBarButtonItemStyle.Plain, (sender, e) => { ... }), true);
These navigation bar button items have been working without problems for a long time. how can I fix them with the new navigation bar structure in iOS 11? (I do not enable large titles in navigation bars)
Just do something like this.
var button = new UIBarButtonItem(UIImage.FromBundle("gear"),UIBarButtonItemStyle.Plain, (sender, e) => { ... });
button.SetTitleTextAttributes(new UITextAttributes()
{
TextColor = UIColor.Blue,
TextShadowColor = UIColor.Clear
}, UIControlState.Normal);
this.NavigationItem.SetRightBarButtonItem(button, true);

Xamarin side menu tap issue

I developed an app using Xamarin forms that has side menu see this url.
But I couldn't use this in my current project, so I made my custom component for side menu.
How to implementing feature that hide menu when I tap range out of side menu?
It is hard to give you any help without seeing your code, but generally I tackle this issue by adding a ContentView that covers the screen when ever your menu opens. The menu would be displayed on top of the ContentView. Then you add a TapGestureRecognizer to the ContentView which closes the menu when clicked.
You could add some color to the ContentView but make it opaque so it is see-through, something like this color: #74787878
ContentView backgroundView = new ContentView {
BackgroundColor = Color.FromHex("#74787878"),
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.FillAndExpand,
Content = //Your menu
}
backgroundView.GestureRecognizers.Add(new TapGestureRecognizer {
Command = new Command(() => {
//Remove the background and hide the menu
})
});

How do you create a menuItem alternate in orchard for different Zones

I created an alternate for the main menu called MenuItemLink-main-menu-MainNavigation-MenuItem.cshtml because I want to render the menu differently in a Zone called main navigation. vs other places I am using the same menu on the page like the footer. I copied the MenuItem shape and renamed it (MenuItemLink-main-menu-MainNavigation-MenuItem.cshtml) everytime I run it I get an overflow because of the following line.
var renderedMenuItemLink = Display(Model);
can someone please explain to me why this is happening and the best way to create a zone based shapes for the navigation.
You copied markup from one shape (MenuItem) and paste it to another shape (MenuItemLink).
MenuItem calls Display for MenuItemLink
Then you calls Display for MenuItemLink inside MenuItemLink - this is an infinite loop.
For add alternate inside theme for MenuItemLink:
First. Create alternate for menu widget (Parts.MenuWidget.cshtml)
#using Orchard.ContentManagement;
#using Orchard.Widgets.Models;
#{
var widgetPart = ((IContent)Model.ContentItem).As<WidgetPart>();
Model.Menu.Zone = widgetPart.Zone;
}
Second. Create alternate for menu item (MenuItem.cshtml) and add one line (after line Model.Metadata.Type = "MenuItemLink";)
Model.Metadata.Type = "MenuItemLink";
(Model as Orchard.DisplayManagement.Shapes.Shape).Metadata.OnDisplaying(action =>
action.ShapeMetadata.Alternates.Add("MenuItemLink__Zone__" + (string)Model.Menu.Zone)
);
For add alternate inside theme for MenuItem:
First. Create alternate for menu widget (Parts.MenuWidget.cshtml)
#using Orchard.ContentManagement;
#using Orchard.Widgets.Models;
#using Orchard.DisplayManagement.Shapes;
#{
var widgetPart = ((IContent)Model.ContentItem).As<WidgetPart>();
var items = Model.Menu.Items as List<dynamic>;
AddMenuItemAlternate(items, widgetPart.Zone);
}
#functions{
public void AddMenuItemAlternate(List<dynamic> items, string zoneName)
{
foreach (var item in items)
{
item.Metadata.Alternates.Add("MenuItem__Zone__" + zoneName);
var subitems = (List<dynamic>)Enumerable.Cast<dynamic>(item.Items);
AddMenuItemAlternate(subitems, zoneName);
}
}
}
Update 2015.08:
I create module that adds widget name and zone name alternates for menu, menuItem and menu item link shapes. You can download one from orchard gallery https://gallery.orchardproject.net/List/Modules/Orchard.Module.MainBit.Navigation

LWUIT move all commands from the form to the "slide context menu"

I am trying to make a calculator for nokia 501 asha and i want all my buttons to fit on the the screen so that i don't have to scroll the form to access all buttons.
Apparently adding commands like exit,about and help are mandatory to your app.
Now when i add these commands one of the commands appear as a button and occupy a lot of screen space which i don't want.
I want my commands to appear like this i.e all commands on the slide context menu.
But instead there's an unnecessary button on the screen.
The code that i have used to add commands is as follows:
Form a = new Form("form");
a.addCommand(new Command("exit"),0);
a.addCommand(new Command("HELP"),1);
a.addCommand(new Command("ABOUT"),2);
a.setEnabled(true);
a.show();
So, what modifications i need to make in that code so that all my commands appear on the slide context menu ?
I am looking the Asha UI Component Demos, in the Menu section, options menu. I find this code to add the Commands:
// The rest appear in menu
Command menuCommand1 = new Command("Command 2", Command.SCREEN, 1);
addCommand(menuCommand1);
Command menuCommand2 = new Command("Command 3", Command.SCREEN, 2);
addCommand(menuCommand2);
Command menuCommand3 = new Command("Command 4", Command.SCREEN, 3);
addCommand(menuCommand3);
Try to put this Command.SCREEN parameter.
This answer will help to someone. The following code is working in 501.
protected void startApp() throws MIDletStateChangeException {
// TODO Auto-generated method stub
Display.init(this);
// For hide the form title bar. It is working in Nokia asha 501.
Display.getInstance().setForceFullScreen(true);
Display.setObjectTrait(Display.getInstance().getImplementation(), "nokia.ui.canvas.status_zone", Boolean.TRUE);
Form a = new Form("form");
a.addCommand(new Command("exit"),0);
a.addCommand(new Command("HELP"),1);
a.addCommand(new Command("ABOUT"),2);
a.setEnabled(true);
a.show();
}

YUI MenuButton: menu doesn't show when menu widget is added to button widget

Using YUI, I want to create a menu button, passing in the menu widget instance.
Result is what looks like a menu button, but the menu doesn't show.
test case: http://sandbox.kluger.com/menu_test.html
// key code section:
var D = YAHOO.util.Dom,
menu = new YAHOO.widget.Menu(D.generateId(), {lazyload: true});
menu.addItems(params.menu);
var t = new YAHOO.widget.Button({
type: "menu",
label: params.label,
menu: menu,
container: el
});
Do I need to render the menu before giving it to the Button?
If you want to see the params.menu, check the test case. The params.menu object is correct, it creates a menu when directly supplied to widget.Button. That's tested in the test case.
Any ideas appreciated.
Yes, you need to render. Add menu.render(document.body); after menu.addItems(params.menu); and it should work fine.

Resources