Close state editor when state is being destructed
348141
def state_destruction(self, model, prop_name, info):
        
        import rafcon.gui.singleton as gui_singletons
        states_editor_ctrl = gui_singletons.main_window_controller.get_controller('states_editor_ctrl')
        state_identifier = states_editor_ctrl.get_state_identifier(self.model)
        states_editor_ctrl.close_page(state_identifier, delete=True)
652826
function(e) {
      Event.stopEvent(e);
      this.editorContainer.style.display = 'none';
      this.formattedContainer.style.display = '';
   }
464817
public void closeEditor() {

        if (m_saveButton != null) {
            if (m_saveButton.isEnabled()) {
                CmsConfirmDialog dialog = new CmsConfirmDialog(
                    org.opencms.gwt.client.Messages.get().key(org.opencms.gwt.client.Messages.GUI_DIALOG_RESET_TITLE_0),
                    Messages.get().key(Messages.GUI_CONFIRM_LEAVING_EDITOR_0));
                dialog.setHandler(new I_CmsConfirmDialogHandler() {

                    public void onClose() {

                        cancelEdit();
                    }

                    public void onOk() {

                        saveAndExit();
                    }
                });
                dialog.center();
            } else {
                cancelEdit();
            }
        }
    }
945075
function() {
        if (!this.mapDiv) { // we've already been destroyed
            return;
        }
        if (this.handlers.click) {
            this.handlers.click.destroy();
        }
        if (this.handlers.drag) {
            this.handlers.drag.destroy();
        }

        this.ovmap && this.ovmap.viewPortDiv.removeChild(this.extentRectangle);
        this.extentRectangle = null;

        if (this.rectEvents) {
            this.rectEvents.destroy();
            this.rectEvents = null;
        }

        if (this.ovmap) {
            this.ovmap.destroy();
            this.ovmap = null;
        }
        
        this.element.removeChild(this.mapDiv);
        this.mapDiv = null;

        this.div.removeChild(this.element);
        this.element = null;

        if (this.maximizeDiv) {
            this.div.removeChild(this.maximizeDiv);
            this.maximizeDiv = null;
        }
        
        if (this.minimizeDiv) {
            this.div.removeChild(this.minimizeDiv);
            this.minimizeDiv = null;
        }

        this.map.events.un({
            buttonclick: this.onButtonClick,
            moveend: this.update,
            changebaselayer: this.baseLayerDraw,
            scope: this
        });

        OpenLayers.Control.prototype.destroy.apply(this, arguments);    
    }
869777
function (sClassName, oAppComponent, oView, oSelector, mSettings, bAsync) {
			var oExistingControl = this.bySelector(oSelector, oAppComponent);
			var fnCreateUndoOperation = function() {
				if (!oExistingControl) {
					var oCreatedControl = this.bySelector(oSelector, oAppComponent);
					RtaControlTreeModifier._saveUndoOperation("destroy", [oCreatedControl]);
				}
			}.bind(this);

			var vReturnValue = JsControlTreeModifier.createControl.apply(this, arguments);

			if (bAsync) {
				return vReturnValue.then(function(oReturnedControl) {
					fnCreateUndoOperation();
					return oReturnedControl;
				});
			}

			fnCreateUndoOperation();
			return vReturnValue;
		}
907808
function addDestroyListener($scope, control, bindings, destroyed) {
        $scope.$on("$destroy", function () {
            (destroyed && destroyed());

            bindings.forEach(function (w) { w(); });

            if (control.dispose) {
                control.dispose();
            }
        });
    }
130414
def on_state_changed(self, state):
        
        if state:
            self.editor.key_pressed.connect(self._on_key_pressed)
            if self._highlight_caret:
                self.editor.cursorPositionChanged.connect(
                    self._highlight_caret_scope)
                self._block_nbr = -1
            self.editor.new_text_set.connect(self._clear_block_deco)
        else:
            self.editor.key_pressed.disconnect(self._on_key_pressed)
            if self._highlight_caret:
                self.editor.cursorPositionChanged.disconnect(
                    self._highlight_caret_scope)
                self._block_nbr = -1
            self.editor.new_text_set.disconnect(self._clear_block_deco)
