tag:blogger.com,1999:blog-1557780184357927241.post4683890223289512521..comments2023-06-22T20:43:37.886+05:30Comments on Eclipse Tips - Prakash G.R.: Commands Part 4: Misc items ...Prakash G.R.http://www.blogger.com/profile/13046268367318873066noreply@blogger.comBlogger11125tag:blogger.com,1999:blog-1557780184357927241.post-69307714564036473482010-11-03T14:33:26.761+05:302010-11-03T14:33:26.761+05:30You need an IServiceLocator to get the service. It...You need an IServiceLocator to get the service. It could be Workbench/WorkbenchWindow/any other implementations of that interfacePrakash G.R.https://www.blogger.com/profile/13046268367318873066noreply@blogger.comtag:blogger.com,1999:blog-1557780184357927241.post-55122499857179041082010-11-03T14:28:43.449+05:302010-11-03T14:28:43.449+05:30How to call a command without using workbench
I do...How to call a command without using workbench<br />I do not want to use below<br /> handlerService = (IHandlerService ) PlatformUI.getWorkbench().getService(IHandlerService.class);<br /> handlerService.executeCommand(command, null);<br /><br />Parvez Ahmad Hakim<br />Srinagar KashmirAhmadhttps://www.blogger.com/profile/05072112154906382015noreply@blogger.comtag:blogger.com,1999:blog-1557780184357927241.post-59275753545206631982010-02-17T09:38:14.548+05:302010-02-17T09:38:14.548+05:30@Mike,
You should be using the command paramete...@Mike,<br /> You should be using the command parameter and toggle contributions. Check how the Align command at the 6th part in this Command series. You can go thru the complete tutorial here: http://eclipse-tips.com/index.php/tutorials/1-actions-vs-commandsPrakash G.R.https://www.blogger.com/profile/13046268367318873066noreply@blogger.comtag:blogger.com,1999:blog-1557780184357927241.post-56859321716406105002010-02-17T00:34:43.442+05:302010-02-17T00:34:43.442+05:30Okay, thanks.
So, if I'm in a handler for com...Okay, thanks.<br /><br />So, if I'm in a handler for command X, and want to gain access to command Y (to disable it), how should I go about getting it?<br /><br />In case I'm on the wrong track altogether....what I'm ultimately trying to do is logically tie two toolbar buttons together so only one is active at a given time; one you press one, it disables itself and enables the other, like a switch. Am I on the right track for implementing this?<br /><br />Thanks much.Mike Briahttps://www.blogger.com/profile/10526104657156115391noreply@blogger.comtag:blogger.com,1999:blog-1557780184357927241.post-3517832879980728542010-02-16T22:37:11.465+05:302010-02-16T22:37:11.465+05:30@Mike,
Its an instance of IServiceLocator. Work...@Mike,<br /> Its an instance of IServiceLocator. Workbench, WorkbenchWindow, WorkbenchSite all are service locators. You can also create one, if you have toPrakash G.R.https://www.blogger.com/profile/13046268367318873066noreply@blogger.comtag:blogger.com,1999:blog-1557780184357927241.post-15960983965908040682010-02-16T22:28:02.663+05:302010-02-16T22:28:02.663+05:30I've recently come across your blog and love i...I've recently come across your blog and love it, finding it very well written and informative, thank you!<br /><br />Question about the above (possibly a dumb one, but whatever): where are you getting the "serviceLocator" from?Mike Briahttps://www.blogger.com/profile/10526104657156115391noreply@blogger.comtag:blogger.com,1999:blog-1557780184357927241.post-72885036037660571232009-01-23T22:45:00.000+05:302009-01-23T22:45:00.000+05:30Your tutorial is really good.I'm using more comman...Your tutorial is really good.<BR/>I'm using more commands than before.<BR/><BR/>But I think commands (or its handlers) cannot have a checked state. This is a limitation.David Pérezhttps://www.blogger.com/profile/08658630846028197392noreply@blogger.comtag:blogger.com,1999:blog-1557780184357927241.post-17061994201429866482009-01-17T23:29:00.000+05:302009-01-17T23:29:00.000+05:30I've enjoyed this tutorial but there is one elemen...I've enjoyed this tutorial but there is one element of the new command framework that you have not covered. I've also searched other resources and have not found my answer. I have also experimented with code and have not solved my problem. This makes me conclude that the answer is so obvious I can't see it or that there is no answer. Perhaps you can help distinguish.<BR/><BR/>Using the command framework I have not been able to add, using only plugin.xml entries, an ability to add toolbar menu items to a specific page of of a pagebook view. The Eclipse PDE implements, in code, various contributing content outline pages for the outline view. When no editor is open the outline view has no toolbar items. Depending on the file opened for edit, the icons in the views toolbar change to suit the file. Can that be done for a new contributing page using only command framework entries? I also want to implement the same behavior in my own pagebook views.Charles Godwinhttps://www.blogger.com/profile/14025946303723346417noreply@blogger.comtag:blogger.com,1999:blog-1557780184357927241.post-1746126166778149722009-01-17T22:36:00.000+05:302009-01-17T22:36:00.000+05:30Oh, one other thing. Key binding could use the sam...Oh, one other thing. Key binding could use the same treatment. It seems that there's no programmatic way to change them, but it would be reassuring to here that from an expert.Benson Margulieshttps://www.blogger.com/profile/12323408246739646407noreply@blogger.comtag:blogger.com,1999:blog-1557780184357927241.post-65500378409361968502009-01-17T22:35:00.000+05:302009-01-17T22:35:00.000+05:30There's also obtaining the command service from th...There's also obtaining the command service from the site, right? Does this automatically scope any changes to the part? If, for example, I want an editor to set some handlers that are only live for that editor, what's the correct procedure?Benson Margulieshttps://www.blogger.com/profile/12323408246739646407noreply@blogger.comtag:blogger.com,1999:blog-1557780184357927241.post-23069878382986173312009-01-11T04:15:00.000+05:302009-01-11T04:15:00.000+05:30Hi Prakash,your HOWTO for the commands is realy go...Hi Prakash,<BR/>your HOWTO for the commands is realy good. So now I have changed many actions in my own programm to commands. <BR/>But I have one question, how can I activate / make visible an command in an special perspektive for example "open file" to that i can open an file editor.<BR/>But in other perspectives you dont see this command?<BR/><BR/>Greetings<BR/>HeikoAnonymousnoreply@blogger.com