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.
Subject: Re: [openide-dev] how do I over write column definition in ColumnModels Date: Wed, 20 Jul 2005 12:24:48 -0700 (PDT) From: Ivan Soleimanipour <ivan@djomolungma.sfbay.sun.com> To: debugger_core@sun.com >> > Date: Tue, 19 Jul 2005 19:08:57 -0700 > From: CHIHIN KO <CHIHIN.KO@Sun.COM> > To: dev@openide.netbeans.org > Subject: [openide-dev] how do I override column definition in ColumnModels > > In NB 4.x base, the definition of columns in debuggercore > org.netbeans.modules.debugger.ui.models.ColumnModels > is not exactly what I need, how do I override some of them ? > To further refine the problem ... org.netbeans.spi.debugger.ui .Constants defines a collection of "columns", like THREAD_STATE_COLUMN_ID that are predefined by debuggercore. We're finding that some of these are unneccessary for us, like LOCALS_TO_STRING_COLUMN_ID , while for others we need different column properties. In this case we'd like to alter the propertyEditors for these columns. Unlike models, ColumnModel has no filtering capability. I recall raising similar issues with Hanz ~ Nov2004 and the tendency was "if the column doesn't fit" we'll remove it from the default list. But that won't solve the overriding problem. One crude way to fix this would be have ColumnModel have a "enabled" method. That way we could return false for all debuggercore predefined properties that we don't want. We could also return false for all the ones which we want to change and just re-define our own.
Can not you define your own implementation of ColumnModel, which returns some new column definition as getID()? Then your TableModel can compare the columnID to that... I've searched for usages of e.g. THREAD_STATE_COLUMN_ID, and found: org.netbeans.modules.debugger.jpda.ui.models.ThreadsTableModel, org.netbeans.modules.debugger.jpda.ui.models.MonitorModel, org.netbeans.modules.debugger.ui.models.ColumnModels.ThreadStateColumn, org.netbeans.modules.debugger.ui.models.ColumnModels.ThreadSuspendedColumn. Therefore there's no centralized collection column IDs. If I get it right, you're free to add yours... The column models for threads are defined in org.netbeans.spi.viewmodel.ColumnModel file in META-INF/debugger/ThreadsView. So I suppose that this way you can add new columns. And you can also remove existing by appending "-hidden" to the desired column model. Please elaborate if this is not sufficient.
> I've searched for usages of e.g. THREAD_STATE_COLUMN_ID, and found: > org.netbeans.modules.debugger.jpda.ui.models.ThreadsTableModel, > org.netbeans.modules.debugger.jpda.ui.models.MonitorModel, > org.netbeans.modules.debugger.ui.models.ColumnModels.ThreadStateColumn, > org.netbeans.modules.debugger.ui.models.ColumnModels.ThreadSuspendedColumn. > > Therefore there's no centralized collection column IDs. If I get it right, > you're free to add yours... The references in jpda.ui.models are ... references. There's one common/centralized _definition_ in debugger.ui.models. We know how to add new columns. We need to customize existing columns. How would you solve the following in jpda: Assign a different property editor to THREAD_STATE so it renders in some other way (an icon for example). Please consider this in the interest of the completeness of the modelview API and not just for us. In the interim, how does this "-hidden" trick work? Can you be more pedantic?
> The references in jpda.ui.models are ... references. > There's one common/centralized _definition_ in debugger.ui.models. Well, my point was, that the models use just Strings, so it does not matter whether they are defined somewhere or not. They can agree on different Strings if they want to... > We need to customize existing columns. Just remove the existing and add a new one. > In the interim, how does this "-hidden" trick work? Just append "-hidden" after the service you wand to disable. > Please consider this in the interest of the completeness of the modelview > API and not just for us. Since it's possible to remove and add columns, you can actually achieve replacement that way. IMHO it's not necessary to change the viewmodel API. I'm going to attach a module that demonstrates how to do that...
Created attachment 24101 [details] A simple module, that demonstrates column replacement.
FYI: disabling some service causes issue #62714. It just prints something to the console, but does not hurt anything.
"-hidden" mechanism works fine except it introduced following Exception, is this expected ? java.lang.ClassNotFoundException: org.netbeans.modules.debugger.ui.models.ColumnModels$LocalsTypeColumn-hidden at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:151) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at org.netbeans.api.debugger.Lookup$MetaInf.createInstance(Lookup.java:222) at org.netbeans.api.debugger.Lookup$MetaInf.lookup(Lookup.java:149) at org.netbeans.api.debugger.Lookup$Compound.lookup(Lookup.java:97) at org.netbeans.api.debugger.Lookup$Compound.lookup(Lookup.java:96) at org.netbeans.api.debugger.Lookup.lookup(Lookup.java:49) at org.netbeans.api.debugger.DebuggerEngine.lookup(DebuggerEngine.java:165) at org.netbeans.modules.debugger.ui.views.ViewModelListener.updateModel(ViewModelListener.java:106) at org.netbeans.modules.debugger.ui.views.ViewModelListener.propertyChange(ViewModelListener.java:89) at org.netbeans.api.debugger.DebuggerManager.firePropertyChange(DebuggerManager.java:522) at org.netbeans.api.debugger.DebuggerManager.updateCurrentEngine(DebuggerManager.java:1039) at org.netbeans.api.debugger.DebuggerManager.setCurrentSession(DebuggerManager.java:364) at org.netbeans.api.debugger.DebuggerManager.startDebugging(DebuggerManager.java:314) at com.sun.tools.debugger.dbxgui.debugger.DbxDebuggerManager.debugNoAsk(DbxDebuggerManager.java:397) at com.sun.tools.debugger.dbxgui.debugger.DbxDebuggerManager.debug(DbxDebuggerManager.java:375) at com.sun.tools.debugger.dbxgui.debugger.actions.LoadProgramAction.debug(LoadProgramAction.java:324) at com.sun.tools.debugger.dbxgui.debugger.actions.LoadProgramAction.performAction(LoadProgramAction.java :261)
This is what I mentioned. It's described in issue #62714 and fixed in 4.2 dev builds. It's harmless.
How does this colume customization work in NB6.0, the service defined in org.netbeans.spi.viewmodel.ColumnModel is not a collection of inner class anymore, but a collection of method calls, e.q. org.netbeans.modules.debugger.ui.models.ColumnModels.createThreadStateColumn() org.netbeans.modules.debugger.ui.models.ColumnModels.createThreadSuspendedColumn() org.netbeans.modules.debugger.ui.models.ColumnModels.createDefaultThreadColumn() and how do I disable org.netbeans.modules.debugger.ui.models.ColumnModels.createThreadStateColumn() ?
Not much has changed, the pattern is still the same. Use -hidden suffix. Like: org.netbeans.modules.debugger.ui.models.ColumnModels.createThreadStateColumn()-hidden Resolving back to original "RESOLVED WONTFIX".
org.netbeans.modules.debugger.ui.models.ColumnModels.createThreadStateColumn()-hidden does not not work for NB current version.
What is the "current" version? 5.0 or 5.5 or dev? Can you please specify the build number? I've tried it in a ~1 month old dev build and it worked fine.
It's the dev version, a snapshot of NB trunk dated 4/26/2006
I debugged the source codes in org.netbeans.api.debugger.Lookup.MetaInf.lookup, and found that it did find the my META-INF data that I specified to hide : org.netbeans.modules.debugger.ui.models.ColumnModels.createThreadStateColumn()-hidden but after that it also find org.netbeans.modules.debugger.ui.models.ColumnModels.createThreadStateColumn() in debuggercore META-INF and create this "State" column for ThreadsView, which is something I DO NOT want, what to do ?
Martin, Do you agree with my investigation ? if you do, can you provide a solution ?
I was on vacation. I'll look at it today and will let you know...
Well, I agree that there are some strange parts in the Lookup class. For instance, there is a method getHiddenItems(), which is never used anywhere. But I was not able to reproduce the problem you describe - at line 150 there is a check for the presence of <class name>-hidden before the <class name> is instantiated. So this should work fine if but the "<class name>-hidden" and "<class name>" are in the same folder for the same service. Are you sure, that you put the "<class name>-hidden" line into the same service that defines the original class name? For the attached threadstate.zip module this works fine, when it uses the same folder and service name, which defines the column in debuggercore module.
This is what I defined in my META-INF/debugger/netbeans-GdbDebuggerEngine/ThreadsView/org.netbeans.spi.viewmodel.ColumnModel you can see that I defined my own columns for ThreadsView, and want to hide "State" and "Suspended" columns that are from debuggercore, but in the ThreadsView, I did have all the columns that I defined, PLUS the "State" and "Suspended" columns that I want to hide, Is something wrong here ? com.sun.tools.debugger.dbxgui.debugger.ThreadColumnModels$ExecutingFunction com.sun.tools.debugger.dbxgui.debugger.ThreadColumnModels$Address com.sun.tools.debugger.dbxgui.debugger.ThreadColumnModels$File com.sun.tools.debugger.dbxgui.debugger.ThreadColumnModels$Line org.netbeans.modules.debugger.ui.models.ColumnModels.createThreadStateColumn()-hidden org.netbeans.modules.debugger.ui.models.ColumnModels.createThreadSuspendedColumn()-hidd en
Aha, I see. The two lines that hide the original column need to be in META-INF/debugger/ThreadsView/org.netbeans.spi.viewmodel.ColumnModel file, where the original columns are defined. Otherwise the lookup logic will not find it. So you need to files: META-INF/debugger/ThreadsView/org.netbeans.spi.viewmodel.ColumnModel with: org.netbeans.modules.debugger.ui.models.ColumnModels.createThreadStateColumn()-hidden org.netbeans.modules.debugger.ui.models.ColumnModels.createThreadSuspendedColumn()-hidden and META-INF/debugger/netbeans-GdbDebuggerEngine/ThreadsView/org.netbeans.spi.viewmodel.ColumnModel with: com.sun.tools.debugger.dbxgui.debugger.ThreadColumnModels$ExecutingFunction com.sun.tools.debugger.dbxgui.debugger.ThreadColumnModels$Address com.sun.tools.debugger.dbxgui.debugger.ThreadColumnModels$File com.sun.tools.debugger.dbxgui.debugger.ThreadColumnModels$Line If we should change this so that it would work also in your case, we'd have to enhance the Lookup APIs to provide the classes which are hidden - in other words change getHiddenItems() to be public. I do not like much this change, because it needs some extra logic and searches in more folders for each service. So we can change this to an enhancement if you really need it, but I'd rather leave things as they are.
After I moved <column>-hidden to META-INF/debugger/ThreadsView/org.netbeans.spi.viewmodel.ColumnModel it works fine now.
Thanks for letting us know chihinko. Verifying then ...
Reopening the issue. I'm working on the BPEL Debugger, which is a part of the enterprise pack. And I would like to reuse most of the standard debugger views but to override or hide some columns _when BPEL Debugger Session is active_. The approach that chihinko has eventually chosen wouldn't work for us since it would lead to hiding the standard columns for all debuggers, even for Java Debugger, which is not acceptable. Currently, to workaround this issue we had to create a new "BPEL Variables" view which provides the custom editor for the "Value" column. But it doesn't seem to be a best approach since users may get confused of having two views: "Local Variables" and "BPEL Variables". We also would like to customize the "Watches" view the same way and really really don't want to have another "BPEL Watches" view.
O.K., so now it's not a defect, but a request for enhancement. I understand that this is necessary, we need it as well in ANT debugger (issue #63083). We'll find a solution into NB 6.0.
So, this is hopefully resolved sufficiently for all debuggers now: The Lookup is enhanced to assure that "-hidden" suffix works globally. So far the scope was the current folder only. Now you can define <Some column that is not desired>-hidden in any folder under META-INF/debugger and the appropriate column will not be visible when the ...-hidden item is in effect (so it can be e.g. session-specific). This provides better flexibility to debugger implementations, which can hide global columns, while not affecting others. /cvs/debuggercore/api/src/org/netbeans/api/debugger/Lookup.java,v <-- Lookup.java new revision: 1.14; previous revision: 1.13 /cvs/debuggercore/src/org/netbeans/modules/debugger/ui/models/ColumnModels.java,v <-- ColumnModels.java new revision: 1.11; previous revision: 1.10 /cvs/debuggercore/viewmodel/src/org/netbeans/modules/viewmodel/Column.java,v <-- Column.java new revision: 1.6; previous revision: 1.5 /cvs/debuggercore/viewmodel/src/org/netbeans/modules/viewmodel/TreeTable.java,v <-- TreeTable.java new revision: 1.27; previous revision: 1.26
*** Issue 78609 has been marked as a duplicate of this issue. ***
FYI: The ANT debugger now demonstrates the usage of this fix - see issue #63083.
We are planning a number of improvements in the BPEL Debugger for 5.5.1 release which are related to variables and watches. Theese improvements could be implemented for "BPEL Variables" view (similar to "Local Variables", but with a different custom editor and columns) no problem but not for "Watches" view (since nobody would want another "BPEL Wathces" view). Is it possible to integrate a fix in release551 branch as well?
I didn't really mean to reopen it - just wanted to draw your attention. Please see my last comment. Could you please confirm can the fix be put into release551 branch?
I'm just preparing a backport of all resolved issues with MARS keyword... Changing back as FIXED.
Created attachment 37324 [details] The patch for release551 branch
Review: The fix is safe enough for integration into NB 5.5.1
This looks like clear API change. Am I the only one to notice that - e.g. Martin, Roman, are you saying you did not think of this as an API change? As an API change, I miss it being documented, tested, reviewed - this is probably a defect given the fact that change is already integrated in trunk. Please fix these missing aspects in trunk before integrating anything to release551
Well, we do not see this as an API change, it's rather "fix" of the behavior of "-hidden" concept, which had limited usability. This change does not break anything, it will only allow more wide usage of hiding of services from other modules. The information about the services registry is elaborated and added into the architecture description: /cvs/debuggercore/api/src/org/netbeans/spi/debugger/package.html,v <-- package.html new revision: 1.4; previous revision: 1.3 /cvs/debuggercore/api/arch.xml,v <-- arch.xml new revision: 1.16; previous revision: 1.15
The fix is merged into release551 branch: Checking in debuggercore/api/src/org/netbeans/api/debugger/Lookup.java; /shared/data/ccvs/repository/debuggercore/api/src/org/netbeans/api/debugger/Lookup.java,v <-- Lookup.java new revision: 1.10.2.1.2.1.22.1; previous revision: 1.10.2.1.2.1 done Checking in debuggercore/src/org/netbeans/modules/debugger/ui/models/ColumnModels.java; /shared/data/ccvs/repository/debuggercore/src/org/netbeans/modules/debugger/ui/models/ColumnModels.java,v <-- ColumnModels.java new revision: 1.6.36.1.2.1.22.1; previous revision: 1.6.36.1.2.1 done Checking in debuggercore/viewmodel/src/org/netbeans/modules/viewmodel/Column.java; /shared/data/ccvs/repository/debuggercore/viewmodel/src/org/netbeans/modules/viewmodel/Column.java,v <-- Column.java new revision: 1.3.70.1.22.1; previous revision: 1.3.70.1 done Checking in debuggercore/viewmodel/src/org/netbeans/modules/viewmodel/TreeTable.java; /shared/data/ccvs/repository/debuggercore/viewmodel/src/org/netbeans/modules/viewmodel/TreeTable.java,v <-- TreeTable.java new revision: 1.21.6.1.2.1.22.1; previous revision: 1.21.6.1.2.1
Verified ... and Closing all issues resolved into NetBeans 6.7 and earlier.