|
From: Shlomy R. <sre...@gm...> - 2007-09-02 20:03:15
|
Comments, anyone? Shlomy ---------- Forwarded message ---------- From: Shlomy Reinstein <sre...@gm...> Date: Aug 26, 2007 10:47 PM Subject: Interface for dockable windows To: jEdit dev <jed...@li...> Hi, Currently in jEdit, whenever a dockable window is moved from one docking area to another (or is floated from its docking area), jEdit invokes the BeanShell code in dockables.xml in order to get an instance of the dockable. Typically ( i.e. for most plugin dockables), the BeanShell code returns a new instance of the dockable window, which replaces the existing instance. Because of this, the state of the dockable window is not preserved - the new instance has its own state. E.g. if you move the Console dockable window from one docking area to another, all scrollable history is lost. This is normally not the expected behavior. When the user changes the docking area of a dockable window, the window is expected to move and preserve its state, it is not expected to be replaced by a new window with a new state. With the current behavior of jEdit, a dockable that wants to exhibit this desired behavior needs to check whether it already has an instance for the current view each time the BeanShell code is called, and return the existing instance if it does. I'd like to eliminate this complexity for dockable windows by making jEdit use the same instance when moving a dockable between docking areas (or floating). In addition: - A dockable window sometimes cares about where it is docked - for example, some dockable windows use a horizontal layout when docked at the top/bottom, and a vertical layout when docked at the right/left. So, there should be some interface through which jEdit can notify the dockable window that its docking is changed, so it can adjust. For now, I'd like to introduce a minimal interface, containing only a "move(String position)" method for notifying the dockable when it's moved. - For backward compatibility, this new behavior should not be the default. Plugin dockables that want to use the new behavior need to implement the dockable window interface. I've create patch #1782091 with an initial implementation. Also included in the patch is a patch for the GlobalPlugin that demonstrates the use of the new interface. Feel free to comment. The above change is the first in a series of changes I plan to make to the dockable window manager in jEdit, but may be the only one to be included in 4.3final in order to ensure stability without delaying the release. The final plan is to allow usage of a flexible docking framework such as flexdock. Shlomy |