Adding to MVC View Editor Context Menu

Hi,
Have written an add-in originally for visual studio 2005, which has been updated to work with VS2010, VS2012 and VS2013.
I'm now at the point where I would like to add buttons to the MVC view editor context menu.
I've enabled VSIPLogging, and the right click brings back the Name 'HTML Context'
However it doesn't appear.
Below is some example code, that works for the 'ASPX Context', but not for the 'HTML Context'
object []contextGUIDS = new object[] { };
Commands2 commands = (Commands2)_applicationObject.Commands;
// Set the toolMenu to HTML Context and it doesn't work
string toolsMenuName = "HTML Context";
// Set the toolMenu to ASPX Context and it does work
//string toolsMenuName = "ASPX Context";
Microsoft.VisualStudio.CommandBars.CommandBar menuBarCommandBar = ((Microsoft.VisualStudio.CommandBars.CommandBars)_applicationObject.CommandBars)[toolsMenuName];
try
 //Add a command to the Commands collection:
 Command command = commands.AddNamedCommand2(_addInInstance, "MyAddin1", "MyAddin1", "Executes the command for MyAddin1", true, 59,
  ref contextGUIDS, (int)vsCommandStatus.vsCommandStatusSupported+(int)vsCommandStatus.vsCommandStatusEnabled,
  (int)vsCommandStyle.vsCommandStylePictAndText, vsCommandControlType.vsCommandControlTypeButton);
 //Add a control for the command to the tools menu:
 if((command != null) && (menuBarCommandBar != null))
  menuBarCommandBar.Controls.Add(Microsoft.VisualStudio.CommandBars.MsoControlType.msoControlPopup, System.Type.Missing, System.Type.Missing, 1, true);
catch(System.ArgumentException)
 //If we are here, then the exception is probably because a command with that name
 //  already exists. If so there is no need to recreate the command and we can
 //  safely ignore the exception.
Many thanks for any help on this.
Cheers
James

