Package com.intellij.openapi.editor.ex

Examples of com.intellij.openapi.editor.ex.EditorEx


        this.executeHandler = executeHandler;
        EmptyAction.setupAction(this, actionId, null);
    }

    public void update(AnActionEvent e) {
        EditorEx editor = console.getConsoleEditor();
        Lookup lookup = LookupManager.getActiveLookup(editor);
        e.getPresentation().setEnabled(!processHandler.isProcessTerminated() &&
            (lookup == null || !lookup.isCompletion()));
    }
View Full Code Here


    });
  }

  @Override
  protected EditorEx createEditor() {
    EditorEx editor = super.createEditor();
    editor.setVerticalScrollbarVisible(true);
    editor.setHorizontalScrollbarVisible(true);
    return editor;
  }
View Full Code Here

          @Override
          public void run() {
            FileManager fileManager = ((PsiManagerEx)PsiManager.getInstance(project)).getFileManager();
            for (FileEditor fileEditor : fileEditorManager.getAllEditors()) {
              if (!(fileEditor instanceof TextEditor)) continue;
              EditorEx editor = (EditorEx)((TextEditor)fileEditor).getEditor();
              Document document = editor.getDocument();
              VirtualFile virtualFile = editor.getVirtualFile();
              Language language = virtualFile instanceof LightVirtualFile ? ((LightVirtualFile)virtualFile).getLanguage() : null;
              if (!(language instanceof LivePreviewLanguage)) continue;

              FileContentUtil.reparseFiles(project, Collections.singletonList(virtualFile), false);
              fileManager.setViewProvider(virtualFile, fileManager.createFileViewProvider(virtualFile, true));
              PsiDocumentManagerImpl.cachePsi(document, ObjectUtils.assertNotNull(PsiManager.getInstance(project).findFile(virtualFile)));
              editor.setHighlighter(EditorHighlighterFactory.getInstance().createEditorHighlighter(project, virtualFile));
            }
          }
        });
      }
    }, project);
