Author Topic: Eclipse Pass-through Command  (Read 17994 times)

bercikr

  • Community Member
  • Posts: 45
  • Hero Points: 2
Eclipse Pass-through Command
« on: June 12, 2008, 06:09:50 PM »
This has been something I have been thinking about for a while. How hard would it be to support a generic Eclipse passthrough command? I'm imagining a simple slickedit command that could pass through a string value perhaps that could execute an arbitrary Eclipse command. Is this something that could be possible to see in a future SE Core release?

-Rob

Ryan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 986
  • Hero Points: 77
Re: Eclipse Pass-through Command
« Reply #1 on: June 16, 2008, 01:42:46 PM »
This is a great idea, although I'm not sure about the implementation yet.  Let me propose something alternatively and see how this strikes you.

What if when you executed a key binding in a SlickEdit editor, if SlickEdit didn't have a binding for that key, it would "pass through" to Eclipse and execute whatever the Eclipse command was for the key binding (if any)?  This way you could bind keys to both SlickEdit functionality or Eclipse functionality and have the commands run in our editor...provided that if you bound something to a command in Eclipse, you did not have a command bound to the same key sequence in SlickEdit.  In that case only the SlickEdit command would be run.

- Ryan

bercikr

  • Community Member
  • Posts: 45
  • Hero Points: 2
Re: Eclipse Pass-through Command
« Reply #2 on: June 16, 2008, 04:37:37 PM »
I think that would be a pretty good start. For instance, the CTRL-SHIFT-R command is one that i use a lot from eclipse and that would be nice to pass through. I think it would be even more powerful though if there was programmatic access to arbitrary commands. I am not exactly sure what that would look like either but I think the _eclipse_dispatchCommand(...); function is probably pretty close, but it would just take the name of any arbitrary command class rather than just the commands listed in "eclipse.sh".

-Rob

fhoare

  • Junior Community Member
  • Posts: 2
  • Hero Points: 0
Re: Eclipse Pass-through Command
« Reply #3 on: August 19, 2008, 10:44:47 PM »
Are there any concrete plans to implement this pass through functionality?  I'm busy evaluating Core at the moment and not being able to use shortcuts that have nothing to-do with Slickedit is a real pain for me.  For example, the Mylyn task tracking plugin has shortcuts for activating and deactivating tasks - these are not accessible when in Slickedit. 

Ryan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 986
  • Hero Points: 77
Re: Eclipse Pass-through Command
« Reply #4 on: August 20, 2008, 02:06:40 PM »
Can you screenshot me the functionality you are looking for that isn't there when you are in SlickEdit?  I'm not terribly familiar with Mylyn, but I think I have all the necessary plug-ins installed and I need to be sure of what I'm trying to integrate.  A screenshot of the shortcut you are talking about would be a big help.  Thanks.

- Ryan

EDIT:  Nevermind...you are talking about Ctrl + F9 and Ctrl + Shift + F9 in the editor?  Navigate > Activate Task?  I was looking for something on the editor's right-click context menu...I'll let you know what I come up with.
« Last Edit: August 20, 2008, 02:10:24 PM by Ryan »

Ryan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 986
  • Hero Points: 77
Re: Eclipse Pass-through Command
« Reply #5 on: August 20, 2008, 02:43:34 PM »
If you are evaluating 3.4.0 for your company, you can make this happen easily.  One of the best features in Core 3.4.0 is the introduction of _eclipse_execute_command, which is discussed in the user guide/readme, and also a little more in my post here: http://community.slickedit.com/index.php?topic=3816.0 .  This is the idea that Rob suggests in this thread.

I'll take this opportunity to give a brief tutorial on how to integrate that "Activate Task" shortcut into the SlickEdit environment.

First you need to know the command id of what you are trying to execute.  I used the method described http://evans-stuff.blogspot.com/2007/10/it-seems-that-im-not-only-one-still.html , in which you create a Simple Cheat Sheet and use the Command Browse button (see first screenshot).

Then I just used the search field to find the command (see second screenshot).

Now that I had the command/parameter info, I opened up the Slick-C macro file where I write my custom commands (ryan.e), and added functions for Activate Task and Deactivate Task using _eclipse_execute_command (see third screenshot).  Remember to load your macro file with F12 after writing the functions.

Then I used the SlickEdit Keybindings dialog to bind eclipse_activate_task to Ctrl + F9 (see fourth screenshot), and voila.  Hitting Ctrl + F9 in a SlickEdit editor will launch the Mylyn Activate Task dialog.

It may seem like a lot of steps, but it's really not.  This whole process took me less than 10 minutes including the time I took to capture/crop/annotate the screenshots.  You can use this method to execute almost any Eclipse command from any plug-in from the SlickEdit environment.

- Ryan

fhoare

  • Junior Community Member
  • Posts: 2
  • Hero Points: 0
Re: Eclipse Pass-through Command
« Reply #6 on: August 26, 2008, 02:31:20 PM »
I had looked at doing it and it does work as you show and I'd be happy to do it if I knew there was only one thing.  But Mylyn just happened to be one example and so I'd have to go and do it for many different things and as plugins get added/removed/updated these would get out of date and need to be maintained. 

Ryan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 986
  • Hero Points: 77
Re: Eclipse Pass-through Command
« Reply #7 on: August 26, 2008, 05:27:41 PM »
I understand your complaint, but it's a difficult one to quell because of the design of our product.  SlickEdit Core doesn't extend the base Eclipse editor like other editor plugins: we replace it with the normal SlickEdit editor from our standalone product. 

There are positives and negatives of this design.  Certainly it makes it easier to port features over to Eclipse, as we have the Slick-C environment and our normal editor at our disposal.  This makes it possible to contribute many more features in Core than we could ever dream of if we were extending the base Eclipse editor and writing a Java-only plugin.  It also makes it difficult to seamlessly integrate the product with Eclipse.

We've taken some big steps to improve our integration over the last few releases.  I know that writing your own commands is not the optimal solution, but it is a solution...one which we didn't have before.  Also, I don't think that the maintenance of any of your custom commands will be too much of a time sink, certainly not compared to how much time it is going to save you to use SlickEdit.  Any maintenance should be isolated to a major version release of any particular plugin.

Hopefully we can improve on this mechanism in our next major release.  I would love to take the next step and have a full Eclipse emulation, as well as automatic detection/integration of key bindings added by other plugins.  If we had this, I think that context menus would only be a little more work.

- Ryan