Returns the index of the inputed editor, or -1 if not found.
        
        :param      editor | <QtGui.QWidget>
        
        :return     <int>
965387
def indexOf(self, editor):
        
        lay = self.layout()
        for i in range(lay.count()):
            if lay.itemAt(i).widget() == editor:
                return i
        return -1
1235074
def editorValue(self, editor):
        
        if isinstance(editor, QLineEdit):
            try:
                return eval(nativestring(editor.text()))
            except:
                return 0
        else:
            return super(NumericPlugin, self).editorValue(editor)
757196
def setEditorData(self, editor, index):
        
        data = unwrapVariant(index.data())
        editor.setCurrentIndex(editor.findText(data))
182050
def index(elem):
    '''
    
    '''
    parent = elem.getparent()
    for x in range(0, len(parent.getchildren())):
        if parent.getchildren()[x] == elem:
            return x
    return -1
1198308
def find_index(segmentation, stroke_id):
    
    for i, symbol in enumerate(segmentation):
        for sid in symbol:
            if sid == stroke_id:
                return i
    return -1
1176929
def editor(self, value):
        

        if value is not None:
            assert type(value) is Editor, "'{0}' attribute: '{1}' type is not 'Editor'!".format("editor", value)
        self.__editor = value
334448
def selection_range(self):
        
        editor = self._editor
        doc = editor.document()
        start = doc.findBlock(
            editor.textCursor().selectionStart()).blockNumber()
        end = doc.findBlock(
            editor.textCursor().selectionEnd()).blockNumber()
        text_cursor = QTextCursor(editor.textCursor())
        text_cursor.setPosition(editor.textCursor().selectionEnd())
        if text_cursor.columnNumber() == 0 and start != end:
            end -= 1
        return start, end
916136
def get_raw_index(self, i):
        
        if self.is_indexed:
            return int(self.order[i])
        if self.data.base is None:
            return int(i)
        return int(self.data_start - self.base_start + i)
1015154
public I_CmsEditor getEditorForType(I_CmsResourceType type, boolean plainText) {

        List<I_CmsEditor> editors = new ArrayList<I_CmsEditor>();
        for (int i = 0; i < EDITORS.length; i++) {
            if (EDITORS[i].matchesType(type, plainText)) {
                editors.add(EDITORS[i]);
            }
        }
        I_CmsEditor result = null;
        if (editors.size() == 1) {
            result = editors.get(0);
        } else if (editors.size() > 1) {
            Collections.sort(editors, new Comparator<I_CmsEditor>() {

                public int compare(I_CmsEditor o1, I_CmsEditor o2) {

                    return o1.getPriority() > o2.getPriority() ? -1 : 1;
                }
            });
            result = editors.get(0);
        }
        return result;
    }
1289153
function getOnKeyDownListener( editor ) {
		var keystrokes = { 37: 1, 39: 1, 8: 1, 46: 1 };

		return function( evt ) {
			var keystroke = evt.data.getKeystroke();

			// Handle only left/right/del/bspace keys.
			if ( !keystrokes[ keystroke ] )
				return;

			var sel = editor.getSelection(),
				ranges = sel.getRanges(),
				range = ranges[ 0 ];

			// Handle only single range and it has to be collapsed.
			if ( ranges.length != 1 || !range.collapsed )
				return;

			var next = range[ keystroke < 38 ? 'getPreviousEditableNode' : 'getNextEditableNode' ]();

			if ( next && next.type == CKEDITOR.NODE_ELEMENT && next.getAttribute( 'contenteditable' ) == 'false' ) {
				editor.getSelection().fake( next );
				evt.data.preventDefault();
				evt.cancel();
			}
		};
	}
214553
def which(editor: str) -> Optional[str]:
    
    try:
        editor_path = subprocess.check_output(['which', editor], stderr=subprocess.STDOUT).strip()
        editor_path = editor_path.decode()
    except subprocess.CalledProcessError:
        editor_path = None
    return editor_path
675278
private int getIndex(TypeVariable<?> variable) {

        Class<?> rawType = resolveClass(owningType);
        TypeVariable<?>[] typeParameters = rawType.getTypeParameters();

        for (int i = 0; i < typeParameters.length; i++) {
            if (variable.equals(typeParameters[i])) {
                return i;
            }
        }

        return -1;
    }
879145
def get_editor_buffer_for_location(self, location):
        
        for eb in self.editor_buffers:
            if eb.location == location:
                return eb
520662
public int getIndex (String outcome) {
        for (int i=0; i<ocNames.length; i++) {
            if (ocNames[i].equals(outcome))
                return i;
        }
        return -1;
    }
1361162
function getIndex(objects, obj) {

            var i;
            for (i = 0; i < objects.length; i++) {
                if (objects[i] === obj) {
                    return i;
                }
            }

            return -1;
        }
793572
def set_editor(self, editor, refresh=True):
        
        self.editor = editor
        # Note: This is necessary to test widgets/editor.py
        # in Qt builds that don't have web widgets
        try:
            from qtpy.QtWebEngineWidgets import QWebEngineView
        except ImportError:
            QWebEngineView = type(None)
        self.words_button.setVisible(not isinstance(editor, QWebEngineView))
        self.re_button.setVisible(not isinstance(editor, QWebEngineView))
        from spyder.plugins.editor.widgets.codeeditor import CodeEditor
        self.is_code_editor = isinstance(editor, CodeEditor)
        self.highlight_button.setVisible(self.is_code_editor)
        if refresh:
            self.refresh()
        if self.isHidden() and editor is not None:
            self.clear_matches()
1311032
def indentation_pre_event_input_accelerators(editor, event):
    

    process_event = True
    if not hasattr(editor, "indent"):
        return process_event

    if event.key() == Qt.Key_Tab:
        process_event = editor.indent() and False
    elif event.key() == Qt.Key_Backtab:
        process_event = editor.unindent() and False
    return process_event