View Full Code Here

                    if (project == null) {
                        throw new RuntimeException("project is null!");
                    }
                    codeContent = new EditorTextField(sb.toString(), project, StdFileTypes.JAVA) {
                        protected EditorEx createEditor() {
                            EditorEx editor = super.createEditor();
                            editor.setVerticalScrollbarVisible(true);
                            return editor;
                        }

                        @Override
                        protected boolean isOneLineMode() {
View Full Code Here

  public void execute() {
    if (myProcessInputWriter == null || myConsoleHistoryModel == null) {
      return;
    }
    LanguageConsoleImpl console = getConsole();
    EditorEx consoleEditor = console.getConsoleEditor();
    Document editorDocument = consoleEditor.getDocument();
    String text = editorDocument.getText();

    PsiFile file = console.getFile();
    final Map<String, ErlangQVar> context = file.getOriginalFile().getUserData(ErlangVarProcessor.ERLANG_VARIABLE_CONTEXT);
    if (context != null) { // todo: process only successful statements
View Full Code Here

            public void fileOpened(FileEditorManager source, VirtualFile file) {
                if (!Comparing.equal(file, myVirtualFile) || myConsoleEditor == null) return;
                Editor selectedTextEditor = source.getSelectedTextEditor();
                for (FileEditor fileEditor : source.getAllEditors(file)) {
                    if (!(fileEditor instanceof TextEditor)) continue;
                    final EditorEx editor = (EditorEx) ((TextEditor) fileEditor).getEditor();
                    editor.addFocusListener(myFocusListener);
                    if (selectedTextEditor == editor) { // already focused
                        myCurrentEditor = editor;
                    }
                    EmptyAction.registerActionShortcuts(editor.getComponent(), myConsoleEditor.getComponent());
                    editor.getCaretModel().addCaretListener(new CaretListener() {
                        public void caretPositionChanged(CaretEvent e) {
                            queueUiUpdate(false);
                        }
                    });
                }
View Full Code Here

        actionList.addAll(executionActions);

        actionList.add(new ToggleUseSoftWrapsToolbarAction(SoftWrapAppliancePlaces.CONSOLE) {
            @Override
            public void setSelected(AnActionEvent e, boolean state) {
                EditorEx consoleEditor = languageConsole.getConsoleEditor();
                EditorEx historyViewer = languageConsole.getHistoryViewer();

                consoleEditor.getSettings().setUseSoftWraps(state);
                historyViewer.getSettings().setUseSoftWraps(state);

                consoleEditor.reinitSettings();
                historyViewer.reinitSettings();
            }
        });

        actionList.add(CommonActionsManager.getInstance().createHelpAction("interactive_console"));
View Full Code Here

        @Override
        public void layoutContainer(final Container parent) {
            final int componentCount = parent.getComponentCount();
            if (componentCount == 0) return;
            final EditorEx history = myHistoryViewer;
            final EditorEx editor = componentCount == 2 ? myConsoleEditor : null;

            if (editor == null) {
                parent.getComponent(0).setBounds(parent.getBounds());
                return;
            }

            final Dimension panelSize = parent.getSize();
            if (panelSize.getHeight() <= 0) return;
            final Dimension historySize = history.getContentSize();
            final Dimension editorSize = editor.getContentSize();
            final Dimension newEditorSize = new Dimension();

            // deal with width
            final int width = Math.max(editorSize.width, historySize.width);
            newEditorSize.width = width + editor.getScrollPane().getHorizontalScrollBar().getHeight();
            history.getSoftWrapModel().forceAdditionalColumnsUsage();
            editor.getSettings().setAdditionalColumnsCount(2 + (width - editorSize.width) / EditorUtil.getSpaceWidth(Font.PLAIN, editor));
            history.getSettings().setAdditionalColumnsCount(2 + (width - historySize.width) / EditorUtil.getSpaceWidth(Font.PLAIN, history));

            // deal with height
            if (historySize.width == 0) historySize.height = 0;
            final int minHistorySize = historySize.height > 0 ? 2 * history.getLineHeight() + (myShowSeparatorLine ? SEPARATOR_THICKNESS : 0) : 0;
            final int minEditorSize = editor.isViewer() ? 0 : editor.getLineHeight();
            final int editorPreferred = editor.isViewer() ? 0 : Math.max(minEditorSize, editorSize.height);
            final int historyPreferred = Math.max(minHistorySize, historySize.height);
            if (panelSize.height < minEditorSize) {
                newEditorSize.height = panelSize.height;
            } else if (panelSize.height < editorPreferred) {
                newEditorSize.height = panelSize.height - minHistorySize;
            } else if (panelSize.height < editorPreferred + historyPreferred) {
                newEditorSize.height = editorPreferred;
            } else {
                newEditorSize.height = editorPreferred == 0 ? 0 : panelSize.height - historyPreferred;
            }
            final Dimension newHistorySize = new Dimension(width, panelSize.height - newEditorSize.height);

            // apply
            editor.getComponent().setBounds(0, newHistorySize.height, panelSize.width, newEditorSize.height);
            myForceScrollToEnd.compareAndSet(false, shouldScrollHistoryToEnd());
            history.getComponent().setBounds(0, 0, panelSize.width, newHistorySize.height);
        }
View Full Code Here

                            StringUtil.convertLineSeparators(new String(text)), false, true);
                    VirtualFile virtualFile = psiFile.getViewProvider().getVirtualFile();
                    if (virtualFile instanceof LightVirtualFile) ((LightVirtualFile) virtualFile).setWritable(false);
                    Document document = FileDocumentManager.getInstance().getDocument(virtualFile);
                    EditorFactory editorFactory = EditorFactory.getInstance();
                    EditorEx editor = (EditorEx) editorFactory.createViewer(document, project);
                    editor.getSettings().setFoldingOutlineShown(false);
                    editor.getSettings().setLineMarkerAreaShown(false);
                    editor.getSettings().setIndentGuidesShown(false);

                    SyntaxHighlighter highlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(language, project, psiFile.getViewProvider().getVirtualFile());
                    editor.setHighlighter(new LexerEditorHighlighter(highlighter, editor.getColorsScheme()));
                    return editor;
                }
            };
            chooser.setContentIcon(null);
            chooser.setSplitterOrientation(false);
View Full Code Here

    actionList.addAll(executionActions);

    actionList.add(new ToggleUseSoftWrapsToolbarAction(SoftWrapAppliancePlaces.CONSOLE) {
      @Override
      public void setSelected(AnActionEvent e, boolean state) {
        EditorEx consoleEditor = getLanguageConsole().getConsoleEditor();
        EditorEx historyViewer = getLanguageConsole().getHistoryViewer();

        consoleEditor.getSettings().setUseSoftWraps(state);
        historyViewer.getSettings().setUseSoftWraps(state);

        consoleEditor.reinitSettings();
        historyViewer.reinitSettings();
      }
    });

    // help action
    actionList.add(CommonActionsManager.getInstance().createHelpAction("interactive_console"));
View Full Code Here

TOP

Related Classes of com.intellij.openapi.editor.ex.EditorEx

Copyright © 2018 www.massapicom. 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.