At this moment this all we can offer you. This is the most general class
diagram. It avoids many concrete classes to easily view the entire model. You can
download both in png or
The main difference between this model and the older one refers to the use of the singleton pattern. The application was first designed to run a single editor, so we widely used singleton pattern, as we saw the advantages of having multiple editors, we've been forced to no longer use them. There are several reasons to make several instances of editor avaliable, the most important of them is to share the clipboard. In this new model, the Clipboard is still a singleton, because other way we will loose the hability to share :)
As we can see in the diagram, we use two singletons, ToolBox and ViewFactory, the name may be confuse so let me explain. The class ToolBox is a repository of Tools. It is shared by all the instances of Editor and it uses the prototype pattern to return instances of Tools. The way it works it's as follows:
The Editor ask for a concrete Tool to the ToolBox by it's name. The ToolBox singleton uses a map to get the right Tool, once it has the Tool, it invokes concrete tool's clone() method to get a usable instance. Take a look at the diagram, you can see a creational dependency between the Editor and the Tool, it could be replaced by a "use" dependency between the Editor and the ToolBox and a creational dependency between the Toolbox and the Tool, but since the Editor is the one who knows when and what kind of Tool is to be created we took this notation.