Hi James,
I did a little change to your code and it works fine to add a command button to the .cshtml and .aspx code editor's context menu.
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
_applicationObject = (DTE2)application;
_addInInstance = (AddIn)addInInst;
if(connectMode == ext_ConnectMode.ext_cm_UISetup)
object[] contextGUIDS = new object[] { };
Commands2 commands = (Commands2)_applicationObject.Commands;
// Set the toolMenu to HTML Context and it doesn't work
string toolsMenuName = "HTML Context";
// Set the toolMenu to ASPX Context and it does work
//string toolsMenuName = "ASPX Context";
Microsoft.VisualStudio.CommandBars.CommandBar menuBarCommandBar = ((Microsoft.VisualStudio.CommandBars.CommandBars)_applicationObject.CommandBars)[toolsMenuName];
try
//Add a command to the Commands collection:
Command command = commands.AddNamedCommand2(_addInInstance, "MyAddin1", "MyAddin1", "Executes the command for MyAddin1", true, 59,
ref contextGUIDS, (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled,
(int)vsCommandStyle.vsCommandStylePictAndText, vsCommandControlType.vsCommandControlTypeMRUButton);
//Add a control for the command to the tools menu:
if ((command != null) && (menuBarCommandBar != null))
{//msoControlPopup
//menuBarCommandBar.Controls.Add(Microsoft.VisualStudio.CommandBars.MsoControlType.msoControlButton, System.Type.Missing, System.Type.Missing, 1, true);
command.AddControl(menuBarCommandBar, 1);
catch (System.ArgumentException)
//If we are here, then the exception is probably because a command with that name
// already exists. If so there is no need to recreate the command and we can
// safely ignore the exception.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • Adding menuItems to the Pages context menu

    I am trying to add menuitems to the Pages context menu. I found this:
    http://support.adobe.com/devsup/devsup.nsf/docs/50383.htm
    But is specifically says those are SOME of the keys for the menus. Anyone happen to have a list? (I and other people may wish to add them to the Pages, or other context menus)

    hmmmm.... I think I got what you are talking about (kinda modified the one that was there):
    var myMenuNames = app.menus.everyItem().name;
    var myTextFile = File.saveDialog("Save Menu Action Names As", undefined);
    if(myTextFile != null){
    myTextFile.open("w");
    for(var myCounter = 0; myCounter < myMenuNames.length; myCounter++){
    myTextFile.writeln(myMenuNames[myCounter]);
    myTextFile.close();
    Furthermore... Since I actually found the name of the menu I was looking for.
    var myMenuNames = app.menus.item("Pages Panel Pages Context Menu").menuElements;
    var myTextFile = File.saveDialog("Save Menu Action Names As", undefined);
    if(myTextFile != null){
    myTextFile.open("w");
    for(var myCounter = 0; myCounter < myMenuNames.length; myCounter++){
    try{myTextFile.writeln(myMenuNames[myCounter].name);}catch(e){}
    myTextFile.close();

  • Context menu refresh issue in adf tree.

    Hi All,
    I am using jdeveloper 12.1.2.2.0.
    I have a programmatically generated tree in which I have added two buttons in the context menu using context menu facet.
    * I have selection listener in the tree and right click also selects the node.
    There are two issues regarding the context menu:
    1. If I right click the tree node, the context menu is showing only the two buttons I added and it is not showing the default expand/collapse, expand all/collapse all below and show as top options of context menu. Once I refresh the tree region doing some actions in the page, it is showing all the options.
    2. The buttons I added inside the context menu have disabled conditions and the trigger is given for the parent container "popup" which will be triggered by tree node selection. The problem is that whenever I right click the tree node, the popup is refreshed because of the trigger and the expand/collapse functions are not working. If I right the same node again the functions are working fine.
    How to resolve these issues?
    Thanks in advance.
    - Vignesh S.

    Any suggestions would be helpful.
    The below is the xml of the tree:
                                                           <af:tree var="node" value="#{dmc.btm.model}" id="btc"
                                                                     rowSelection="#{(viewScope.fc.editable || viewScope.cc.editable || viewScope.bc.editable) ? 'none' : 'single'}"
                                                                     immediate="false" initiallyExpanded="false"
                                                                     selectionListener="#{dmc.selectionListener}"
                                                                     fetchSize="100" expandAllEnabled="true">
                                                                <f:facet name="nodeStamp">
                                                                    <af:group id="g3">
                                                                        <af:image source="#{node.icon}" id="i1"/>
                                                                        <af:outputText value="#{node.id}" id="ot4"/>
                                                                    </af:group>
                                                                </f:facet>
                                                                <f:facet name="contextMenu">
                                                                    <af:popup childCreation="deferred" autoCancel="enabled"
                                                                              id="p1" partialTriggers="::btc"
                                                                              contentDelivery="lazyUncached">
                                                                        <af:menu text="menu 1" id="m1">
                                                                            <af:toolbar id="t4">
                                                                                <af:commandToolbarButton shortDesc="Create"
                                                                                                         text="#{prop['label.new']}"
                                                                                                         icon="images/new_ena.png"
                                                                                                         disabledIcon="images/new_dis.png"
                                                                                                         id="ctb4"
                                                                                                         actionListener="#{dmc.newListener}"
                                                                                                         partialSubmit="true"
                                                                                                         disabled="#{!dmc.createButtonEnabled || viewScope.fc.editable || viewScope.cc.editable}"/>
                                                                            </af:toolbar>
                                                                            <af:toolbar id="t5">
                                                                                <af:commandToolbarButton shortDesc="Delete"
                                                                                                         text="#{prop['label.delete']}"
                                                                                                         icon="images/delete_ena.png"
                                                                                                         disabledIcon="images/delete_dis.png"
                                                                                                         id="ctb5"
                                                                                                         actionListener="#{dmc.deleteListener}"
                                                                                                         disabled="#{!dmc.deleteButtonEnabled || viewScope.fc.editable || viewScope.cc.editable}"/>
                                                                            </af:toolbar>
                                                                        </af:menu>
                                                                    </af:popup>
                                                                </f:facet>
                                                            </af:tree>

  • How to create a context menu in ALV table cell editor(Webdynpro abap )

    Hello Experts,
    I am having a problem in creating a context menu in a table cell editor in the ALV table output.I have assigned a 'lta' as the cell editor.But befor assigning the lta as cell editor I have assigned the menu to the lta.But when the view is rendered I can see the lta with the actioned assigned to it.But I cannot see the context menu.
    The code snippet below:
      "Create menu for each coloumn
      create OBJECT lo_menu_actions type CL_SALV_WD_VE_MENU EXPORTING
          id = 'MITM_ACTIONS'.
      lo_menu_actions->set_visible( value = abap_true ). 
      lo_menu_actions->set_visible_fieldname( value = 'ACTIONS' ).
      "ADd menu items
      CREATE OBJECT lo_menu_item_create type CL_SALV_WD_VE_MENU
      exporting
        id = 'MITM_CREATE_EXPRESSION'.
      lo_menu_item_create->set_visible( value = abap_true ).
      lo_menu_item_create->set_visible_fieldname( value = 'Create' ).
      "Add item 1
      lo_menu_actions->ADD_ITEM( VALUE = lo_menu_item_create ). 
      "  Set the cell editor for each column cell(link to an action)
      LOOP AT lt_node_dec_tab_cols INTO ls_node_dec_tab_cols .
        lv_column_name = ls_node_dec_tab_cols-object_name.
        lr_column = lr_column_settings->get_column( lv_column_name ).
       "Create 'lta' Ui item
        CREATE OBJECT lo_lta TYPE cl_salv_wd_uie_link_to_action.
        lo_lta->set_menu( value = lo_menu_actions ).
        lo_lta->set_text_fieldname( lv_column_name ).
        lr_column->set_cell_editor( lo_lta ).
        IF ls_node_dec_tab_cols-is_result EQ abap_true.
          lr_column->set_cell_design( value =
                      cl_wd_table_column=>e_cell_design-key_medium ).
        ENDIF.
      ENDLOOP.

    Hi Prakash,
    I have not come across this requirement till now to have context menu in a cell editor of alv.
    Unfortunately  the implementation of method SET_MENU of alv ui elements ( ex: cl_salv_wd_uie_text_view ) is not updating alv configurable table, instead it just stores in a global attribute as string. Hence has no effect on context menu.
    If your user is very particular about this requirement of having context menu in cell editor, you can go for a normal table. Because, normal table's cell editor has the property to set the menuID as we do it for other ui elements.
    Regards,
    Rama

  • FR 9.0.5.2: Add node context menu to "uncommitted files" view

    Hi, the "uncommitted files" view is really cool.
    Would be great if you could add the file type specific context menu.
    This would allow me to run Jalopy, PMD, ALT-POS1 or another tool directly in the view without having to open the file in the editor.
    Perhaps with multiple selection?
    Additionally having "organize imports" would be helpful, too.
    Thanks, Markus

    Filed enhancement request# 3834665.

  • Looking for a 'view link target source' context menu item

    I'm looking for a 'view link target source' context menu item.
    I often open listings of servers' directories; they can include direct links to code files (*.py , *.pl, etc). When I click them directly, I'm asked to open them with an external editor which is not what I want to do; I want to view those files source inside of Firefox. I currently have to
    # right-click those links,
    # copy link location,
    # type "view-source:" in the Location bar,
    # paste the copied URL,
    # click Go.
    This gets time-consuming with the large amount of URLs I need to open.
    It's not a native feature for Firefox and a search at [http://addons.mozilla.org AMO] didn't come up with anything useful, for me at least.

    Hello,
    particularly, I performed the following steps:
    1. I created a SC in the local repository, which matches the SC of the track.
    2. I moved the exisiting DCs to the SC created in step 1.
    3. Now, I created new DCs in the SC in the track.
    4. I deleted all .project files from the local DCs.
    5. I copied all source files from the local DCs to the new track DCs.
    6. I checked-in these changes to the track.
    Kind regards
    Alexander

  • Adding context menu to any application.

    Hi there ,
    Is there any way to add context menu to the existing ones? for e.g I want, when I highlight a text in safari and right click on it, make it to read that text for me( by now i use a shortcut-key) or for example in yahoo messenger selecting a word in chat window and right clicking gives me just the option to search in Yahoo, I want to add google as well, and so on for different applications sth especial !

    Try OnMyCommand plugin? http://www.abracode.com/free/cmworkshop/
    There are hundreds of user-submitted scripts - no. 43 is "Say Text," http://free.abracode.com/cmworkshop/commands/commands.php
    (There's a more convenient list of available commands viewed from the editor that's included with the download.)

  • Adding a new context menu option to KM

    I want to add a new menu option to KM that appears when a user clicks the context menu of an xmlform generated xml file.
    From reading the forums it appears I need to edit an existing UI Command Group, adding a newly created Command that points to a Java class containing a handler class that implements ICommand?
    -How do I know which command group to add my command to?
    -Can I make the new command appear only for xml files generated by xmlforms?
    Cheers,
    Steve

    Hi Steve,
    <b>-How do I know which command group to add my command to?</b>
    You have to know what layout set is used in the navigation iView. If you do not know this, you have can add your user to the Debugging Settings list (KM Configuration -> Content Management -> User Interface -> Debugging Settings) and click on the Rendering Information link in the iView.
    After that you can go to the Layout Set settings ((KM Configuration -> Content Management -> User Interface -> Settings -> Layout Set) and check the settings of the Resource Renderer in use. For example if use the AdminExplorer LayoutSet you'll have to take a look at AdminResourceRenderer configuration. There you can see the Command Group used for Resources (Resource Command Group).
    This is the group you have to edit.
    <b>-Can I make the new command appear only for xml files generated by xmlforms?</b>
    Unfortunately you can only use different groups for Resources, Folders and Links but not for different type of Resources.
    Hope this helps,
    Robert

  • View Source not showing up in context menu?

    Yes I did choose to allow view source during the release
    build. I also uploaded the source folder to the server. I can
    manually go to the view source folder and it is working fine, only
    thing is, the option is not in the context menu of the application.
    I suppose I can add it there myself but I thought that was
    automatic?
    Thanks!

    quote:
    Originally posted by:
    levancho
    if you are using FB3 you can you feature called : "Export
    Project" and it does everything for you, including view Source
    Feature,
    just select your project and then click on Project -->
    Export Project
    and in dialog select "View Source" and then finish.
    That is exactly what I did, I go to Export Release Build, I
    select View Source, I choose which files to show, I name what
    directory I want it to be in. I click Finish, Then I upload
    everything from the release-bin to my server. I can manually go to
    the view source URL and that works, but the option does not appear
    when I right click the .swf. But as a work around I can add the
    option to the context menu myself and use navigateToURL to send the
    user there.

  • Problem with APEX tree in 4.1.1.00.23-while adding context menu

    Hi,
    Version : Apex 4.1.1.00.23 and Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    i wanted to add context menu to my tree region.i followed Jason's blog
    http://jastraub.blogspot.com/2010/09/adding-context-menu-to-tree-region.html
    But after i add the javascript code he mentioned,nothing seems to have changed.The context menu appears the same way it was before.
    Is there anyone facing similar problem?
    Appreciate your comments,

    Also using Apex 4.1 and I successfully adapted the steps to my application and it worked well ... the context menu and the tool tips come up well and are functional. The only issue I am still having is that the drop-down arrows no longer work ... I had to use a dynamic action to keep the trees all expanded when the page loads. However, I cannot collapse them as I used to (if needed). I am looking forward to a fix to this issue too.
    Gerald

  • Urgent requirement on adding context menu in strobe media player

            i want add fullscreen and scale mode in strobe player context menu.. i have added these menu items to context menu in videoInfoOverlay action sctipt.
    but i dont know how to add code for full screen in context menu click event.. what code i have to add into it?  this is very urgent requirement.. can anyone know?

    Silviu,
    Thanks for the quick response.  I had not seen the building-osmf.pdf file before.  Upon quick inspection it seems to be based on CS5 and not CS5.5 and the font issue that I am running into does not seem to be mentioned in the document.  Once I figure out the font issue I'm having, I'll update this thread.
    Regards,
    Tim

  • Is it possible to create a Visual Studio plugin that can copy TFS work item ID by adding a context menu in the work item UI?

    Our team is using VS2013 and TFS 2013, and in our daily work we often open a TFS query, then we need to open a work item, and we often need to copy the ID, for example, to the email.
    But currently the field is read only, and we often manually copy it.
    So is there any convenient way to solve this? Any built in ways?
    If no, is it possible to create such a plugin?
    Regards,
    Lei Yang
    from Motorolasolutions

    Hi Lei Yang
    You can try the following work around to copy work item ID
    for VS 2013:
    Right click on work item tab header in VS 2013 and click 'Copy Full Path' from context menu
    When you paste it on notepad/email you will get work item ID at the end of the path:
    http://sumiran-dev:8080/tfs/web/wi.aspx?pcguid=d855bc22-69a8-45a5-b6fc-25f096ade8f5&id=46
    For Web Portal:
    Right click on work item link at top and click 'Copy shortcut' from the context menu
    When you paste it on notepad/email you will get work item ID at the end of the shortcut:
    http://sumiran-dev:8080/tfs/DefaultCollection/TFS%20Scrum%20Demo/_workitems/edit/46
    Thanks
    Sumiran

  • Adding context menu to a table control

    Hi,
    i have a screen with table control. i have to select a column on the table control and i have to copy the contents on that column and i have to paste them on a
    excel sheet.
    [for this i have to add a context menu with copy text option.( This is my opinion )].
    I dont know how to add that context menu to an ordinary table control. please help on this for copying contents of the field to the clipboard.?
    Regards,
    Tom..

    HI,
    Check this link,
    http://www.henrikfrank.dk/abapexamples/ABAP%20objects%20and%20controls/toolbar_control.htm
    Thanks & Regards,
    Judith.

  • Firefox hangs when opening any context menu - save as, download window, options window, etc

    this is the third time i've had this problem with firefox...
    firefox hangs when trying to download images, files, etc. the right click context menu opens (with bookmark, save page, save image, etc options) but after selecting an option, save image or whatever, the actual save as dialogue box doesn't open and firefox locks up.
    many pages say to open the download pane and clear the history... i can't do that as trying to open the download pane locks it up, too. as does trying to open any other dialogues.
    the first time this happened the only solution i could find was a total wipe and re-install (simple uninstall/re-install didn't work... it had to be weeded out of the registry manually).
    the second time i just happened to be rebuilding my system, so i just did a fresh install on a fresh OS.
    this time i can't seem to resolve the problem with uninstall and re-install...
    help?

    found out what was doing it!
    after trying firefox safe mode and windows safe mode and any number of other things i'd kinda given up for a bit there, but i woke from a dream in the middle of the night thinking "based on the behaviour involved it *must* be something in the shell that's causing this." (sorry, i dream in geek.)
    so i grabbed a shell viewer editor - ShelleExView (http://www.nirsoft.net/utils/shexview.html) (had to use an icky, lesser browser to be able to download it) and gave it a run.
    i listed all the extensions by the date they were added as a clsid and tried to think back to when the problem began... about a month or so after a fresh system reinstall. and through a little trial and error disabling i found the culprit.
    it was an icon overlay handler put in by something called WagerLogic. after looking into the company name i'm going to have to assume this was related to one of the annoying "come lose real money at our virtual casino" pop-ups that infest the net nefariously panning for an easy mark like dickensian orphans.
    i disabled it et voila! firefox is back to full function again.

  • How to remove or hide toolbar context menu in visual studio IDE

    Hi All,
    Currently we are extending Visual studio and it's functionality.
    As we know, we can have different categories of tool bars like standard, build, debug etc shown in pic - 
    or we can access the categories via -  View Main Menu -> Toolbars 
    Basically My requirement is that, I don't want to show these options (Build, Debug, Debug Location, Layout, customize , Text Editor, Standard etc) shown in context menu or shown in submenu.  
    How can I achieve it ? Please advice.

    AFAIK, you can only customize it manually, but can't hide the builtin menus:
    http://msdn.microsoft.com/en-us/library/vstudio/wdee4yb6(v=vs.100).aspx
    or maybe you can try vsct:
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/f3acc18c-b176-4f06-a8d1-cccff3d4bf7f/how-to-disable-and-enable-menu-commands-in-vspackage?forum=vsx

Maybe you are looking for

  • Oracle Spatial User Conference  - GITA Conference Seattle

    http://www.gita.org/events/annual/31/Oracle.asp Oracle Spatial User Conference Please note that online registration for this event is now closed. Thursday, March 13, 2008 Sheraton Seattle Hotel 1400 6th Avenue Seattle, Washington USA GITA invites you

  • D-Link DIR-655 Troubles (N-Router)

    Everytime I try to log onto my router (192.168.0.1) I get this : (See Photobucket Pic). It only happens on my G5 (running 10.4.10). You click on either button, nothing ever happens. Just the pinwheel of death forever. I can log on fine with other com

  • General exception error

    hii members, I am getting this error for bi base run time error: GENERAL EXCEPTION IN DEPLOY TRANSFORMATION FOR OBJECT.               Kindly throw some light on to which part is the error from.

  • DW89 Design Mode Disappears

    I am using Dreamweaver 8 for Mac (from Studio *) on a G-5, 2,5 dual. Version of DW is 8.2 When updating content in an existing site, on a rather long page, I found that the lower half of the page simply disappeared. I could not bring it on the screen

  • Converting files to PS

    Hi all... forgive me if this is not the right place for a question like this, but since I haven't found a better one... :/ I'm into building a Java based solution for convert generic documents from inside a document management system to PostScript in