Friday, 3 August 2012

Binding a key sequence with an action in eclipse

Actions and Commands are two different things in eclipse plug-in/ RCP. Both have different mechanisms. Information related to binding keys to a command are easily available but if you want to bind an action to shortcut keys, you have to shed some sweat before you can get any helpful information. That’s why I have decided to do this blog post. It'll serve me as a book mark. If you have found this post to be useful do let me know.

The reality is you cant just bind shortcut keys to an action. You have to write a command for that too.  Which means you have an action, a command and a binding in your plugin.xml file.

In the definition id attribute of action specify the command ID of your command specified to your action. And in the command id of binding write the command id of command again.
That way when you press the keys your action will get executed.

Hope that helps

ge33ek

Thursday, 2 August 2012

Finally Chineese traslation of ge33ek bragging

在这篇文章中,我会吹嘘自己的第一个问题,我回答上StackOverFlow.com。最好的部分是被录取了,我的答案。问题是,如下:

我一直在这里的教程。在高级教程ResourceSelectionHistory的存储选定的项目,并在检索对话框时重新启动它。我希望ResourceSelectionHistory存储对象,并不仅仅是字符串,是有我的方式做到这一点。我也想项目,在编辑器中打开,当用户点击他们。当我点击一个项目在实际填充的列表,它会打开,而不是当我单击显示历史的一部分。

这里的人希望到IMemento告诉他什么类型的对象在历史中。至于谁首先回答了这个问题的人说,这些类是非常严格的。他们期望你做的只有他们想要你做什么。

我已经想通了,可以用来做什么要提问的方式:按照沿.....

您可以存储字符串,整数和布尔值IMemento。你可以巧妙地利用它们来揭示对象的类型。例如,你可以使用element.putInteger(“OBJTYPE”,1);如果你的对象是,说A型和element.putInteger(“OBJTYPE”,2);如果其B型的希望,帮助。

Japanese translation of Bragging ge33ek

この記事で私はStackOverFlow.comに答え、最初の質問を自慢でしょう。最良の部分は私の答えがあまりにも受け入れられてしまったということです。次のようによく質問されました:

私はここでチュートリアルに従ってきた。高度なチュートリアルResourceSelectionHistoryで選択した項目を保存し、ダイアログが再起動したときにそれを取得します。私はResourceSelectionHistoryオブジェクトを格納したいだけではなく、文字列が、私は方法それをするためにあります。私はまた、ユーザーがそれらをクリックしたときに、アイテムエディタで開きたい。私は実際の人口リスト内の項目をクリックしたときにそれは私が歴史を示す部分をクリックしたときに開きますが、できません。

ここで人がIMementoするオブジェクトのタイプが履歴に格納されたものを彼に伝えたいと考えています。最初の質問に答えた人はこれらのクラスは非常に限定的であると述べた。としてそして彼らはあなたが彼らはあなたがすればいいたいことだけを行うことを期待しています。

私は質問者がやりたいことするために使用することができる方法を考え出した。一緒に従ってください.....

あなたは、文字列、整数とIMementoにブール値を格納することができます。あなたが巧妙にオブジェクトの種類を明らかにするためにそれらを利用することができます。たとえば、element.putInteger(以下 "objTypeで"、1)使用することができます。そのタイプB.希望のに役立ちますその場合、タイプはとelement.putIntegerます( "objTypeで"、2)と言うのあなたのオブジェクトがある場合。