XUL: Multiple reuse of an overlay in same file? - firefox-addon

I'm developing a Firefox extension. There is a menu X which I need to show in both Tools menu and Context menu. Tools menu item and Context menu item are defined in same file but menu X in another file.
As I'm reusing menu X by id only last use of it is effective. How can I reuse it multiple time in same file without redundancy?

It can be done using XBL.

I haven't found a good solution either. The approach is rather to define the menu in the overlay only once and then clone it in your "load" event handler. You can then insert the clone at the second location. You have to be careful because ID attributes have to stay unique - so if your menu uses ID attributes you will have to additionally rewrite them. Ugly, I know.

IDs are, per definitionem, unique. That means you can't share the menuitem but you can share the code that gets executed when the action is invoked. One way to achieve this is to use commands.

Related

Global and dynamic context menu

I have an application which uses a lot (~1000) little components which all have a context menu associated running on Vaadin 23.
This creates a huge amount of data transfered from the server to the client (each right click is a javascript instruction, encapsulated into the json, etc).
I would like to reduce this amount of data, and create :
Only one global context menu listener (maybe on the parent component).
A dynamic menu items, depending on which subcomponent I right click, it should show different items.
I try a few options, using the addOpenedChangeListener or addAttachListener, but none of these method are able to dynamically create items in the context menu.
Is there a way to achieve the dynamic creation of menu items and identification of clicked item ?

Is there a quick way to add work items with child links?

Each time we create a patch iteration, we have a number of specific activities we need to perform before we can release. These are typically under a story 'Release activities' and are child items such as 'Update Help Guide', 'Targeted Regression', 'Produce Changelog' etc...
What I'd like to do is have a template I can use where I can quickly create the parent story in the target iteration, and have the child items automatically created. Is this possible without using the API? Maybe via an extension? I could use Copy Work Item for the parent, but I'd still need to create all the children manually.
Yes, it`s possible with Excel (Add linked backlog items and tasks). You can do next steps:
Create new excel sheet and connect to tfs.
Add needed child-parent levels.
Paste prepared work item structure.
Update the iteration path and any additional data.
Publish.

MvvmCross for MonoDroid - How to bind to Menu Item Click event

I have an MvvmCross PCL and a related MonoDroid UI project (pattern copied from following Stuart Lodge's excellent N+1 video series). I want to bind the click of an Action Bar menu item to an ICommand in my ViewModel. I've seen this post but an IMenuItem doesn't appear to have a suitable property to bind to. I'm aware of the SetOnMenuItemClickListener method but (and this is no doubt my lack of understanding) don't know how to leverage this to bind a System.Windows.Input.ICommand to it.
Also, if this is possible, can it be done in the OnCreateOptionsMenu method of the MvxView as this provides a handle to the Action Bar menu itself?
I don't think you can bind it, as the ActionBar is something that is loaded outside of the XML view. Also it does not expose any C# type of events for clicks on items as they are populated from a menu xml file. However you could in your SetOnMenuItemClickListener execute commands when a MenuItem is clicked. You can simply execute a command like this:
ViewModel.MyAwesomeCommand.Execute();

Applying Work Item template to an existing work item

I used the Process Editor to create a new State for User Story work items (the state of Proposed). When I create a new story it works fine, the User Story is created and the initial state is Proposed, just like I want it.
However when I open an existing User Story work item (one created before I made the change), it doesn't have the Proposed state as an option, and furthermore it will not accept it if I type Proposed in the State field.
Does this mean that any changes made to a Work Item Template will only apply for new work items going forward?
The proposed state is not in the dropdown, most likely because there is no transition from the current state of the work item to the proposed state.
Could you verify this?

How to sort data as I want in a VirtualExplorerTreeview (VirtualShellTools)

This is probably a very "dumb" question for whoever knows VirtualShellTools but I only started using it and couldn't find my answer in the demos' code. Please note that I'm also unfamiliar with virtualtreeview.
I use a VirtualExplorerTreeview to display a directory structure, linked with a VirtualExplorerListview to display a certain type of files in the selected directory as well as specific informations about them
I've been able to point them at the right place, link them as I wanted, filter everything in the listview, and looking at the demos I have a pretty good idea about how to add my own columns and draw it to display my custom data.
My issue lies with the Treeview: I would like to sort the directories displayed in the order I want; specifically, I want "My Docs" and other folder to appears first, then drives, then removable media. Looking in the TNamespace property I found how to distinguish them (Directory and Removable properties), but I don't know how to implement my own sort/what event I need. I tried CompareNode but that doesn't even seem to be called.
If you want to do everything yourself, then set toUserSort in the TVirtualExplorerTree.TreeOptions.VETMiscOptions property. That causes the control to just use the DoCompare method inherited from the virtual tree view, and that should call the OnCompareNodes event handler.
A better way is to provide a custom TShellSortHelper. Make a descendant of that class and override whichever methods you need. Create an instance of that class and assign it to the tree's SortHelper property. (The tree takes ownership of the helper; free the old one, but not the new one.) If the items are being sorted on a column that that class doesn't know how to compare, then handle the tree's OnCustomColumnCompare event.
To help you figure out exactly which methods you need to override or events you need to handle, set a breakpoint in TCustomVirtualExplorerTree.DoCompare and step through to see what gets called in various situations.

Resources