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 33038 - Remove AbstractNode.setPreferredAction method
Summary: Remove AbstractNode.setPreferredAction method
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Nodes (show other bugs)
Version: 3.x
Hardware: PC All
: P2 blocker (vote)
Assignee: Petr Hrebejk
URL:
Keywords: API
Depends on:
Blocks: 32744
  Show dependency tree
 
Reported: 2003-04-18 08:43 UTC by Peter Zavadsky
Modified: 2008-12-22 18:48 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
AbstracNode patch - against release35 - should work for trunk as well (2.14 KB, patch)
2003-04-22 15:44 UTC, Petr Hrebejk
Details | Diff
Necessary patch for utilities module to make NetBeans compilable (883 bytes, patch)
2003-04-22 15:46 UTC, Petr Hrebejk
Details | Diff
Binary patch to openide.jar (10.52 KB, application/octet-stream)
2003-04-22 16:58 UTC, Jaroslav Tulach
Details
Binary patch to utilities.jar (13.77 KB, application/octet-stream)
2003-04-22 16:58 UTC, Jaroslav Tulach
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Zavadsky 2003-04-18 08:43:48 UTC
Jesse's comment from issue #22384:

I see that AbstractNode.setPreferredAction was
introduced in 3.5
along with a nonfinal getPreferredAction. This is
unfortunate (see
issue #32744 for some problems it contributes to).
Is it too late to delete the setter method before
3.5 is released?
Comment 1 Petr Hrebejk 2003-04-18 12:52:19 UTC
OK. I tried to compile NetBeans 35 and S1S withot setPreferredAction()
in the AbstractNode and the bad news is that it is already used. The
FilTextType in utilities/search uses it. An then 4 classes in S1S EJB
module. Partialy good news is that all of them use it for seting
system action and can be rewritten to use setDefaultAction, which
probably should be undeprecated again.
I'm really not sure whether to do it or not. According to Jarada we
anyway need the reflection fix mentioned in issue #32744 to make all
Jesses tests passed. In this case it might be better to leave the
setPreferredAction in the AbstractNode.

Oppinions?
Comment 2 Jan Chalupa 2003-04-18 14:35:21 UTC
Hmm, I think it's indeed too late to fix this for 3.5. As Hrebejk
points out, the method is already used in several modules and changes
would need to be made to all of them, if the method was removed.

Unless there is a user-observable impact of keeping it around, I don't
think it should be fixed now.
Comment 3 _ ttran 2003-04-18 17:05:16 UTC
> Unless there is a user-observable impact of keeping it around, I
> don't think it should be fixed now.

this is an API which we'll have to support until the end of time.  If
we think it's not supportable long time, then we should try our best
to remove it now
Comment 4 Jesse Glick 2003-04-18 18:08:19 UTC
setDefaultAction can be left deprecated - you need only override
getPreferredAction. See issue #22384 for background.

The new method *can* be supported indefinitely, I suppose - it just
adds to the list of things in the API that should not have been put
there to begin with, and that force the code to include extra workarounds.

No user impact that I am aware of.
Comment 5 Petr Hrebejk 2003-04-22 15:44:48 UTC
Created attachment 10071 [details]
AbstracNode patch - against release35 - should work for trunk as well
Comment 6 Petr Hrebejk 2003-04-22 15:46:55 UTC
Created attachment 10072 [details]
Necessary patch for utilities module to make NetBeans compilable
Comment 7 Petr Hrebejk 2003-04-22 15:48:19 UTC
Seems that the final decision is to remove the method in 3.5
Comment 8 _ ttran 2003-04-22 16:48:07 UTC
Yes, I strongly opt for removing this method from 3.5 as well as trunk
version.  We should not add new API which we don't feel comfortable with.

Petr Nejedly, Yarda (perhaps also Hrebejk) are working on it. 
Currently ejb and utilities modules are using this new method.
Comment 9 Jaroslav Tulach 2003-04-22 16:58:06 UTC
Created attachment 10085 [details]
Binary patch to openide.jar
Comment 10 Jaroslav Tulach 2003-04-22 16:58:50 UTC
Created attachment 10086 [details]
Binary patch to utilities.jar
Comment 11 Jaroslav Tulach 2003-04-22 17:08:57 UTC
In main trunk:

Checking in openide/src/org/openide/nodes/AbstractNode.java;
/cvs/openide/src/org/openide/nodes/AbstractNode.java,v  <-- 
AbstractNode.java
new revision: 1.62; previous revision: 1.61
done
Processing log script arguments...
More commits to come...
Checking in
utilities/src/org/netbeans/modules/search/types/FullTextType.java;
/cvs/utilities/src/org/netbeans/modules/search/types/FullTextType.java,v
 <--  FullTextType.java
new revision: 1.30; previous revision: 1.29
done
Comment 12 Jesse Glick 2003-04-22 17:39:39 UTC
I don't agree with the patch in the trunk - it makes setDefaultAction
un-deprecated, which we don't want since it uses SystemAction. As I
wrote before:

"setDefaultAction can be left deprecated - you need only override
getPreferredAction. See issue #22384 for background."

Suggest that it look more like this:

public Action getPreferredAction() {
    return getDefaultAction();
}
private static final Map defaultActions = new WeakHashMap();
/** @deprecated */
public void setDefaultAction(SystemAction a) {
    synchronized (defaultActions) {
        defaultActions.put(this, a);
    }
}
/** @deprecated */
public SystemAction getDefaultAction() {
    synchronized (defaultActions) {
        return (SystemAction)defaultActions.get(this);
    }
}

possibly with some extra code in getDefaultAction to delegate to
getPreferredAction in case setDefaultAction has not been called and
getPreferredAction has been overridden.
Comment 13 _ ttran 2003-04-23 10:16:19 UTC
I approve the change for 3.5.  Jesse's objection about the trunk
version still needs to be addressed.
Comment 14 Jaroslav Tulach 2003-04-23 10:20:54 UTC
I have deprecated the setDefaultAction and implemented
getPreferredAction to correctly work as requested by issue 32744.

I'd like to put AbstractNode.java changes into release35.

Checking in src/org/openide/nodes/AbstractNode.java;
/cvs/openide/src/org/openide/nodes/AbstractNode.java,v  <-- 
AbstractNode.java
new revision: 1.63; previous revision: 1.62
done
Checking in test/unit/src/org/openide/nodes/NodeTest.java;
/cvs/openide/test/unit/src/org/openide/nodes/NodeTest.java,v  <-- 
NodeTest.java
new revision: 1.4; previous revision: 1.3
done
Comment 15 Jaroslav Tulach 2003-04-23 15:17:51 UTC
In version 3.5:


/cvs/openide/src/org/openide/nodes/AbstractNode.java,v  <-- 
AbstractNode.java
new revision: 1.60.6.1; previous revision: 1.60

/cvs/utilities/src/org/netbeans/modules/search/types/FullTextType.java,v
 <--  FullTextType.java
new revision: 1.28.4.2; previous revision: 1.28.4.1
done
Comment 16 Jaroslav Tulach 2003-04-24 09:30:21 UTC
*** Issue 33205 has been marked as a duplicate of this issue. ***
Comment 17 Jaroslav Tulach 2003-04-24 09:31:38 UTC
The commit is wrong. Resulted in a bug 33205. 
Comment 18 Jaroslav Tulach 2003-04-24 10:04:52 UTC
/cvs/openide/src/org/openide/nodes/AbstractNode.java,v  <-- 
AbstractNode.java
new revision: 1.60.6.2; previous revision: 1.60.6.1
Comment 19 Marian Mirilovic 2004-03-15 15:11:26 UTC
fixed long time ago.....
...verified....
reopen if disagree