public void destroy() {

		if (editor != null) {
			editor.getPage().removePageListener(this);
			editor.removeEditorListener(this);
			editor.destroy();
		}

		windowList.remove(this);
		requestStopListening();
		if (!windowList.isEmpty()) {
			Modeler m = windowList.get(0);
			if (!m.listeningToSocket) {
				m.listenToSocket();
				m.pingSocket("ping");
			}
		}

		BookmarkManager.sharedInstance().removeBookmarkListener(this);
		Zipper.sharedInstance().setProcessMonitor(null);
		Zipper.sharedInstance().removeComponentToLock(preinstallMenu);
		MultipageZipper.sharedInstance().removeProgressListener(editor.getPage());
		ConnectionManager.sharedInstance().removeProgressListener(statusBar);
		if (ModelerUtilities.imageReader != null)
			ModelerUtilities.imageReader.setParent(null);

		for (int i = 0, n = menuBar.getMenuCount(); i < n; i++)
			destroyMenu(menuBar.getMenu(i));
		menuBar.removeAll();
		getContentPane().removeAll();

		WindowListener[] wl = getWindowListeners();
		for (WindowListener listener : wl)
			removeWindowListener(listener);
		ComponentListener[] cl = getComponentListeners();
		for (ComponentListener listener : cl)
			removeComponentListener(listener);

		reloadMenuItem.setAction(null);
		reloadButton.setAction(null);
		backMenuItem.setAction(null);
		backButton.setAction(null);
		forwardMenuItem.setAction(null);
		forwardButton.setAction(null);
		homeMenuItem.setAction(null);
		homeButton.setAction(null);
		colorMenu.destroy();

		KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner();
		editor = null;

		createReportAction.setModeler(null);
		createReportAction = null;

		createReportForPageGroupAction.setModeler(null);
		createReportForPageGroupAction = null;
	}