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.
<description>
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.
</description>
<class package="org.openide.windows" name="TopComponent"/>
<issue number="199452"/>
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
}
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).
contents(modeFile(info.preferredID(), reg.openAtStartup()));
modeFile.write();
for (Element e : roundEnv.getElementsAnnotatedWith(TopComponent.OpenActionRegistration.class)) {
TopComponent.OpenActionRegistration reg = e.getAnnotation(TopComponent.OpenActionRegistration.class);
/** 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.
public void testTCRegisteredInRoleFine() throws Exception {
FileObject set = FileUtil.getConfigFile("Windows2/Roles/UnitTestRole/Components/my-tc2.settings");
FileObject set1 = FileUtil.getConfigFile("Windows2/Roles/UnitTestRole1/Components/my-tc2.settings");
assertNotNull("Settings file found", set);
assertNotNull("Settings file found", set1);
assertValidate(set.asText());
assertValidate(set1.asText());
FileObject set2 = FileUtil.getConfigFile("Windows2/Roles/UnitTestRole2/Components/my-tc2.settings");
assertNotNull("Settings file found", set2);
public void testTCRegisteredFine() throws Exception {
@TopComponent.Registration(
mode="output",
openAtStartup=false,
role="UnitTestRole"
roles={"UnitTestRole1", "UnitTestRole2"}
)
@TopComponent.Description(
preferredID="my-tc2", iconBase="org/openide/windows/Icon.png"