61805
function emptyEditorOnDeleteEverything() {
        function isEverythingSelected(editor) {
          var caretWalker = new CaretWalker(editor.getBody());
          var rng = editor.selection.getRng();
          var startCaretPos = CaretPosition.fromRangeStart(rng);
          var endCaretPos = CaretPosition.fromRangeEnd(rng);
          var prev = caretWalker.prev(startCaretPos);
          var next = caretWalker.next(endCaretPos);

          return !editor.selection.isCollapsed() &&
            (!prev || (prev.isAtStart() && startCaretPos.isEqual(prev))) &&
            (!next || (next.isAtEnd() && startCaretPos.isEqual(next)));
        }

        // Type over case delete and insert this won't cover typeover with a IME but at least it covers the common case
        editor.on('keypress', function (e) {
          if (!isDefaultPrevented(e) && !selection.isCollapsed() && e.charCode > 31 && !VK.metaKeyPressed(e)) {
            if (isEverythingSelected(editor)) {
              e.preventDefault();
              editor.setContent(String.fromCharCode(e.charCode));
              editor.selection.select(editor.getBody(), true);
              editor.selection.collapse(false);
              editor.nodeChanged();
            }
          }
        });

        editor.on('keydown', function (e) {
          var keyCode = e.keyCode;

          if (!isDefaultPrevented(e) && (keyCode == DELETE || keyCode == BACKSPACE)) {
            if (isEverythingSelected(editor)) {
              e.preventDefault();
              editor.setContent('');
              editor.nodeChanged();
            }
          }
        });
      }
881511
function()
					{
						if ( combo )
						{
							delete combo._.panel;
							delete combo._.list;
							combo._.committed = 0;
							combo._.items = {};
							combo._.state = CKEDITOR.TRISTATE_OFF;
						}
						styles = {};
						stylesList = [];
						loadStylesSet();
					}
87783
function collapseCurrent() {
        var editor = EditorManager.getFocusedEditor();
        if (!editor) {
            return;
        }
        var cm = editor._codeMirror;
        var cursor = editor.getCursorPos(), i;
        // Move cursor up until a collapsible line is found
        for (i = cursor.line; i >= 0; i--) {
            if (cm.foldCode(i)) {
                editor.setCursorPos(i);
                return;
            }
        }
    }
391749
def on_state_changed(self, state):
        
        if state:
            self.editor.painted.connect(self._paint_margin)
            self.editor.repaint()
        else:
            self.editor.painted.disconnect(self._paint_margin)
            self.editor.repaint()
615576
def on_tab_close_clicked(self, event, state_m):
        
        [page, state_identifier] = self.find_page_of_state_m(state_m)
        if page:
            self.close_page(state_identifier, delete=False)
388950
function () {
            this.navigationInterceptor.destroyElements();
            this.navigationInterceptor = null;

            if (this._cfg.waiAria) {
                var dropDownIcon = this._getDropdownIcon();
                if (dropDownIcon) {
                    dropDownIcon.setAttribute("aria-expanded", "false");
                }
            }

            this._setPopupOpenProperty(false);
            this.controller.setListWidget(null);
            var report = null;

            // Check _toggleDropdown already triggered
            if (!this._hasFocus) {
                // Added to keep the behaviour similar to click on close button click PTR 04661445
                report = this.controller.toggleDropdown(this.getTextInputField().value, this._dropdownPopup != null);
                // to reset the dropdown display
                report.displayDropDown = false;
            }

            this.$DropDownTextInput._afterDropdownClose.call(this);

            if (report) {
                this._reactToControllerReport(report, {
                    hasFocus : false
                });
                // note that _reactToControllerReport might destroy the widget (this._cfg may be null here)
            }

            this._dropDownOpen = false;
            this.refreshPopup = false;
            this._keepFocus = false;
        }
852001
private static void closeQuietly(State state) {
        // ensure only closed once and avoid race conditions
        if (state.closed.compareAndSet(false, true)) {
            // set the state fields to null after closing for garbage
            // collection purposes
            log.debug("closing rs");
            Util.closeQuietly(state.rs);
            log.debug("closing ps");
            Util.closeQuietly(state.ps);
            log.debug("closing con");
            Util.closeQuietlyIfAutoCommit(state.con);
            log.debug("closed");
        }
    }
476891
function()
	{
		if ( this.state == CKEDITOR.TRISTATE_OFF )
			this.setState( CKEDITOR.TRISTATE_ON );
		else if ( this.state == CKEDITOR.TRISTATE_ON )
			this.setState( CKEDITOR.TRISTATE_OFF );
	}
1165271
function() {
      
      // colorEl listener
      Event.purgeElement(this.colorEl);
      
      // remove squares' mousedown listener(s)
      if (this.colorGrid) {
         Event.purgeElement(this.colorGrid,true);
      }
      
      inputEx.ColorField.superclass.destroy.call(this);
      
   }
1238198
def closeEvent(self, event):
        """"""
        self.threadmanager.close_all_threads()
        self.analysis_timer.timeout.disconnect(self.analyze_script)

        # Remove editor references from the outline explorer settings
        if self.outlineexplorer is not None:
            for finfo in self.data:
                self.outlineexplorer.remove_editor(finfo.editor.oe_proxy)

        QWidget.closeEvent(self, event)