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.
|Summary:||enabling actions assoc. w/ a DataObject|
|Product:||platform||Reporter:||Melih Ovadya <movadya>|
|Component:||Actions||Assignee:||Jiri Rechtacek <jrechtacek>|
|Severity:||blocker||CC:||issues, jtulach, ttran|
|Issue Type:||ENHANCEMENT||Exception Reporter:|
|Bug Depends on:|
Description Melih Ovadya 2002-03-07 00:25:52 UTC
We need a way of enabling actions associated with a Data Object (such as debugging actions). Currently, those actions are only enabled when the file in NetBeans Source Editor [NSE] gets the focus. This method of course is not working when using the external editor. An API change is required to enable actions without depending on any events of NSE.
Comment 1 _ ttran 2002-03-07 06:53:30 UTC
Melih, this is not a DEFECT but a RFE. We are in the planning process right now for 3.4 (it's actually quite late already, but not too late I hope). I'll try to include this issue in our plan.
Comment 2 Jaroslav Tulach 2002-03-07 11:30:27 UTC
This should be addressed by context section of action rework http://openide.netbeans.org/proposals/actions/index.html#context please check that it really solves your problem.
Comment 3 Melih Ovadya 2002-03-07 23:41:14 UTC
First of all, I respectfully have to disagree that this is only a RFE. The current API implementation hinders me to perform actions associated with a File when I am using external editor instead of the default one. Required modifications to the code can be called as "Enhancements" only if that code is working bug-free and if the UI is usable. With external editor, the existing code behaves buggy;e.g I cannot toggle a breakpoint in editor, because that menu item is never enabled. The proposal about context section of action rework may need to be extended to include the solution of this problem. I will get back to that when I am better informed about the proposal. (Yarda, I sent you an email about that) As a side note: in my humble opinion, relying solely on focus gained/lost events seems to be the wrong way of implementing an interface. It makes it harder, and sometimes impossible, to control and handle the flow of execution.
Comment 4 Melih Ovadya 2002-03-13 22:33:22 UTC
Here is the summary of the emails I keep exchanging with Yarda about this topic: 1)The proposal approaches the problem from Action point of view; i.e. given the action, find the context and make it look like the node is activated. 2)we need a way to select the context by providing the Data Object and thus enabling all the associated actions. 3) Achieving this can be done thru two steps: i) provide the context. Context is represented by Lookup so just: InstanceContent ic = new InstanceContent (); AbstractLookup lkp = new AbstractLookup (ic); ic.add (yourDataObject); ii)Then take the actions and just clone them in the "lkp" context. They should work exactly on the data object. 4)This seems to solve the problems when the user performs the actions from within the external editor, e.g. pressing Sh-F7 in editor will toggle the breakpoint. But the problem still persists with the menu items/toolbar buttons when the NetBeans default editor is not used; i.e selecting the "Toggle BrkPt" menu item under the "Debug" menu will not work. 5)this is a similar problem that was solved in scripting module. There is a special hack to do it using org.netbeans.core.windows.RegistryImpl.attachExplorer, but it was not put into APIs, because it is very dangerous (influences all other parts of the IDE) and can break a lot of things... 6) First time I got a chance, I will try to use it (sample code should be in scripting module)
Comment 5 Melih Ovadya 2002-03-29 02:11:20 UTC
Dave has tried the hack and it didn't work since focus behavior is dependent on the window manager and the suggested hack did not behave properly on CDE. (see issue #21784 ) We definitely need the new Actions framework, but as I mentioned in step 4 above, we also need to consider a way to make the ToggleBreakpoint toolbar button active.
Comment 6 Jaroslav Tulach 2002-04-02 12:23:46 UTC
Issue 21784 is closed with words "The hack works now". Does this mean that this issue can be closed too?
Comment 7 David Weatherford 2002-04-04 18:21:39 UTC
No, the hack mentioned in 21874 is a different hack. It solves the specific problem of ToggleBreakpoint by bypassing the normal mechanisms entirely. We don't invoke the actual ToggleBreakpointAction at all, we just perform the operations that the system action would have done, and don't check whether the data object is selected or the action is enabled. We still need a generic solution for other system actions.
Comment 8 Marek Grummich 2002-07-22 08:10:53 UTC
Target milestone was changed from not determined to TBD
Comment 9 Marian Mirilovic 2002-07-23 14:16:14 UTC
reassigne to owner of subcomponent
Comment 10 Jiri Rechtacek 2004-04-23 10:50:01 UTC
Assigned to new owner.
Comment 11 Jaroslav Tulach 2005-12-09 16:48:00 UTC
I believe this is a solution for external editor. ContextAwareAction toExecute = ....; DataObject execUpon = ....; Action clone = toExecute.createContextAwareInstance(execUpon.getNodeDelegate().getLookup()); clone.actionPerformed(new ActionEvent(this, "", 0)); This solution is focus independent and also is not at all related to current focus in the IDE.