Java 类com.intellij.openapi.editor.EditorGutter 实例源码

项目:intellij-ce-playground    文件:QuickEvaluateAction.java   
@Override
public boolean isEnabled(@NotNull final Project project, final AnActionEvent event) {
  if (!myHandler.isEnabled(project)) {
    return false;
  }

  Editor editor = event.getData(CommonDataKeys.EDITOR);
  if (editor == null) {
    return false;
  }

  if (EditorGutter.KEY.getData(event.getDataContext()) != null) {
    return false;
  }

  return true;
}
项目:consulo    文件:QuickEvaluateAction.java   
@Override
public boolean isEnabled(@Nonnull final Project project, final AnActionEvent event) {
  if (!myHandler.isEnabled(project)) {
    return false;
  }

  Editor editor = event.getData(CommonDataKeys.EDITOR);
  if (editor == null) {
    return false;
  }

  if (event.getData(EditorGutter.KEY) != null) {
    return false;
  }

  return true;
}
项目:ali-idea-plugin    文件:DevMotiveAnnotationGutter.java   
public DevMotiveAnnotationGutter(Project project, FileAnnotation annotation, List<VcsFileRevision> revisions, EditorGutter editorGutter) {
    this.annotation = annotation;

    devMotivePanel = AliContentFactory.addDevMotiveContent(project, annotation.getFile(), revisions, annotation.getVcsKey().getName(), this, true);
    devMotivePanel.addChangeListener(this);

    if (editorGutter instanceof EditorGutterComponentEx) {
        editorGutterComponentEx = (EditorGutterComponentEx) editorGutter;
        unknownLine = "???";
    } else {
        // unable to resize, make sure to reserve enough room
        unknownLine = "??????????";
    }
}
项目:intellij-ce-playground    文件:ShowQuickDocInfoAction.java   
@Override
public void update(AnActionEvent event) {
  Presentation presentation = event.getPresentation();
  DataContext dataContext = event.getDataContext();

  Project project = CommonDataKeys.PROJECT.getData(dataContext);
  if (project == null) {
    presentation.setEnabled(false);
    return;
  }

  Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
  PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(dataContext);
  if (editor == null && element == null) {
    presentation.setEnabled(false);
    return;
  }

  if (LookupManager.getInstance(project).getActiveLookup() != null) {
    if (!isValidForLookup()) {
      presentation.setEnabled(false);
    }
    else {
      presentation.setEnabled(true);
    }
  }
  else {
    if (editor != null) {
      if (EditorGutter.KEY.getData(event.getDataContext()) != null) {
        presentation.setEnabled(false);
        return;
      }
      PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
      if (file == null) {
        presentation.setEnabled(false);
      }

      if (element == null && file != null) {
        try {
          final PsiReference ref = file.findReferenceAt(editor.getCaretModel().getOffset());
          if (ref instanceof PsiPolyVariantReference) {
            element = ref.getElement();
          }
        }
        catch (IndexNotReadyException e) {
          element = null;
        }
      }
    }

    if (element != null) {
      presentation.setEnabled(true);
    }
  }
}
项目:consulo    文件:ShowQuickDocInfoAction.java   
@RequiredDispatchThread
@Override
public void update(AnActionEvent event) {
  Presentation presentation = event.getPresentation();

  Project project = event.getData(CommonDataKeys.PROJECT);
  if (project == null) {
    presentation.setEnabled(false);
    return;
  }

  Editor editor = event.getData(CommonDataKeys.EDITOR);
  PsiElement element = event.getData(CommonDataKeys.PSI_ELEMENT);
  if (editor == null && element == null) {
    presentation.setEnabled(false);
    return;
  }

  if (LookupManager.getInstance(project).getActiveLookup() != null) {
    if (!isValidForLookup()) {
      presentation.setEnabled(false);
    }
    else {
      presentation.setEnabled(true);
    }
  }
  else {
    if (editor != null) {
      if (event.getData(EditorGutter.KEY) != null) {
        presentation.setEnabled(false);
        return;
      }
      PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
      if (file == null) {
        presentation.setEnabled(false);
      }

      if (element == null && file != null) {
        try {
          final PsiReference ref = file.findReferenceAt(editor.getCaretModel().getOffset());
          if (ref instanceof PsiPolyVariantReference) {
            element = ref.getElement();
          }
        }
        catch (IndexNotReadyException e) {
          element = null;
        }
      }
    }

    if (element != null) {
      presentation.setEnabled(true);
    }
  }
}