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 98432

Summary: Some platform apps cannot use ide/applemenu because of dependencies on editor
Product: ide Reporter: _ tboudreau <tboudreau>
Component: CodeAssignee: issues@ide <issues>
Status: RESOLVED FIXED    
Severity: blocker CC: apireviews, jtulach, tor, vstejskal
Priority: P2 Keywords: API_REVIEW_FAST
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: Patch removing editor dependencies from ide/applemenu
Module to unzip into ide/applemenu (also delete the keybinding xml files from ide/applemenu)
Improved ide/applemenu/editor (category & descriptions added)
Patch to nbbuild to move ide/applemenu to platform cluster and ide/applemenu/editor to an appropriate place
Diff to ide/ including changes in golden deps files

Description _ tboudreau 2007-03-21 10:16:55 UTC
ide/applemenu provides Mac-OS specific keybinding customizations and support for
apple-specific things like Mac-OS application events.

It also customizes the keybindings for the editor.  This causes an unfortunate
dependency on some editor stuff that many apps don't need.  The editor-specific
customizations should be split out into a separate module.
Comment 1 _ tboudreau 2007-03-21 10:29:06 UTC
Created attachment 39741 [details]
Patch removing editor dependencies from ide/applemenu
Comment 2 _ tboudreau 2007-03-21 10:30:31 UTC
Created attachment 39742 [details]
Module to unzip into ide/applemenu (also delete the keybinding xml files from ide/applemenu)
Comment 3 _ tboudreau 2007-03-21 10:31:27 UTC
The attached patches need testing on a mac, but should do the job.  Only other
thing should be to add it to nbbuild.
Comment 4 Torbjorn Norbye 2007-03-21 15:33:53 UTC
I guess we need a new bridge module which bridges ide/applemenu and java/editor providing the java 
specific keybindings?
Comment 5 _ tboudreau 2007-03-21 20:28:16 UTC
Pretty much.  That's what the zip attachment is (though not marked as eager).
Comment 6 _ tboudreau 2007-03-27 19:51:16 UTC
Created attachment 40053 [details]
Improved ide/applemenu/editor (category & descriptions added)
Comment 7 _ tboudreau 2007-03-27 19:52:11 UTC
Created attachment 40054 [details]
Patch to nbbuild to move ide/applemenu to platform cluster and ide/applemenu/editor to an appropriate place
Comment 8 _ tboudreau 2007-03-27 19:53:58 UTC
I'd be happy to integrate this;  I'm not sure anyone looks at issues filed
against the ide component in IZ.

Adding Jarda to cc since this change affects the contents of the platform and
other clusters, and I'm not sure if that means we need to rev the version number
for that or something such.

Jarda, could you review the nbbuild patch?
Comment 9 _ tboudreau 2007-03-27 20:07:56 UTC
Well, one problem with it:  I get a popup message that no module providing the
capability org.openide.modules.os.MacOSX is installed.

