Re: [Pydev-code] Need Help with Context Menu and Debug view launch toolbar
Brought to you by:
fabioz
From: Fabio Z. <fa...@gm...> - 2011-01-07 23:52:11
|
Hi Hussain, > I have added a new debug command functionality i.e. 'Set Next Statement' in > a PyDev Code. I have added the same in 'Menu->Run->Set Next Statement ' and > 'Ctrl+X as a Shortcut'. I have created a new branch in a git i.e. > 'SetNextStatement' > (https://github.com/hussainbohra/Pydev/commits/SetNextStatement) and > submitted my code there. I got the branch here, and the basis seems to work :) Still, there are some issues: 1. you can't run into the following blocks: while | for | try | with (it seems currently only while and for are implemented)... note that if you attempt to do a jump inside 'with', it'll actually succeed doing the jump, but if you did something as: with threading.Lock(): ... do something... the application can crash afterwards (so, it shouldn't really be allowed). 2. I'd like to have some unit-tests at least in the part that gets a document and verifies if it can go to another place (i.e.: given a line in the debugger, can it make a jump to some other place or not). 3. Ctrl+X is not a good shortcut (that's already taken for cut which is very standard)... For Set Next Statement I think it could be close to the Run to Line (which is Ctrl+R), so, maybe Shift+Ctrl+R would be a better solution. 4. If the method context changes in the jump it will complain right now, but the python code can handle that, as it leaves you run until that context is available before doing the jump (so, maybe the validation should check if the jump would be possible if it was already in the first line of that context -- although I accept suggestions here). 5. I think that after this action is stable, run to line should be changed o do a real run to line, instead of a jump as it does now :) > I have written a new command and action for set next statement. Please refer > an attached plugIn.xml > I also want to add a shortcut for "Set next statement" in 'Debug View Launch > Toolbar' and 'Context Menu'. > > Debug View Launch Toolbar > - I have added an icon for Set Next Statement in a 'Debug View Launch > Toolbar' using MenuContribution. But I could not able to link toolbar icon > with my new set next command. Can you please have a look in attached > plugin.xml and let me know if I am missing something ? Strange, getting the code for your branch it's appearing for me in the Debug View. (so, maybe you already fixed that?) > Context Menu > - Inorder to add shortcut for 'Set Next Statement' in context menu (Right > Click Pop-up), Can you please let me know the best approach for the same and > also can I use my existing set next command for context menu as well ? If > Yes, then how ? I think you'll have to create a new action (although I'm not 100% sure about that), but it should be easy to use your existing action from that one. You can take a look at org.python.pydev/plugin.xml and org.python.pydev.editor.actions.PyCopyQualifiedName as an example for seeing how to add a popup menu (although in your case you will probably need to set the visibility of the action as it should only be visible in a debug session). > Important Note: SetNextStatement branch contains around 4 unncessary files, > which got submitted un-intentionally. I still need to figure out how > these files got submitted when I have not added these files using "git add > <file_name>". Kindly ignore those files while reviewing my changes. I'll > create new branch which will only contain necessary code changes. Maybe you did a "commit -a -m 'message'" (which will add files during the commit action) instead of just "commit -m 'message'"? Cheers, Fabio |