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> |
Status: | RESOLVED FIXED | ||
Severity: | blocker | CC: | issues, jtulach, ttran |
Priority: | P2 | Keywords: | API |
Version: | 3.x | ||
Hardware: | Other | ||
OS: | Other | ||
Issue Type: | ENHANCEMENT | Exception Reporter: | |
Bug Depends on: | |||
Bug Blocks: | 17597 |
Description
Melih Ovadya
2002-03-07 00:25:52 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. 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. 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. 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) 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. Issue 21784 is closed with words "The hack works now". Does this mean that this issue can be closed too? 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. Target milestone was changed from not determined to TBD reassigne to owner of subcomponent Assigned to new owner. 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. |