Examples of Editor


Examples of com.intellij.openapi.editor.Editor

            execute(console, consoleHistoryModel);
            return;
        }

        // Process input and add to history
        Editor editor = console.getCurrentEditor();
        Document document = editor.getDocument();
        final CaretModel caretModel = editor.getCaretModel();
        final int offset = caretModel.getOffset();
        String text = document.getText();

        if (!"".equals(text.substring(offset).trim())) {
            String before = text.substring(0, offset);
View Full Code Here

Examples of com.intellij.openapi.editor.Editor

        this.schema = schema;
    }

    public void actionPerformed(AnActionEvent e) {
        Project project = ActionUtil.getProject(e);
        Editor editor = e.getData(PlatformDataKeys.EDITOR);
        if (project != null && editor != null) {
            FileConnectionMappingManager.getInstance(project).setCurrentSchemaForSelectedEditor(editor, schema);
        }
    }
View Full Code Here

Examples of com.intellij.openapi.editor.Editor

    private void pasteStatement(final StatementGeneratorResult result, final Project project) {
        new SimpleLaterInvocator() {
            @Override
            public void execute() {
                Editor editor = EditorUtil.getSelectedEditor(project, SQLFileType.INSTANCE);
                if (editor != null)
                    pasteToEditor(editor, result); else
                    pasteToClipboard(result);
            }
        }.start();
View Full Code Here

Examples of com.intellij.openapi.editor.Editor

            }
        }
    }

    public void loadFromEditor(@NotNull FileEditorStateLevel level, @NotNull TextEditor textEditor) {
        Editor editor = textEditor.getEditor();
        Project project = editor.getProject();
        SelectionModel selectionModel = editor.getSelectionModel();
        LogicalPosition logicalPosition = editor.getCaretModel().getLogicalPosition();

        line = logicalPosition.line;
        column = logicalPosition.column;

        if(FileEditorStateLevel.FULL == level) {
View Full Code Here

Examples of com.intellij.openapi.editor.Editor

        }
        verticalScrollProportion = level != FileEditorStateLevel.UNDO ? EditorUtil.calcVerticalScrollProportion(editor) : -1F;
    }

    public void applyToEditor(@NotNull TextEditor textEditor) {
        final Editor editor = textEditor.getEditor();
        final Project project = editor.getProject();
        SelectionModel selectionModel = editor.getSelectionModel();

        LogicalPosition logicalPosition = new LogicalPosition(line, column);
        editor.getCaretModel().moveToLogicalPosition(logicalPosition);
        selectionModel.removeSelection();
        editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
        if (verticalScrollProportion != -1F)
            EditorUtil.setVerticalScrollProportion(editor, verticalScrollProportion);
        Document document = editor.getDocument();
        if (selectionStart == selectionEnd) {
            selectionModel.removeSelection();
        } else {
            int selectionStart = Math.min(this.selectionStart, document.getTextLength());
            int selectionEnd = Math.min(this.selectionEnd, document.getTextLength());
            selectionModel.setSelection(selectionStart, selectionEnd);
        }
        ((EditorEx) editor).stopOptimizedScrolling();
        editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);


/*
        if (project != null && getFoldingState() != null) {
            PsiDocumentManager.getInstance(project).commitDocument(document);
View Full Code Here

Examples of com.intellij.openapi.editor.Editor

        }
        return null;
    }

    public static Editor getSelectedEditor(Project project, FileType fileType){
        final Editor editor = EditorUtil.getSelectedEditor(project);
        if (editor != null && DocumentUtil.getVirtualFile(editor).getFileType().equals(fileType)) {
            return editor;
        }
        return null;
    }
View Full Code Here

Examples of com.intellij.openapi.editor.Editor

                    BasicTextEditor basicTextEditor = (BasicTextEditor) fileEditors[0];
                    return basicTextEditor.getVirtualFile();
                }
            }

            Editor editor = fileEditorManager.getSelectedTextEditor();
            if (editor != null) {
                return DocumentUtil.getVirtualFile(editor);
            }
        }
        return null;
View Full Code Here

Examples of com.intellij.openapi.editor.Editor

    public void formatCase(PsiFile file) {
        Document document = DocumentUtil.getDocument(file);
        if (document != null && document.isWritable()) {
            Editor[] editors = EditorFactory.getInstance().getEditors(document);
            if (editors.length == 1) {
                Editor editor = editors[0];
                SelectionModel selectionModel = editor.getSelectionModel();
                int selectionStart = selectionModel.getSelectionStart();
                int selectionEnd = selectionModel.getSelectionEnd();
                format(document, file, selectionStart, selectionEnd);
            }
        }
View Full Code Here

Examples of com.intellij.openapi.editor.Editor

  public static VirtualFile getVirtualFile(AnActionEvent e)
  {
    VirtualFile result = e.getData(DataKeys.VIRTUAL_FILE);
    if (result == null)
    {
      Editor editor = e.getData(DataKeys.EDITOR);
      if (editor != null)
      {
        result = FileDocumentManager.getInstance().getFile(editor.getDocument());
      }
    }

    return result;
  }
View Full Code Here

Examples of com.intellij.openapi.editor.Editor

  }

  public boolean isSelected(AnActionEvent e)
  {
    VcsContext context = VcsContextFactory.SERVICE.getInstance().createContextOn(e);
    Editor editor = context.getEditor();
    if (editor == null)
    {
      return false;
    }

    Collection annotations = editor.getUserData(KEY_IN_EDITOR);
    return annotations != null && !annotations.isEmpty();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.