if (dialog != null) {
Controller.setCurrentController ((Controller) dialog.getRootPane().getClientProperty(Controller.class));
return;
}
dialog = new JDialog(Controller.getCurrentController().getViewController().getJFrame());
final WindowConfigurationStorage windowConfigurationStorage = new WindowConfigurationStorage(getKey() + ".dialog");
windowConfigurationStorage.restoreDialogPositions(dialog);
dialog.setModal(true);
dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
dialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(final WindowEvent e) {
getModeController().tryToCloseDialog();
}
});
Controller controller = SModeControllerFactory.getInstance().createController(dialog);
modeController = (SModeController) controller.getModeController();
final ViewController viewController = controller.getViewController();
viewController.init(controller);
dialog.addComponentListener(new ComponentAdapter() {
@Override
public void componentHidden(final ComponentEvent e) {
final WindowConfigurationStorage windowConfigurationStorage = new WindowConfigurationStorage(getKey() + ".dialog");
windowConfigurationStorage.storeDialogPositions(dialog);
final IMapViewManager mapViewManager = modeController.getController().getMapViewManager();
final MapModel map = mapViewManager.getModel();
final IUndoHandler undoHandler = (IUndoHandler) map.getExtension(IUndoHandler.class);
mapViewManager.close(true);
Controller.setCurrentController(AEditStylesAction.this.controller);