Examples of Presentation


Examples of com.intellij.openapi.actionSystem.Presentation

  @Override
  public void update(final AnActionEvent event) {
    try {
      final DataContext dataContext = event.getDataContext();
      final Project project = DataKeys.PROJECT.getData(dataContext);
      final Presentation presentation = event.getPresentation();

      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 ?
      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

Examples of com.intellij.openapi.actionSystem.Presentation

  @SuppressWarnings({"AssignmentToStaticFieldFromInstanceMethod"})
  @Override
  public void actionPerformed(final AnActionEvent e) {
    final Project project = IdeaUtilImpl.getProject(e.getDataContext());
    assert project != null;
    final Presentation presentation = e.getPresentation();

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

Examples of com.intellij.openapi.actionSystem.Presentation

  @Override
  public void update(final AnActionEvent event) {
    try {
      final Project project = DataKeys.PROJECT.getData(event.getDataContext());
      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);

      if (!_running) {
        _enabled = _bugCollection != null && _bugCollection.iterator().hasNext();
      }

      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

Examples of com.intellij.openapi.actionSystem.Presentation

    _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

Examples of com.intellij.openapi.actionSystem.Presentation

  public void update(final AnActionEvent event) {
    try {
      _actionEvent = event;
      _dataContext = event.getDataContext();
      _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

Examples of com.intellij.openapi.actionSystem.Presentation

  @Override
  public void update(final AnActionEvent event) {
    try {
      final DataContext dataContext = event.getDataContext();
      final Project project = DataKeys.PROJECT.getData(dataContext);
      final Presentation presentation = event.getPresentation();

      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 ?
      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

Examples of com.intellij.openapi.actionSystem.Presentation

  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

Examples of com.intellij.openapi.actionSystem.Presentation

  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 ?
      if (!_running) {
        _enabled = project != null && project.isInitialized() && project.isOpen();
      }
      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

Examples of com.intellij.openapi.actionSystem.Presentation

  @Override
  public final void update(final AnActionEvent event) {
    try {
      final DataContext dataContext = event.getDataContext();
      final Project project = DataKeys.PROJECT.getData(dataContext);
      final Presentation presentation = event.getPresentation();

      if (isProjectLoaded(project, presentation)) {
        return;
      }

      isPluginAccessible(project);

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

        return;
      }

      // selected ?
      final Boolean selected = isSelected(event) ? Boolean.TRUE : Boolean.FALSE;
      presentation.putClientProperty(SELECTED_PROPERTY, selected);
      //setSelected(event, isSelected(event));

      // enable ?
      if (isRunning() && selected || !isRunning()) {
        _enabled = Boolean.TRUE;
      }

      //_enabled = isRunning() && selected ? ;
      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

Examples of com.intellij.openapi.actionSystem.Presentation

    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.isExpanded(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
TOP
Copyright © 2018 www.massapi.com. 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.