Any idea how to make that go away (or why ide/applemenu does fail silently but
this module doesn't - is something hardcoded somewhere?).
Comment 10 _ tboudreau 2007-03-27 20:49:39 UTC
Created attachment 40055 [details]
Diff to ide/ including changes in golden deps files
Comment 11 Jaroslav Tulach 2007-03-29 08:45:35 UTC
Y01 Move ide/applemenu to core/applemenu - traditionally ide.netbeans.org 
contains things that go to nbX.Y cluster. Moreover right now platform is 
placed in core,openide,projects,libs,nbbuild and nowhere else. That is why I 
suggest to move the platform part into core.

Y02 Would not it be better to work on a branch in CVS?

Comment 12 Vitezslav Stejskal 2007-03-30 00:17:01 UTC
The editor keybindings files don't have to be placed in ide/applemenu anymore.
They can go to their respective modules (editor and java/editor). In fact the
ide/applemenu no longer depends on editor and java/editor modules and the only
reason why I didn't move the keybindings files was that I tried to minimize my
changes.

So, if people are happy with it I'll move the kebindings files to editor and
java/editor modules. Then ide/applemenu will only contain general (core) stuff
and we can add it to the platform.

Re. moving ide/applemenu to core/applemenu - I don't really care, but imo it is
not neccessary. Btw. editor/mimelookup is part of the platform too.
Comment 13 Torbjorn Norbye 2007-03-30 00:44:03 UTC
Hi Vita,
can you explain what a module owner needs to do to add Mac-specific keybindings to his/her module?

Let's say I have an action named "foo" which I want to map to Alt-G on all platforms but Shift-Command-X 
on Mac. What do I put in my keybindings xml file?
Comment 14 Vitezslav Stejskal 2007-03-30 01:18:55 UTC
The editor/settings/storage module now supports platform specific files. The
full description is in the module's arch document. Unfortunately, I just noticed
that this module's javadoc is not published on nb.org, so I'll briefly explain
it here and publish the javadoc later (or you can generate it locally if you want).

Basically, you need to place Mac specific keybindings to an extra file and mark
that file with nbeditor-settings-TargetOS attribute. The value of this attribute
is the string name of one of the OS_* constants in o.o.util.Utilities class. Any
file with this attribute is ignored on platforms that do not match the
attribute, if the platform matches the file will be loaded, but *after* loading
all platform independent files first. So, in your example the file would contain
something like:

<bindings>
    <bind key="O-G" remove="true"/>
    <bind key="S-M-X actionName="foo"/>
</bindings>

and in the layer the file would be defined like:

<file name="whatever-you-like.xml" url="...">
    <attr name="nbeditor-settings-TargetOS" stringvalue="OS_MAC"/>
</file>
Comment 15 _ tboudreau 2007-03-30 03:19:57 UTC
And this mechanism lets you not only add/change keybindings, but also delete
keybindings?  I can't offhand think of any we need to be able to delete for Mac
OS, but it would be good to know if this is a complete solution.

Please do remove the keybindings files from ide/applemenu if they really don't
need to be there.

Comment 16 Vitezslav Stejskal 2007-03-30 03:37:54 UTC
Yes, you can remove keybindings. The previous example *removes* 'O-G' keybinding
and *adds* 'SM-X' keybinding. These two operations are independent of course.

Ok, I'll move the files.
Comment 17 Vitezslav Stejskal 2007-03-30 04:30:22 UTC
Files moved.

RCS file:
/cvs/java/editor/src/org/netbeans/modules/java/editor/resources/DefaultKeyBindings-Mac.xml,v
done
Checking in
dev/java/editor/src/org/netbeans/modules/java/editor/resources/DefaultKeyBindings-Mac.xml;
/cvs/java/editor/src/org/netbeans/modules/java/editor/resources/DefaultKeyBindings-Mac.xml,v
 <--  DefaultKeyBindings-Mac.xml
initial revision: 1.1
done
Checking in
dev/java/editor/src/org/netbeans/modules/java/editor/resources/layer.xml;
/cvs/java/editor/src/org/netbeans/modules/java/editor/resources/layer.xml,v  <--
 layer.xml
new revision: 1.22; previous revision: 1.21
done
Removing
dev/ide/applemenu/src/org/netbeans/modules/applemenu/AllEditorsKeyBindings.xml;
/cvs/ide/applemenu/src/org/netbeans/modules/applemenu/AllEditorsKeyBindings.xml,v
 <--  AllEditorsKeyBindings.xml
new revision: delete; previous revision: 1.1
done
Checking in dev/ide/applemenu/src/org/netbeans/modules/applemenu/layer.xml;
/cvs/ide/applemenu/src/org/netbeans/modules/applemenu/layer.xml,v  <--  layer.xml
new revision: 1.13; previous revision: 1.12
done
Removing dev/ide/applemenu/src/org/netbeans/modules/applemenu/JavaKeyBindings.xml;
/cvs/ide/applemenu/src/org/netbeans/modules/applemenu/JavaKeyBindings.xml,v  <--
 JavaKeyBindings.xml
new revision: delete; previous revision: 1.1
done
Checking in dev/editor/src/org/netbeans/modules/editor/resources/layer.xml;
/cvs/editor/src/org/netbeans/modules/editor/resources/layer.xml,v  <--  layer.xml
new revision: 1.90; previous revision: 1.89
done
RCS file:
/cvs/editor/src/org/netbeans/modules/editor/resources/NetBeans-keybindings-mac.xml,v
done
Checking in
dev/editor/src/org/netbeans/modules/editor/resources/NetBeans-keybindings-mac.xml;
/cvs/editor/src/org/netbeans/modules/editor/resources/NetBeans-keybindings-mac.xml,v
 <--  NetBeans-keybindings-mac.xml
initial revision: 1.1
done
Comment 18 Jaroslav Tulach 2007-04-16 10:14:25 UTC
So I guess the dependencies are ok. I have moved the module to platfrom as 
part of issue 96221.