Package com.intellij.openapi.editor

Examples of com.intellij.openapi.editor.Editor


        editorComponents.clear();
    }

    @Override
    public void editorCreated(@NotNull EditorFactoryEvent editorFactoryEvent) {
        Editor editor = editorFactoryEvent.getEditor();
        if (editor.getProject() == null) {
            return;
        }
        BWACEditorComponent editorComponent = new BWACEditorComponent(editor, settings.autoHighlight);
        editorComponents.put(editor, editorComponent);
    }
View Full Code Here


        presentation.setEnabled(isEnabled(actionEvent));
    }

    public boolean isEnabled(AnActionEvent event) {
        Project project = ProjectUtil.getProject(event);
        Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor();
        if (editor != null) {
            File scriptFile = getScriptFile(editor);
            return jsFileFilter.accept(scriptFile);
        }
        return false;
View Full Code Here

    }

    public void actionPerformed(AnActionEvent event) {

        Project project = ProjectUtil.getProject(event);
        Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor();

        if (editor != null) {
            String scriptContent = getEditorContent(editor, project);

            File scriptFile = getScriptFile(editor);
View Full Code Here

  }

  public void invoke(@NotNull Project project, @NotNull PsiElement[] elements, @Nullable DataContext dataContext) {
    PsiElement element = elements.length == 1 ? elements[0] : null;
    if (element == null) element = getElement(dataContext);
    Editor editor = dataContext == null ? null : PlatformDataKeys.EDITOR.getData(dataContext);
    invokeInner(project, editor, element);
  }
View Full Code Here

  public void invoke(@NotNull Project project, @NotNull PsiElement[] elements, @Nullable DataContext dataContext) {
    PsiElement element = elements.length == 1 ? elements[0] : null;
    if (element == null) {
      element = getElement(dataContext);
    }
    Editor editor = dataContext == null ? null : PlatformDataKeys.EDITOR.getData(dataContext);
    invokeInner(project, editor, element);
  }
View Full Code Here

    applyFixInner(project);
  }

  private void applyFixInner(final Project project) {
    final PsiFile psiFile = myClass.getContainingFile();
    final Editor editor = CodeInsightUtil.positionCursor(project, psiFile, myClass.getLBrace());
    if (editor != null) {
      new WriteCommandAction(project, psiFile) {
        protected void run(Result result) throws Throwable {

          final PsiElementFactory psiElementFactory = JavaPsiFacade.getInstance(myClass.getProject()).getElementFactory();
          final PsiField psiField = psiElementFactory.createField(myName, myType);

          final PsiModifierList modifierList = psiField.getModifierList();
          if (null != modifierList) {
            for (String modifier : myModifiers) {
              modifierList.setModifierProperty(modifier, true);
            }
          }
          if (null != myInitializerText) {
            PsiExpression psiInitializer = psiElementFactory.createExpressionFromText(myInitializerText, psiField);
            psiField.setInitializer(psiInitializer);
          }

          final List<PsiGenerationInfo<PsiField>> generationInfos = GenerateMembersUtil.insertMembersAtOffset(myClass.getContainingFile(), editor.getCaretModel().getOffset(),
              Collections.singletonList(new PsiGenerationInfo<PsiField>(psiField)));
          if (!generationInfos.isEmpty()) {
            PsiField psiMember = generationInfos.iterator().next().getPsiMember();
            editor.getCaretModel().moveToOffset(psiMember.getTextRange().getEndOffset());
          }

          UndoUtil.markPsiFileForUndo(psiFile);
        }
View Full Code Here

    applyFixInner(project);
  }

  private void applyFixInner(final Project project) {
    final PsiFile file = myAnnotation.getContainingFile();
    final Editor editor = CodeInsightUtil.positionCursor(project, file, myAnnotation);
    if (editor != null) {
      new WriteCommandAction(project, file) {
        protected void run(Result result) throws Throwable {
          final PsiNameValuePair valuePair = selectAnnotationAttribute();
View Full Code Here

    return new AnAction()
    {
      @Override
      public void actionPerformed(AnActionEvent e)
      {
        Editor editor = e.getData(DataKeys.EDITOR);
        if (editor != null)
        {
          editor.getCaretModel().moveToOffset(editor.getDocument().getLineStartOffset(lineStart));
        }

        // Could also be managed through a listener...
        Project project = e.getData(DataKeys.PROJECT);
        if (project != null)
View Full Code Here

  private class CustomEditorFactoryListener implements EditorFactoryListener
  {
    public void editorCreated(EditorFactoryEvent event)
    {
      final Editor editor = event.getEditor();

      VirtualFile vFile = FileDocumentManager.getInstance().getFile(editor.getDocument());
      if (vFile == null)
      {
        return;
      }

      DocumentChangeTracker documentChangeTracker = changeTrackers.get(vFile);
      if (documentChangeTracker == null)
      {
        documentChangeTracker = new DocumentChangeTracker(editor.getDocument());
        changeTrackers.put(vFile, documentChangeTracker);
      }
      documentChangeTracker.getEditors().add(editor);

      for (Review review : RevuUtils.getActiveReviewsForCurrentUser(project))
View Full Code Here

      }
    }

    public void editorReleased(EditorFactoryEvent event)
    {
      Editor editor = event.getEditor();

      VirtualFile vFile = FileDocumentManager.getInstance().getFile(editor.getDocument());
      if (vFile == null)
      {
        return;
      }
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.