コード例 #1
0
 @Override
 public final void update(final AnActionEvent e) {
   final Presentation presentation = e.getPresentation();
   final Project project = e.getProject();
   if (project == null) return;
   presentation.setEnabled(isEnabled());
   presentation.setText(getCurrentScopeType());
 }
コード例 #2
0
    @Override
    public final void update(final AnActionEvent event) {
      final Presentation presentation = event.getPresentation();

      final DataContext dataContext = event.getDataContext();
      final HierarchyBrowserBaseEx browser =
          (HierarchyBrowserBaseEx) dataContext.getData(myBrowserDataKey);
      if (browser == null) {
        presentation.setVisible(false);
        presentation.setEnabled(false);
        return;
      }

      presentation.setVisible(true);

      final PsiElement selectedElement = browser.getSelectedElement();
      if (selectedElement == null || !browser.isApplicableElement(selectedElement)) {
        presentation.setEnabled(false);
        presentation.setVisible(false);
        return;
      }

      presentation.setEnabled(isEnabled(browser, selectedElement));
      String nonDefaultText = getNonDefaultText(browser, selectedElement);
      if (nonDefaultText != null) {
        presentation.setText(nonDefaultText);
      }
    }
  public void update(final AnActionEvent event) {
    super.update(event);

    final Presentation presentation = event.getPresentation();
    final DataContext context = event.getDataContext();
    Module module = (Module) context.getData(LangDataKeys.MODULE.getName());
    PsiFile currentFile = (PsiFile) context.getData(LangDataKeys.PSI_FILE.getName());
    Editor editor = (Editor) context.getData(PlatformDataKeys.EDITOR.getName());
    // VirtualFile currentFile = (VirtualFile)
    // context.getData(PlatformDataKeys.VIRTUAL_FILE.getName());
    if (currentFile != null && editor != null) {
      boolean isSSFile =
          currentFile
              .getFileType()
              .getDefaultExtension()
              .equals(SilverStripeFileType.DEFAULT_EXTENSION);
      SelectionModel selectionModel = editor.getSelectionModel();
      String selectedText = selectionModel.getSelectedText();
      this.selectedText = selectedText;
      this.selectonModel = selectionModel;
      this.editor = editor;
      this.currentFile = currentFile;
      if (selectedText == null) {
        presentation.setEnabled(false);
      }
      if (!isSSFile) {
        presentation.setEnabled(false);
        presentation.setVisible(false);
      }
    } else {
      presentation.setEnabled(false);
      presentation.setVisible(false);
    }
  }
コード例 #4
0
 @Override
 public void update(AnActionEvent e) {
   Presentation presentation = e.getPresentation();
   presentation.setEnabled(myElements != null && myIndex < myElements.length - 1);
 }
コード例 #5
0
 @Override
 public void update(AnActionEvent e) {
   Presentation presentation = e.getPresentation();
   presentation.setEnabled(myIndex > 0);
 }
コード例 #6
0
 public void update(AnActionEvent event) {
   Presentation presentation = event.getPresentation();
   presentation.setEnabled(getTreeSelection() != null);
 }
コード例 #7
0
 @Override
 public final void update(final AnActionEvent event) {
   final Presentation presentation = event.getPresentation();
   presentation.setEnabled(isValidBase());
 }
コード例 #8
0
 @Override
 public final void update(@NotNull final AnActionEvent event) {
   super.update(event);
   final Presentation presentation = event.getPresentation();
   presentation.setEnabled(isValidBase());
 }