Package com.intellij.openapi.actionSystem

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();

      //final Module module = IdeaUtilImpl.getModule(_dataContext);

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


  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 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;
      }

      _enabled = !_running;
      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 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

    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 BugTree tree = panel.getBugTreePanel().getBugTree();
        _enabled = tree.hasNextOccurence();
        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
      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

    super(text, text, icon);
    this.fileType = fileType;
  }

  protected void update(FileSystemTree fileSystemTree, AnActionEvent e) {
    Presentation presentation = e.getPresentation();
    presentation.setVisible(true);
    VirtualFile selectedFile = fileSystemTree.getNewFileParent();
    presentation.setEnabled(selectedFile != null);
    // FORK DIFF (got rid of layered "new" icon because it's ugly)
    presentation.setIcon(fileType != null ? fileType.getIcon() : null);
  }
View Full Code Here

    boolean fileDoesNotExist = false;
    if (isAtPluginRoot) {
      fileDoesNotExist = (parentFile.findChild(newFileName) == null);
    }

    Presentation presentation = e.getPresentation();
    presentation.setVisible(isAtPluginRoot && fileDoesNotExist);
    presentation.setEnabled(isAtPluginRoot && fileDoesNotExist);
    presentation.setIcon(fileType.getIcon());
  }
View Full Code Here

      @Override public void run() {
        AnActionEvent event = new AnActionEvent(
            null,
            IdeUtil.DUMMY_DATA_CONTEXT,
            PluginRunner.IDE_STARTUP,
            new Presentation(),
            ActionManager.getInstance(),
            0
        );
        final ErrorReporter errorReporter = new ErrorReporter();
        RunPluginAction.runPlugins(pluginIdToPathMap().keySet(), event, errorReporter, RunPluginAction.createPluginRunners(errorReporter));
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.