Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Action.setAccelerator() has no effect
Action.setAccelerator() has no effect [message #231787] Tue, 20 April 2004 11:51 Go to next message
Eclipse UserFriend
Originally posted by: martin.kadlec.oseg.org

hi,

I am having troubles binding my global actions to accelerator-keys.

<code>
public static Action CUT = new Action() {
public void runWithEvent(Event event) {
logger.debug("running action: CUT");
Control c = event.display.getFocusControl();
if (c instanceof Text) {
Text text = (Text) c;
text.cut();
}
}
};

public static void init() {
CUT.setAccelerator(SWT.CTRL | 'x');
}

public static void registerActions(IActionBars actionBars) {
actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(),
GlobalActions.CUT);
}
</code>

does not work. I can access this action pressing CTRL+SHIFT+X, but I can
do so even if I don't call <code>CUT.setAccelerator(SWT.CTRL | 'x');</code>

What am I doing wrong?

thanks
Maka
Re: Action.setAccelerator() has no effect [message #232204 is a reply to message #231787] Wed, 21 April 2004 05:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: martin.kadlec.oseg.org

addOn:

I think I forgot to mention some things (:
I am
<> using eclipse3.0M8 as RCP
<> using my own editor 'class FormEditor extends EditorPart'
<> I do have to implement the Actions (even CUT, COPY etc.) for my own
<> not able to set the accelerator-keys for some reason

again the code:
<code>
public static Action CUT = new Action() {
public void runWithEvent(Event event) {
logger.debug("running action: CUT");
Control c = event.display.getFocusControl();
if (c instanceof Text) {
Text text = (Text) c;
text.cut();
}
}
};

public static void init() {
CUT.setAccelerator(SWT.CTRL | 'x');
}

public static void registerActions(IActionBars actionBars) {
actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(),
GlobalActions.CUT);
}
</code>

any ideas?
Re: Action.setAccelerator() has no effect [message #236347 is a reply to message #232204] Thu, 29 April 2004 07:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mark.jentz.tietoenator.com

I can report that I am struggling with the exact same problem. I am also
using M8 with RCP. Any answers would be greatly appreciated! :D


Martin Kadlec wrote:
> addOn:
>
> I think I forgot to mention some things (:
> I am
> <> using eclipse3.0M8 as RCP
> <> using my own editor 'class FormEditor extends EditorPart'
> <> I do have to implement the Actions (even CUT, COPY etc.) for my own
> <> not able to set the accelerator-keys for some reason
>
> again the code:
> <code>
> public static Action CUT = new Action() {
> public void runWithEvent(Event event) {
> logger.debug("running action: CUT");
> Control c = event.display.getFocusControl();
> if (c instanceof Text) {
> Text text = (Text) c;
> text.cut();
> }
> }
> };
>
> public static void init() {
> CUT.setAccelerator(SWT.CTRL | 'x');
> }
>
> public static void registerActions(IActionBars actionBars) {
> actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(),
> GlobalActions.CUT);
> }
> </code>
>
> any ideas?
>
Re: Action.setAccelerator() has no effect [message #236913 is a reply to message #236347] Thu, 29 April 2004 12:39 Go to previous message
Eclipse UserFriend
I had the same problem. Deleting the configuration directory helped. Don't
ask me for the real cause, cause I don't have a clue.

> I can report that I am struggling with the exact same problem. I am also
> using M8 with RCP. Any answers would be greatly appreciated! :D
>
>
> Martin Kadlec wrote:
>> addOn:
>>
>> I think I forgot to mention some things (:
>> I am <> using eclipse3.0M8 as RCP
>> <> using my own editor 'class FormEditor extends EditorPart'
>> <> I do have to implement the Actions (even CUT, COPY etc.) for my own
>> <> not able to set the accelerator-keys for some reason
>>
>> again the code:
>> <code>
>> public static Action CUT = new Action() {
>> public void runWithEvent(Event event) {
>> logger.debug("running action: CUT");
>> Control c = event.display.getFocusControl();
>> if (c instanceof Text) {
>> Text text = (Text) c;
>> text.cut();
>> }
>> }
>> };
>> public static void init() {
>> CUT.setAccelerator(SWT.CTRL | 'x');
>> }
>> public static void registerActions(IActionBars actionBars) {
>> actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(),
>> GlobalActions.CUT);
>> }
>> </code>
>>
>> any ideas?
>>
>
Previous Topic:Applets run in servers
Next Topic:Importing Packages with Eclipse
Goto Forum:
  


Current Time: Thu Jul 17 13:31:28 EDT 2025

Powered by FUDForum. Page generated in 0.09340 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top