Package com.intellij.openapi.editor

Examples of com.intellij.openapi.editor.Editor


                        BasicTextEditor textEditor = EditorUtil.getFileEditor(databaseFile, virtualFile);
                        descriptor.navigateIn(textEditor.getEditor());
                        return;
                    }

                    Editor editor = editorManager.getSelectedTextEditor();
                    if (editor != null && virtualFile == DocumentUtil.getVirtualFile(editor)) {
                        super.navigate(requestFocus);
                        return;
                    }
View Full Code Here


    public abstract String getName();

    public abstract Icon getIcon();

    private void updateEditorActions(BasicTextEditor fileEditor) {
        Editor editor = fileEditor.getEditor();
        ActionToolbar actionToolbar = ActionUtil.createActionToolbar("", true, "DBNavigator.ActionGroup.SourceEditor");
        JComponent editorComponent = editor.getComponent();
        actionToolbar.setTargetComponent(editorComponent);
        //FileEditorManager.getInstance(editor.getProject()).addTopComponent(fileEditor, actionToolbar.getComponent());
        editorComponent.getParent().add(actionToolbar.getComponent(), BorderLayout.NORTH);
    }
View Full Code Here

import com.intellij.psi.PsiFile;

public class ExecuteStatementAction extends AnAction {
    public void actionPerformed(AnActionEvent e) {
        Project project = ActionUtil.getProject(e);
        Editor editor = e.getData(PlatformDataKeys.EDITOR);
        if (project != null && editor != null) {
            StatementExecutionManager.getInstance(project).executeSelectedStatement(editor);
            PsiFile file = DocumentUtil.getFile(editor);
            DocumentUtil.refreshEditorAnnotations(file);
        }
View Full Code Here

        presentation.setText("Execute statement");
    }

    private boolean isEnabled(AnActionEvent e) {
        Project project = ActionUtil.getProject(e);
        Editor editor = e.getData(PlatformDataKeys.EDITOR);
        if (project == null || editor == null) {
            return false;
        } else {
            PsiFile psiFile = PsiUtil.getPsiFile(project, editor.getDocument());
            return psiFile instanceof DBLanguageFile;
        }
    }
View Full Code Here

    final RelativePoint popupPosition = JBPopupFactory.getInstance().guessBestPopupLocation(e.getDataContext());
    PsiDocumentManager.getInstance(project).commitAllDocuments();
    FeatureUsageTracker.getInstance().triggerFeatureUsed("navigation.goto.usages");

    UsageTarget[] usageTargets = e.getData(UsageView.USAGE_TARGETS_KEY);
    final Editor editor = e.getData(PlatformDataKeys.EDITOR);
    if (usageTargets == null) {
      chooseAmbiguousTargetAndPerform(project, editor,
          new PsiElementProcessor<PsiElement>() {
            @Override
            public boolean execute(@NotNull final PsiElement element) {
View Full Code Here

    if (element == null) return -1;
    return element.getTextRange().getStartOffset();
  }

  private static boolean areAllUsagesInOneLine(@NotNull Usage visibleUsage, @NotNull List<Usage> usages) {
    Editor editor = getEditorFor(visibleUsage);
    if (editor == null) return false;
    int offset = getUsageOffset(visibleUsage);
    if (offset == -1) return false;
    int lineNumber = editor.getDocument().getLineNumber(offset);
    for (Usage other : usages) {
      Editor otherEditor = getEditorFor(other);
      if (otherEditor != editor) return false;
      int otherOffset = getUsageOffset(other);
      if (otherOffset == -1) return false;
      int otherLine = otherEditor.getDocument().getLineNumber(otherOffset);
      if (otherLine != lineNumber) return false;
    }
    return true;
  }
View Full Code Here

      @NotNull final RelativePoint popupPosition,
      final int maxUsages,
      @NotNull final FindUsagesOptions options) {
    usage.navigate(true);
    if (hint == null) return;
    final Editor newEditor = getEditorFor(usage);
    if (newEditor == null) return;
    final Project project = handler.getProject();
    //opening editor is performing in invokeLater
    IdeFocusManager.getInstance(project).doWhenFocusSettlesDown(new Runnable() {
      @Override
      public void run() {
        newEditor.getScrollingModel().runActionOnScrollingFinished(new Runnable() {
          @Override
          public void run() {
            // after new editor created, some editor resizing events are still bubbling. To prevent hiding hint, invokeLater this
            IdeFocusManager.getInstance(project).doWhenFocusSettlesDown(new Runnable() {
              @Override
              public void run() {
                if (newEditor.getComponent().isShowing()) {
                  showHint(hint, newEditor, popupPosition, handler, maxUsages, options);
                }
              }
            });
          }
View Full Code Here

        // implement a command
        LanguageConsoleImpl languageConsole = processHandler.getLanguageConsole();
        languageConsole.setInputText(command);

        Editor editor = languageConsole.getCurrentEditor();
        CaretModel caretModel = editor.getCaretModel();
        caretModel.moveToOffset(command.length());

        HaskellConsole console = (HaskellConsole) languageConsole;
        HaskellConsoleExecuteActionHandler handler = console.getExecuteHandler();
View Full Code Here

    @Override
    public void update(AnActionEvent e) {
        Presentation presentation = e.getPresentation();

        Editor editor = e.getData(DataKeys.EDITOR);

        if (editor == null) {
            presentation.setEnabled(false);
            return;
        }
        Project project = editor.getProject();
        if (project == null) {
            presentation.setEnabled(false);
            return;
        }

        Document document = editor.getDocument();
        PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document);
        if (psiFile == null || !(psiFile instanceof HaskellFile)) {
            presentation.setEnabled(false);
            return;
        }
View Full Code Here

import java.io.File;

public final class LoadHaskellFileInConsoleAction extends HaskellConsoleActionBase {

    public void actionPerformed(AnActionEvent e) {
        Editor editor = e.getData(DataKeys.EDITOR);
        if (editor == null)
            return;
        Project project = editor.getProject();
        if (project == null)
            return;
        Document document = editor.getDocument();
        PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document);
        if (psiFile == null || !(psiFile instanceof HaskellFile))
            return;
        VirtualFile virtualFile = psiFile.getVirtualFile();
        if (virtualFile == null)
View Full Code Here

TOP

Related Classes of com.intellij.openapi.editor.Editor

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.