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 245238 - Suffix to Restore hidden layer.xml entries (_hidden)
Summary: Suffix to Restore hidden layer.xml entries (_hidden)
Status: RESOLVED WORKSFORME
Alias: None
Product: platform
Classification: Unclassified
Component: Filesystems (show other bugs)
Version: 8.0.1
Hardware: PC All
: P3 normal with 1 vote (vote)
Assignee: Jaroslav Havlin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-25 15:53 UTC by sproger1
Modified: 2014-07-10 22:50 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sproger1 2014-06-25 15:53:57 UTC
There needs to be a mechanism for restoring a hidden menus, services .... that are hidden via the suffix '_hidden' in a layer.xml file. 

My application has a dependency on a module that hides several of the Menu entries in the menu bar (because that module didn't need those entries). 
e.g. 
My application has a dependency on ModuleA, 
<folder name="Menu">
  <folder name="Tools_hidden"/>
  <folder name="Edit_hidden"/>
</folder>

I would like for those menu items to be restored in my application, but keep the module dependency, but, there is currently no mechanism(that I can find after hours of seaching) for restoring the hidden menu items in the layer.xml. WHY? (or if I'm wrong, then what is it?). 

Please add a suffix (e.g. _show, _unhide...) or attribute entry that allows you to restore features that have been hidden in a module that you have a dependency on.

If you can hide a feature/menu by adding '_hidden', then there needs to be a way to unhide a feature via a similar manner. When developing modular applications you do not always have direct access to the source code for modules you depend on. The API if flexible in letting you modify(change displayname, icon, position...), and hide features(menus, services...) for things that are defined in modules you depend on, so why is there no 'unhide' or 'restore'?
Comment 1 Jaroslav Havlin 2014-07-10 15:44:34 UTC
Branding can be probably used to achieve this.

Let's assume that the module that hides the menu items is in JAR file com-modulea.jar, and its layer file has path com/modulea/layer.xml.

In your platform application, go to project properties, Application, select "Create standalone application" (I hope this suits your needs).

Go to Files view, expand your suite and create this directory path right under the project folder (i.e. next to nbproject folder):
branding/modules/com-modulea.jar/com/modulea/

Copy layer file from moduleA to the last folder in the created path.
Remove unwanted '<folder name="Something_hidden"/>' items from the copied file.

Rebuild and run, the menu items should be visible now.

BUT (!), the module that you depend on should not remove the menu entries if it is supposed to be reused in other applications. I think it should be split into two modules, one for API (reusable), and one for UI (which depends on the API).
I guess you cannot change this, so the workaround with branding should be sufficient, but splitting the module seems to be the optimal solution.

I think supporting the _show (or _unhide) suffix is not the right way to go. The structure of the system filesystem should be transparent, and the _show suffix would uncover its layered structure. The _hidden suffix just replaces the delete operation, which is also available in standard filesystems. We should rather design the modules correctly, so that hacks like _show are not necessary.
Comment 2 sproger1 2014-07-10 22:50:10 UTC
thanks Jaroslav, the branding workaround is good enough. Wasn't aware I could completely override/replace layer.xml files of modules I depend on via the branding module.