Package com.intellij.openapi.actionSystem

Examples of com.intellij.openapi.actionSystem.Presentation


    _actionEvent = e;
    _dataContext = e.getDataContext();

    final com.intellij.openapi.project.Project project = DataKeys.PROJECT.getData(_dataContext);
    assert project != null;
    final Presentation presentation = e.getPresentation();


    //final int caretOffset = editor.getCaretModel().getOffset();
    //psiFile.findElementAt(caretOffset);
View Full Code Here


  public void update(final AnActionEvent event) {
    try {
      _actionEvent = event;
      _dataContext = event.getDataContext();
      final com.intellij.openapi.project.Project project = DataKeys.PROJECT.getData(_dataContext);
      final Presentation presentation = event.getPresentation();

      // check a project is loaded
      if (isProjectNotLoaded(project, presentation)) {
        return;
      }

      isPluginAccessible(project);

      // check if tool window is registered
      final ToolWindow toolWindow = isToolWindowRegistered(project);
      if (toolWindow == null) {
        presentation.setEnabled(false);
        presentation.setVisible(false);

        return;
      }

      registerEventListener(project);

      final VirtualFile[] selectedSourceFiles = IdeaUtilImpl.getVirtualFiles(_dataContext);

      if (!_running) {
        _enabled = selectedSourceFiles != null &&
            selectedSourceFiles.length > 0 &&
            selectedSourceFiles[0].isValid() &&
            IdeaUtilImpl.isValidFileType(selectedSourceFiles[0].getFileType()) &&
            IdeaUtilImpl.getCurrentClass(_dataContext) != null;
      }

      presentation.setEnabled(toolWindow.isAvailable() && isEnabled());
      presentation.setVisible(true);

    } catch (final Throwable e) {
      final FindBugsPluginException processed = FindBugsPluginImpl.processError("Action update failed", e);
      LOGGER.error("Action update failed", processed);
    }
View Full Code Here

    try {
      _actionEvent = event;
      _dataContext = event.getDataContext();

      final Project project = DataKeys.PROJECT.getData(_dataContext);
      final Presentation presentation = event.getPresentation();

      // check a project is loaded
      if (isProjectNotLoaded(project, presentation)) {
        return;
      }

      isPluginAccessible(project);

      // check if tool window is registered
      final ToolWindow toolWindow = isToolWindowRegistered(project);
      if (toolWindow == null) {
        presentation.setEnabled(false);
        presentation.setVisible(false);

        return;
      }

      // enable ?
      final Content content = toolWindow.getContentManager().getContent(0);

      if (content != null) {
        final ToolWindowPanel panel = (ToolWindowPanel) content.getComponent();
        final JTree tree = panel.getBugTreePanel().getBugTree();
        _enabled = tree.isCollapsed(1) && tree.getRowCount() > 1;
        presentation.setEnabled(toolWindow.isAvailable() && isEnabled());
        presentation.setVisible(true);
      }
    } catch (final Throwable e) {
      final FindBugsPluginException processed = FindBugsPluginImpl.processError("Action update failed", e);
      LOGGER.error("Action update failed", processed);
    }
View Full Code Here

  public void actionPerformed(final AnActionEvent e) {
    _actionEvent = e;
    _dataContext = e.getDataContext();

    final com.intellij.openapi.project.Project project = DataKeys.PROJECT.getData(_dataContext);
    final Presentation presentation = e.getPresentation();

    // check a project is loaded
    if (isProjectNotLoaded(project, presentation)) {
      Messages.showWarningDialog("Project not loaded.", "FindBugs");
      return;
View Full Code Here

  public void update(final AnActionEvent event) {
    try {
      _actionEvent = event;
      _dataContext = event.getDataContext();
      final com.intellij.openapi.project.Project project = DataKeys.PROJECT.getData(_dataContext);
      final Presentation presentation = event.getPresentation();

      // check a project is loaded
      if (isProjectNotLoaded(project, presentation)) {
        return;
      }

      isPluginAccessible(project);

      // check if tool window is registered
      final ToolWindow toolWindow = isToolWindowRegistered(project);
      if (toolWindow == null) {
        presentation.setEnabled(false);
        presentation.setVisible(false);

        return;
      }

      registerEventListener(project);

      _enabled = !isRunning();

      presentation.setEnabled(toolWindow.isAvailable() && isEnabled());
      presentation.setVisible(true);

    } catch (final Throwable e) {
      final FindBugsPluginException processed = FindBugsPluginImpl.processError("Action update failed", e);
      LOGGER.error("Action update failed", processed);
    }
View Full Code Here

    _actionEvent = e;
    _dataContext = e.getDataContext();

    final com.intellij.openapi.project.Project project = DataKeys.PROJECT.getData(_dataContext);
    assert project != null;
    final Presentation presentation = e.getPresentation();

    // check a project is loaded
    if (isProjectNotLoaded(project, presentation)) {
      Messages.showWarningDialog("Project not loaded.", "FindBugs");
      return;
View Full Code Here

  public void update(final AnActionEvent event) {
    try {
      _actionEvent = event;
      _dataContext = event.getDataContext();
      final Project project = DataKeys.PROJECT.getData(_dataContext);
      final Presentation presentation = event.getPresentation();

      // check a project is loaded, true when project is null
      if (isProjectNotLoaded(project, presentation)) {
        return;
      }

      isPluginAccessible(project);

      // check if tool window is registered
      final ToolWindow toolWindow = isToolWindowRegistered(project);
      if (toolWindow == null) {
        presentation.setEnabled(false);
        presentation.setVisible(false);

        return;
      }

      registerEventListener(project);

      final VirtualFile[] selectedSourceFiles = IdeaUtilImpl.getVirtualFiles(_dataContext);

      // enable ?
      if (!_running) {
        _enabled = selectedSourceFiles != null && selectedSourceFiles.length == 1 &&
            (IdeaUtilImpl.isValidFileType(selectedSourceFiles[0].getFileType()) || selectedSourceFiles[0].isDirectory()) &&
            null != getPackagePath(selectedSourceFiles, project);
      }
      presentation.setEnabled(toolWindow.isAvailable() && isEnabled());
      presentation.setVisible(true);

    } catch (final Throwable e) {
      final FindBugsPluginException processed = FindBugsPluginImpl.processError("Action update failed", e);
      LOGGER.error("Action update failed", processed);
    }
View Full Code Here

    _dataContext = e.getDataContext();
    //final Presentation presentation = e.getPresentation();

    final com.intellij.openapi.project.Project project = DataKeys.PROJECT.getData(_dataContext);
    assert project != null;
    final Presentation presentation = e.getPresentation();

    // check a project is loaded
    if (isProjectNotLoaded(project, presentation)) {
      Messages.showWarningDialog("Project not loaded.", "FindBugs");
      return;
View Full Code Here

  public void update(final AnActionEvent event) {
    try {
      _actionEvent = event;
      _dataContext = event.getDataContext();
      final Project project = DataKeys.PROJECT.getData(_dataContext);
      final Presentation presentation = event.getPresentation();

      // check a project is loaded
      if (isProjectNotLoaded(project, presentation)) {
        return;
      }

      isPluginAccessible(project);

      // check if tool window is registered
      final ToolWindow toolWindow = isToolWindowRegistered(project);
      if (toolWindow == null) {
        presentation.setEnabled(false);
        presentation.setVisible(false);

        return;
      }

      registerEventListener(project);

      // enable ?
      final List<VirtualFile> modifiedFiles = IdeaUtilImpl.getAllModifiedFiles(_dataContext);
      if (!_running && !modifiedFiles.isEmpty()) {
        for (final VirtualFile virtualFile : modifiedFiles) {
          if (IdeaUtilImpl.isValidFileType(virtualFile.getFileType())) {
            _enabled = true;
            break;
          } else {
            _enabled = false;
          }
        }
      } else {
        _enabled = false;
      }

      presentation.setEnabled(toolWindow.isAvailable() && isEnabled());
      presentation.setVisible(true);

    } catch (final Throwable e) {
      final FindBugsPluginException processed = FindBugsPluginImpl.processError("Action update failed", e);
      LOGGER.error("Action update failed", processed);
    }
View Full Code Here

    _dataContext = e.getDataContext();

    final com.intellij.openapi.project.Project project = DataKeys.PROJECT.getData(_dataContext);
    assert project != null;
    EventManagerImpl.getInstance().addEventListener(new BugReporterEventFilter(project.getName()), this);
    final Presentation presentation = e.getPresentation();

    // check a project is loaded
    if (isProjectNotLoaded(project, presentation)) {
      Messages.showWarningDialog("Project not loaded.", "FindBugs");
      return;
View Full Code Here

TOP

Related Classes of com.intellij.openapi.actionSystem.Presentation

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.