diff -r 13c497c2e4c9 openide.windows/apichanges.xml --- a/openide.windows/apichanges.xml Wed Oct 12 12:15:11 2011 +0200 +++ b/openide.windows/apichanges.xml Wed Oct 12 15:26:23 2011 +0200 @@ -60,7 +60,8 @@ Since the window system now supports multiple window layouts - roles - the annotation for TopComponent registration needs an optional parameter - to specify the role the window should belong to. + to specify one or more roles the window should belong to. If no roles + are specified, the TopComponent is registered in the default layout. diff -r 13c497c2e4c9 openide.windows/manifest.mf --- a/openide.windows/manifest.mf Wed Oct 12 12:15:11 2011 +0200 +++ b/openide.windows/manifest.mf Wed Oct 12 15:26:23 2011 +0200 @@ -1,6 +1,6 @@ Manifest-Version: 1.0 OpenIDE-Module: org.openide.windows -OpenIDE-Module-Specification-Version: 6.46 +OpenIDE-Module-Specification-Version: 6.47 OpenIDE-Module-Localizing-Bundle: org/openide/windows/Bundle.properties AutoUpdate-Essential-Module: true diff -r 13c497c2e4c9 openide.windows/src/org/netbeans/modules/openide/windows/TopComponentProcessor.java --- a/openide.windows/src/org/netbeans/modules/openide/windows/TopComponentProcessor.java Wed Oct 12 12:15:11 2011 +0200 +++ b/openide.windows/src/org/netbeans/modules/openide/windows/TopComponentProcessor.java Wed Oct 12 15:26:23 2011 +0200 @@ -87,7 +87,8 @@ } String id = info.preferredID().replace('.', '-'); - String role = reg.role(); + String[] roles = reg.roles(); + for (String role : roles){ String rootFolder = role.isEmpty() ? "Windows2" : "Windows2/Roles/" + role; File settingsFile = layer(e). @@ -101,6 +102,7 @@ contents(modeFile(info.preferredID(), reg.openAtStartup())); modeFile.write(); } + } for (Element e : roundEnv.getElementsAnnotatedWith(TopComponent.OpenActionRegistration.class)) { TopComponent.OpenActionRegistration reg = e.getAnnotation(TopComponent.OpenActionRegistration.class); diff -r 13c497c2e4c9 openide.windows/src/org/openide/windows/TopComponent.java --- a/openide.windows/src/org/openide/windows/TopComponent.java Wed Oct 12 12:15:11 2011 +0200 +++ b/openide.windows/src/org/openide/windows/TopComponent.java Wed Oct 12 15:26:23 2011 +0200 @@ -1428,11 +1428,11 @@ /** Shall the component be opened at start */ boolean openAtStartup(); /** - * Window layout role or an empty string for the default layout + * Window layout roles or an empty string for the default layout * @see WindowManager#setRole(java.lang.String) * @since 6.45 */ - String role() default ""; + String[] roles() default ""; } /** Creates an action that can open the component. diff -r 13c497c2e4c9 openide.windows/test/unit/src/org/netbeans/modules/openide/windows/TopComponentProcessorTest.java --- a/openide.windows/test/unit/src/org/netbeans/modules/openide/windows/TopComponentProcessorTest.java Wed Oct 12 12:15:11 2011 +0200 +++ b/openide.windows/test/unit/src/org/netbeans/modules/openide/windows/TopComponentProcessorTest.java Wed Oct 12 15:26:23 2011 +0200 @@ -72,9 +72,11 @@ } public void testTCRegisteredInRoleFine() throws Exception { - FileObject set = FileUtil.getConfigFile("Windows2/Roles/UnitTestRole/Components/my-tc2.settings"); - assertNotNull("Settings file found", set); - assertValidate(set.asText()); + FileObject set1 = FileUtil.getConfigFile("Windows2/Roles/UnitTestRole1/Components/my-tc2.settings"); + assertNotNull("Settings file found", set1); + assertValidate(set1.asText()); + FileObject set2 = FileUtil.getConfigFile("Windows2/Roles/UnitTestRole2/Components/my-tc2.settings"); + assertNotNull("Settings file found", set2); } public void testTCRegisteredFine() throws Exception { @@ -169,7 +171,7 @@ @TopComponent.Registration( mode="output", openAtStartup=false, - role="UnitTestRole" + roles={"UnitTestRole1", "UnitTestRole2"} ) @TopComponent.Description( preferredID="my-tc2", iconBase="org/openide/windows/Icon.png"