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 61319 - unable to override column definition in ColumnModels
Summary: unable to override column definition in ColumnModels
Status: CLOSED FIXED
Alias: None
Product: debugger
Classification: Unclassified
Component: Code (show other bugs)
Version: 5.x
Hardware: Sun All
: P2 blocker with 1 vote (vote)
Assignee: Martin Entlicher
URL:
Keywords:
: 78609 (view as bug list)
Depends on:
Blocks: 63083 89617
  Show dependency tree
 
Reported: 2005-07-22 23:55 UTC by Chihin Ko
Modified: 2010-04-29 09:23 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
A simple module, that demonstrates column replacement. (11.37 KB, application/x-compressed)
2005-08-20 13:00 UTC, Martin Entlicher
Details
The patch for release551 branch (15.26 KB, text/plain)
2007-01-12 15:57 UTC, Martin Entlicher
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chihin Ko 2005-07-22 23:55:49 UTC
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.
Comment 1 Martin Entlicher 2005-08-15 19:18:45 UTC
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.
Comment 2 ivan 2005-08-15 22:19:48 UTC
> 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?
Comment 3 Martin Entlicher 2005-08-20 12:58:38 UTC
> 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...
Comment 4 Martin Entlicher 2005-08-20 13:00:16 UTC
Created attachment 24101 [details]
A simple module, that demonstrates column replacement.
Comment 5 Martin Entlicher 2005-08-20 13:03:44 UTC
FYI: disabling some service causes issue #62714. It just prints something to the
console, but does not hurt anything.
Comment 6 Chihin Ko 2005-08-31 02:47:00 UTC
"-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)
    
Comment 7 Martin Entlicher 2005-08-31 10:08:21 UTC
This is what I mentioned. It's described in issue #62714 and fixed in 4.2 dev
builds. It's harmless.
Comment 8 Chihin Ko 2006-05-15 23:38:07 UTC
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()
?
Comment 9 Martin Entlicher 2006-05-20 04:58:06 UTC
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".
Comment 10 Chihin Ko 2006-05-23 00:34:21 UTC
org.netbeans.modules.debugger.ui.models.ColumnModels.createThreadStateColumn()-hidden
does not not work for NB current version.
Comment 11 Martin Entlicher 2006-05-23 00:53:12 UTC
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.
Comment 12 Chihin Ko 2006-05-24 00:08:38 UTC
It's the dev version, a snapshot of NB trunk dated 4/26/2006
Comment 13 Chihin Ko 2006-05-25 00:15:40 UTC
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 ?

Comment 14 Chihin Ko 2006-06-01 20:41:28 UTC
Martin,

  Do you agree with my investigation ? if you do, can you provide a solution ?
Comment 15 Martin Entlicher 2006-06-05 13:57:12 UTC
I was on vacation. I'll look at it today and will let you know...
Comment 16 Martin Entlicher 2006-06-05 17:32:05 UTC
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.
Comment 17 Chihin Ko 2006-06-07 00:02:19 UTC
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

Comment 18 Martin Entlicher 2006-06-08 17:42:36 UTC
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.
Comment 19 Chihin Ko 2006-06-09 01:21:27 UTC
After I moved <column>-hidden to

META-INF/debugger/ThreadsView/org.netbeans.spi.viewmodel.ColumnModel 

it works fine now.
Comment 20 Jiri Kovalsky 2006-06-09 09:55:27 UTC
Thanks for letting us know chihinko. Verifying then ...
Comment 21 Alexander Zgursky 2006-08-03 17:36:08 UTC
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.
Comment 22 Martin Entlicher 2006-08-04 10:18:14 UTC
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.
Comment 23 Martin Entlicher 2006-11-18 21:33:07 UTC
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
Comment 24 Martin Entlicher 2006-11-18 21:35:04 UTC
*** Issue 78609 has been marked as a duplicate of this issue. ***
Comment 25 Martin Entlicher 2006-11-18 21:57:19 UTC
FYI: The ANT debugger now demonstrates the usage of this fix - see issue #63083.
Comment 26 Alexander Zgursky 2006-11-22 13:31:43 UTC
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?
Comment 27 Alexander Zgursky 2006-12-13 12:09:31 UTC
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?
Comment 28 Martin Entlicher 2007-01-05 11:01:19 UTC
I'm just preparing a backport of all resolved issues with MARS keyword...
Changing back as FIXED.
Comment 29 Martin Entlicher 2007-01-12 15:57:46 UTC
Created attachment 37324 [details]
The patch for release551 branch
Comment 30 Roman Ondruska 2007-01-12 16:10:47 UTC
Review: The fix is safe enough for integration into NB 5.5.1
Comment 31 Jaroslav Tulach 2007-01-13 15:52:59 UTC
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
Comment 32 Martin Entlicher 2007-01-16 16:48:24 UTC
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
Comment 33 Martin Entlicher 2007-01-23 18:07:30 UTC
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
Comment 34 Quality Engineering 2010-04-29 09:23:58 UTC
Verified ... and Closing all issues resolved into NetBeans 6.7 and earlier.