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 60944 - Provide Custom Editor with reasonable behaviour for multiple properties selection
Summary: Provide Custom Editor with reasonable behaviour for multiple properties selec...
Status: RESOLVED DUPLICATE of bug 60895
Alias: None
Product: platform
Classification: Unclassified
Component: Explorer (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Stanislav Aubrecht
URL:
Keywords: UI
Depends on:
Blocks:
 
Reported: 2005-07-13 20:30 UTC by Thomas Preisler
Modified: 2008-12-22 22:43 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Patch - not tested but should work (2.43 KB, patch)
2005-09-08 22:21 UTC, _ tboudreau
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Preisler 2005-07-13 20:30:59 UTC
You cannot change multiple properties at once if properties are different and
using a custom editor. An example is Key Bindings property in Editor settings
(Options). Being able ti modify multiple properties at once is important to us
(Sun Studio) product because we rely heavily on properties and custom editors.
There are other problems with changing multiple properties at once even with
standard editors like the '...' button not always being show.

The following modifications to PropUtils.java in the
org.openide.explorer.propertysheet package seem to somewhat fix these problems:

>>>>>>>>>>>>>>>>> diff -c PropUtils.java- PropUtils.java
*** PropUtils.java-     Wed Mar 16 00:18:08 2005
--- PropUtils.java      Wed Jun 29 17:47:54 2005
***************
*** 678,684 ****
          }

          public java.awt.Component getCustomEditor() {
!             return null;//ed.getCustomEditor();
          }

          public String getJavaInitializationString() {
--- 678,684 ----
          }

          public java.awt.Component getCustomEditor() {
!             return ed.getCustomEditor();
          }

          public String getJavaInitializationString() {
***************
*** 725,731 ****
          }

          public boolean supportsCustomEditor() {
!             return false;
          }
      }

--- 725,731 ----
          }

          public boolean supportsCustomEditor() {
!             return true;
          }
      }

Are they safe? Is there a better fix?
Comment 1 Martin Krauskopf 2005-07-13 21:58:34 UTC
Targeted for 4.2, right? I'm not sure why the code was uncommented - maybe there
was some reason. I'll try to look at it for 4.2. Also I saw that you already
used the patch for the deimos branch. So tell me if you encounter any problem,
thanks ;)
Comment 2 Thomas Preisler 2005-07-13 22:09:28 UTC
Yes, we will use my 'fix' in deimos for now and I will let you know whether we
find any side effects from these changes. As you noticed, all I did was un-doing
somebody elses 'fix', but I don't understand the details. I may have missed one
or two places. Perhaps the CVS history can uncover what the purpose was behind
the other 'fix'. I'm interested in porting back your fix in 4.2 to deimos branch.
Comment 3 Martin Krauskopf 2005-07-13 22:16:12 UTC
> As you noticed, all I did was un-doing somebody elses 'fix',
> but I don't understand the details.

Yes, me neither. Anyway somebody had a reason for doing so. I will take a look
into the history and eventually ask the commiter (95% Tim Boudreau :) ) if it is
necessary.
Comment 4 Martin Krauskopf 2005-09-06 23:13:49 UTC
thp, any experience with your fix? Thanks.

Tim, did you have any reason to uncomment the support for a custom editor in
DifferentValuesEditor? (the history was lost after openide-split). Thanks for
comment if you recall something.
Comment 5 _ tboudreau 2005-09-07 03:35:34 UTC
This was disabled explicitly because it was impossible to do 100% reliably.  The
problem being - what value do you take as the value that the editor should have
when the custom editor is invoked?  If null, some custom editors will throw an
exception.  Then, how do you know when the value is changed?  It will depend on
how the custom editor is implemented (everybody has their own idea of the right
way to do this).  Just getting it so that simply bringing up the custom editor
will not, in some cases, set the value of all selected properties to the value
of whichever arbitrary editor's custom editor you chose to use may be impossible.

Lastly, what do you do about mutual exclusion?  Say, I select five files in the
same directory, and bring up the custom editor on their Name property - what
should be the failure behavior - depending on the ordering of the selection, one
property has been successfully set.

I'd suggest making it the responsibility of the Property to explicitly state
that it can actually do something reasonable, and keep the default behavior. 
I.e. if (Boolean.TRUE.equals(theProperty.getValue("multiSelectCustomEditors")))
on every Property being proxied then return true for supportsCustomEditor()
(good luck deciding which property's custom editor to use - you can invoke this
over properties that do not even have the same value type if their name is the
same).  If it is made the default behavior, you're pretty much guaranteed it
will throw exceptions in some cases.  The root problem is that the interface for
custom editors in the beans spec is under-specified.
Comment 6 Martin Krauskopf 2005-09-07 07:10:39 UTC
Thanks for your information, Tim. I understand now. Than I suppose we have to
consider the right behaviour with HIE. Will not be enhanced for 5.0 - feature
frozen, too risky.
Comment 7 Thomas Preisler 2005-09-07 17:02:54 UTC
But we (Deimos) depend on this feature and need it to work in 4.2 (5.0?) when we
move to that release. We use build configurations in Deimos. A configuration is
basically a property sheet and it is a crucial feature that you can edit
multiple configurations at once. I 'fixed' it in our own branch 'deimos' and
don't see any bad problems. Please reconsider for 4.2 (5.0?). Thanks.
Comment 8 _ tboudreau 2005-09-07 17:18:47 UTC
Do as you wish.  I'd say enabling it by a hint should be near 0 risk, as long as
the existing behavior is kept for any properties that don't have the hint (i.e
all properties in NetBeans).
Comment 9 Thomas Preisler 2005-09-07 21:48:12 UTC
that would work for us (Deimos). Please consider this solution.
Comment 10 Martin Krauskopf 2005-09-07 22:25:39 UTC
Should be simple. I hope I'll have time for it.
Comment 11 _ tboudreau 2005-09-08 22:21:28 UTC
Created attachment 24648 [details]
Patch - not tested but should work
Comment 12 Martin Krauskopf 2005-09-12 11:45:38 UTC
Thanks Tim, I'll try it.
Comment 13 Stanislav Aubrecht 2005-10-18 12:09:00 UTC
i think that delegating this responsibility to the property is too restrictive.
there's a lot of valid cases where multiple properties editing is desirable,
e.g. form designer. (besides the custom edit button does show up even now when
input focus moves to other property field).

let's see if any serious issues show up because of the fix to #60895 and then we
can revisit this again.

*** This issue has been marked as a duplicate of 60895 ***
Comment 14 Jan Lahoda 2006-01-05 16:20:17 UTC
thp, do you consider this issue solved together with the fix for issue #60895?
If no, please reopen.
Comment 15 Thomas Preisler 2006-01-05 17:40:41 UTC
I will verify the fix as soon as possible. We are in the process of moving our
source base to 5.0 (trunk) and it will be difficult to test before this has been
completed. I may take a few weeks. I will reopen this issue if problems not fixed.
Thanks. 
Comment 16 Jan Lahoda 2006-01-07 10:07:27 UTC
Ok, thanks.