if (doc != null) {
editor = doc.getEditor();
history = new DocUndoHistory(doc);
templates.dispose();
templates = new TemplateControl(editor, this);
ScaleModel scale = doc.getScaleModel();
scale.addScaleListener(this);
doc.addDocumentListener(this);
OtherApplication source = (OtherApplication) doc.getSource();
if ((! isEditorVisible) || (source != null)) {
showEditorPerspective();
}
toolButtonListener =
new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
String propName = event.getPropertyName();
if (propName.equals(ToggleAction.TOGGLE_STATE)) {
boolean selected = (Boolean) event.getNewValue();
if (selected && (layout instanceof EditorLayout)) {
((EditorLayout) layout).ensureToolsVisible();
}
}
}
};
// Don't let the split panes make the editor image too small.
editor.getImage().setMinimumSize(new Dimension(120, 120));
doc.getProofAction().addPropertyChangeListener(toolButtonListener);
}
else {
editor = disabledEditor;
// Don't let the split panes make the editor image too small.
editor.getImage().setMinimumSize(new Dimension(120, 120));
String disabledText = getDisabledEditorText();
editor.setDisabledText(disabledText);
history = new DocUndoHistory();
templates.dispose();
templates = new TemplateControl(null, this);
// TODO: we come here from showBrowserPerspective...
if (! isBrowserVisible) {
showBrowserPerspective();
}