} else {
furnitureLibraryName = null;
}
final FurnitureLibrary furnitureLibrary = new FurnitureLibrary();
final EditorController editorController = createEditorController(furnitureLibrary);
final View editorView = editorController.getView();
final JFrame furnitureFrame = new JFrame() {
{
if (editorView instanceof JRootPane) {
setRootPane((JRootPane)editorView);
} else {
add((JComponent)editorView);
}
}
};
furnitureFrame.setIconImage(new ImageIcon(
FurnitureLibraryEditor.class.getResource("resources/frameIcon.png")).getImage());
furnitureFrame.setLocationByPlatform(true);
furnitureFrame.pack();
furnitureFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
furnitureFrame.setVisible(true);
furnitureFrame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent ev) {
editorController.exit();
}
});
if (furnitureFrame.getJMenuBar() == null) {
installAccelerators(furnitureFrame, editorController);
}
if (OperatingSystem.isMacOSX()) {
MacOSXConfiguration.bindToApplicationMenu(editorController);
}
if (furnitureLibraryName != null) {
editorController.open(furnitureLibraryName);
}
updateFrameTitle(furnitureFrame, furnitureLibrary, getUserPreferences(), getContentManager());
// Update title when the name or the modified state of library changes
furnitureLibrary.addPropertyChangeListener(FurnitureLibrary.Property.NAME, new PropertyChangeListener () {
public void propertyChange(PropertyChangeEvent ev) {