Perl Local - How to add keys? (pls help)

Help
San Kumar
2007-12-01
2013-05-20
  • San Kumar

    San Kumar - 2007-12-01

    Hi, 
      I need to add a key-combo for the "Run as ...Perl Local" in the right click menu and I can't figure out how to add that keyboard shortcut. Can somebody please tell me how-to do it?

    Right now I do it from the popup menu but that is real chore because i like to run my programs every few seconds.. so any help will be greatly appreciated.

    Warm Regards,
    San.

    P.S. I also tried setting Perl in the external tools (as given on the epic site) but that does not have the option to add keyboard shortcuts to run it either :/

     
    • Jan Ploski

      Jan Ploski - 2007-12-01

      Are you aware of "Run Last Launched", which is CTRL-11 by default in Eclipse? You can change this key binding in Preferences/General/Keys if you like. There is also the green Run icon with a pulldown menu arrow in the main toolbar which you can use to quickly run any recently executed launch configuration.

       
    • San Kumar

      San Kumar - 2007-12-01

      Hi,
        Thanks for the reply. I did try that but it launches my other (flex) project even though my last run was "run as perl local". I also tried Run->External->"Perl Run" (which is basically Perl.exe) but that does not trigger for the "run last launched setting" either..

      I was browsing thru the forums and after a little tinkering I think there is another way to do this, thought it DOES NOT WORK yet :/ Maybe with a little help, I can set it right though (Right now I'm totally new to eclipse/epic)

      --
      I opened "org.epic.debug_0.6.15.jar" inside the plugins directory. I then extracted the "plugins.xml" file from it and edited it, by inserting the following at the end of this file.

          <!-- Adapters for contextual launch -->
          <extension point="org.eclipse.ui.commands">
              <command
                  name="Perl Local"
                  description="Perl Local"
                  id="org.epic.debug.LaunchShortcut"
                  categoryId="org.eclipse.debug.ui.category.run" />
          </extension>

          <extension point="org.eclipse.ui.bindings">
              <key
                  sequence="M1+M2+F"
                  schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
                  contextId="org.epic.perleditor.perlEditorScope"
                  commandId="org.epic.debug.LaunchShortcut" />
          </extension>

      This does not work yet but it does start to show the "Run as Perl Local" in the Key Binding Tabs inside Eclipse configuration. I don't know much about this XML but I think the id="org.epic.debug.LaunchShortcut" is wrong, so please suggest what needs to be done here.

      Warm Regards,
      San.

       
      • Jan Ploski

        Jan Ploski - 2007-12-01

        Does the most recently launched configuration get recorded correctly when you run the script through the launch configurations dialog?

         
    • San Kumar

      San Kumar - 2007-12-01

      Hi,
        Actually it doesn't with my Perl project. I've tried to run Run menu, and the popup menu (Perl Local) and the launch config dialog (Run -> Other).

      Also, If I close all my other projects and then run my Perl project alone and then press CTRL+F11, it shows me an alert that says "file is not launchable".

      Kind Regards,
      San.

       
      • Jan Ploski

        Jan Ploski - 2007-12-01

        Which version of Eclipse and EPIC are you using?

         
      • Jan Ploski

        Jan Ploski - 2007-12-01

        Maybe this is relevant to your problem: https://bugs.eclipse.org/bugs/show_bug.cgi?id=186527

         
        • Jan Ploski

          Jan Ploski - 2007-12-01

          The preference referred to in the bug report is Run/Debug/Launching/Always launch the previously launched application.

           
    • San Kumar

      San Kumar - 2007-12-01

      Hi,
        I'm using

      Flex Builder Moxie - v3 Milestone 3 Beta 2 ( build 3.0.183654 )
      Eclipse Platform Version 3.3.0.
      EPIC version is 0.6.17.
      Windows XP

      I will try the patch you've mentioned to see if it remedies my problem too.

      Also, do you by any chance know about the plugin.xml thing above? Using this, I've managed to get the key binding to pop in eclipse configuration dialog with the others and I can set the key-combo too, but the problem is it does not actually trigger anything yet because the XML is wrong. I have zero experience with this, so I don't know if this can work or if I am going totally in the wrong direction?

      Kind Regards,
      San

       
      • Jan Ploski

        Jan Ploski - 2007-12-01

        Yes, I guess you are going in the wrong direction with trying to assign a key binding to Run As.../Perl Local. The problem is that the action is context-sensitive - it acts upon the current selection in the Resources view or in the Package Explorer. But what you really want is to launch the last script, not whatever the selected file in one of these views is (it would be awkward to ensure the selection is right before using the key binding). Alternatively, you might want to launch the script in the currently active editor, which CTRL-F11 is also able to do for you in Eclipse 3.3, depending on how the already mentioned preference is set. Have you tried playing around with this preference?

         
    • San Kumar

      San Kumar - 2007-12-01

      Hi Again,
        Actually, I do want to "Run as Perl Local" the file I'm currently editing. This is because I usually like to run the code I'm working on with lots test values in between, which is kinda why I so badly need a keyboard shortcut to do it quickly.

      I checked the bindings, it is set to CTRL-F11. I tried playing around with it and it does launch my Flex project, but not my Perl scripts for some reason. Maybe its the patch which I have yet to apply (soon as I figure out how), so maybe that will fix it..

      Kind Regards,
      San

       
      • Jan Ploski

        Jan Ploski - 2007-12-01

        So in Preferences under Run/Debug/Launching you have "Launch the selected resource or active editor" checked as well as "Launch the associated project"? These are my settings for Eclipse 3.3 and they work ok for me.

         
    • San Kumar

      San Kumar - 2007-12-13

      Hi,
        i was just giving this another go today and this seems to work. Just posting it here for reference.

      Warning: This is a nasty hack and may not be for everyone. There are much better ways to do this I'm sure, so I strongly recommend you backup your files before you try it. 9/10, like Jan has pointed you don't not need this anyway, but I'm still posting it here for the 1/10 who may find it useful.

      Open plugin.xml in "org.epic.debug_0.6.15.jar" inside the eclipse's plugins directory. Then at the end of the file, paste this:

          <!-- Adapters for contextual launch -->
           <extension point="org.eclipse.ui.commands">
            <command
                  name="Perl Local"
                  description="Perl Local"
                  categoryId="org.eclipse.debug.ui.category.run"
                  id="org.epic.debug.LaunchShortcut.run">
            </command>
           </extension>
          
           <extension point="org.eclipse.ui.bindings">
              <key
              sequence="M1+M2+F"
              contextId="org.eclipse.ui.globalScope"
              commandId="org.epic.debug.LaunchShortcut.run"
              schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
           </extension>

      You will see key bindings for Perl Local inside eclipse prefs window after restart. Assign a key combo.
      Pressing this when editing the code will now run the perl scripts locally with that keyboard shortcut. Have fun!

      Kind Regards,
      San.

       

Log in to post a comment.