This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 46904 - Allow platform specific shortcut declarations
Summary: Allow platform specific shortcut declarations
Status: RESOLVED DUPLICATE of bug 46811
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 3.x
Hardware: PC All
: P2 blocker (vote)
Assignee: _ tboudreau
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-04 18:24 UTC by Peter Zavadsky
Modified: 2008-12-22 16:43 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Zavadsky 2004-08-04 18:24:52 UTC
There is an issue to provide platform specific
shorcuts. The problem is visible on MAC
especially. On MAC are actions typically mapped to
Meta-<something> instead of Ctrl-<something>.

Current implementation of "Shortcuts" folder
doesn't allow the platform specific declarations.
I guess the main problem of current solution is
that the shortcut is encoded into file name in the
layer.

I.e. current shortcut declaration is like this:

<file name="C-X.instance">
    <attr name="instanceClass"
stringvalue="someAction" />
</file>

-----------------------------------

For our purpose we created a hack whic looks like
this:

<file name="C-X.instance">
    <attr name="instanceClass"
stringvalue="someAction" />
    <attr name="shortcutMAC" stringvalue="M-X"/>
</file>

The value of attr shortcutMAC is then used instead
  of the name when running on MAC. 
But this solution is not 100%, and cannot be
applied to NB (When user tries to create the C-X
binding, it won't be saved, because the name is
already used [and interpretted other way]).

------------------------------------------------

Suggestions to possible solutions.

1) Dont use the shortcut encoding as a file name,
rather put the platform specific shortcut
encodings as the attributes, there could be used
default shortcut too:

<file name="someShortcut.instance">
    <attr name="instanceClass"
stringvalue="someAction" />
    <attr name="shortcutDefault" stringvalue="C-X"/>
    <attr name="shortcutMAC" stringvalue="M-X"/>
</file>

And then act accordingly to the platform, picking
up correct attribute and creating desired binding.
This requires to update the handling of the
"Shortcuts" folder.


2) Or another solution is to create subfolders
with platform specific shortcuts in "Shortcuts"
folder.

-----------------------

Those are just suggestions, I'd like probably the
solution 1). But you can come up certainly with
other solutions.
Comment 1 Marian Mirilovic 2004-09-07 17:39:23 UTC
Tim,
this is already done, isn't it ?
Comment 2 _ tboudreau 2004-09-08 10:33:18 UTC
Should be integrated this week.  Peter, quick info:

Shortcuts can now be defined as "D-X.instance" (D for Default) which will map to whatever 
Toolkit.getDefaultToolkit().getMenuShortcutMask() returns.

To add/remove shortcuts on a platform-specific basis, provide a module which does this 
in its layer, and use Openide-Module-Requires in its manifest - there are some per-os 
pseudo-services that will allow a module to be enabled only on certain platforms.  The 
module should be marked as "eager".  See ide/applemenu's manifest for an example.


*** This issue has been marked as a duplicate of 46811 ***
Comment 3 Peter Zavadsky 2004-09-08 17:33:08 UTC
Thanks Tim. I think we will basically use the ide/applemenu module, if
the stuff is already implemented there.
Comment 4 _ tboudreau 2004-09-08 21:16:31 UTC
Cool.  Tor mentioned some patch he did for Rave - I haven't looked at it yet.  It would be 
good to know if there are any keybindings I missed - these things are hard to track down, 
and I haven't been a mac user for so long.  Apple has some recommendations, but it 
doesn't necessarily cover everything.