private void initButton() {
   setIcon(myPresentation.getIcon());
   setEnabled(myPresentation.isEnabled());
   setText(myPresentation.getText());
   updateTooltipText(myPresentation.getDescription());
   updateButtonSize();
 }
      private AnAction patch(final AnAction child) {
        if (child instanceof ActionGroup) {
          return new IconsFreeActionGroup((ActionGroup) child);
        }

        Presentation presentation = child.getTemplatePresentation();
        return new AnAction(presentation.getText(), presentation.getDescription(), null) {
          @Override
          public void actionPerformed(@NotNull AnActionEvent e) {
            child.actionPerformed(e);
            UsageTrigger.trigger("welcome.screen." + e.getActionManager().getId(child));
          }

          @Override
          public void update(@NotNull AnActionEvent e) {
            child.update(e);
            e.getPresentation().setIcon(null);
          }

          @Override
          public boolean isDumbAware() {
            return child.isDumbAware();
          }
        };
      }
    private JComponent createActionPanel() {
      JPanel actions = new NonOpaquePanel();
      actions.setBorder(JBUI.Borders.emptyLeft(10));
      actions.setLayout(new BoxLayout(actions, BoxLayout.Y_AXIS));
      ActionManager actionManager = ActionManager.getInstance();
      ActionGroup quickStart =
          (ActionGroup) actionManager.getAction(IdeActions.GROUP_WELCOME_SCREEN_QUICKSTART);
      DefaultActionGroup group = new DefaultActionGroup();
      collectAllActions(group, quickStart);

      for (AnAction action : group.getChildren(null)) {
        JPanel button = new JPanel(new BorderLayout());
        button.setOpaque(false);
        button.setBorder(JBUI.Borders.empty(8, 20));
        AnActionEvent e =
            AnActionEvent.createFromAnAction(
                action,
                null,
                ActionPlaces.WELCOME_SCREEN,
                DataManager.getInstance().getDataContext(this));
        action.update(e);
        Presentation presentation = e.getPresentation();
        if (presentation.isVisible()) {
          String text = presentation.getText();
          if (text != null && text.endsWith("...")) {
            text = text.substring(0, text.length() - 3);
          }
          Icon icon = presentation.getIcon();
          if (icon.getIconHeight() != JBUI.scale(16) || icon.getIconWidth() != JBUI.scale(16)) {
            icon = JBUI.emptyIcon(16);
          }
          action = wrapGroups(action);
          ActionLink link = new ActionLink(text, icon, action, createUsageTracker(action));
          link.setPaintUnderline(false);
          link.setNormalColor(getLinkNormalColor());
          button.add(link);
          if (action instanceof WelcomePopupAction) {
            button.add(createArrow(link), BorderLayout.EAST);
          }
          installFocusable(button, action, KeyEvent.VK_UP, KeyEvent.VK_DOWN, true);
          actions.add(button);
        }
      }

      WelcomeScreenActionsPanel panel = new WelcomeScreenActionsPanel();
      panel.actions.add(actions);
      return panel.root;
    }
 @Override
 public void removeNotify() {
   if (myButtonSynchronizer != null) {
     myPresentation.removePropertyChangeListener(myButtonSynchronizer);
     myButtonSynchronizer = null;
   }
   super.removeNotify();
 }
    private AnAction wrapGroups(AnAction action) {
      if (action instanceof ActionGroup && ((ActionGroup) action).isPopup()) {
        final Pair<JPanel, JBList> panel =
            createActionGroupPanel(
                (ActionGroup) action,
                mySlidingPanel,
                new Runnable() {
                  @Override
                  public void run() {
                    goBack();
                  }
                });
        final Runnable onDone =
            new Runnable() {
              @Override
              public void run() {
                final JBList list = panel.second;
                ScrollingUtil.ensureSelectionExists(list);
                final ListSelectionListener[] listeners =
                    ((DefaultListSelectionModel) list.getSelectionModel())
                        .getListeners(ListSelectionListener.class);

                // avoid component cashing. This helps in case of LaF change
                for (ListSelectionListener listener : listeners) {
                  listener.valueChanged(
                      new ListSelectionEvent(
                          list, list.getSelectedIndex(), list.getSelectedIndex(), true));
                }
                list.requestFocus();
              }
            };
        final String name = action.getClass().getName();
        mySlidingPanel.add(name, panel.first);
        final Presentation p = action.getTemplatePresentation();
        return new DumbAwareAction(p.getText(), p.getDescription(), p.getIcon()) {
          @Override
          public void actionPerformed(@NotNull AnActionEvent e) {
            mySlidingPanel
                .getLayout()
                .swipe(mySlidingPanel, name, JBCardLayout.SwipeDirection.FORWARD, onDone);
          }
        };
      }
      return action;
    }
 @Override
 public void addNotify() {
   super.addNotify();
   if (myButtonSynchronizer == null) {
     myButtonSynchronizer = new MyButtonSynchronizer();
     myPresentation.addPropertyChangeListener(myButtonSynchronizer);
   }
   initButton();
 }
 public void update(AnActionEvent e) {
   final Presentation presentation = e.getPresentation();
   presentation.setEnabled(false);
   if (myElement != null) {
     final PsiElement element = myElement.getElement();
     final DocumentationProvider provider = DocumentationManager.getProviderFromElement(element);
     final PsiElement originalElement = DocumentationManager.getOriginalElement(element);
     if (provider instanceof ExternalDocumentationProvider) {
       presentation.setEnabled(
           element != null
               && ((ExternalDocumentationProvider) provider)
                   .hasDocumentationFor(element, originalElement));
     } else {
       final List<String> urls = provider.getUrlFor(element, originalElement);
       presentation.setEnabled(element != null && urls != null && !urls.isEmpty());
     }
   }
 }
    private JComponent createSettingsAndDocs() {
      JPanel panel = new NonOpaquePanel(new BorderLayout());
      NonOpaquePanel toolbar = new NonOpaquePanel();
      AnAction register = ActionManager.getInstance().getAction("Register");
      boolean registeredVisible = false;
      if (register != null) {
        AnActionEvent e =
            AnActionEvent.createFromAnAction(
                register,
                null,
                ActionPlaces.WELCOME_SCREEN,
                DataManager.getInstance().getDataContext(this));
        register.update(e);
        Presentation presentation = e.getPresentation();
        if (presentation.isEnabled()) {
          ActionLink registerLink = new ActionLink("Register", register);
          registerLink.setNormalColor(getLinkNormalColor());
          NonOpaquePanel button = new NonOpaquePanel(new BorderLayout());
          button.setBorder(JBUI.Borders.empty(4, 10));
          button.add(registerLink);
          installFocusable(button, register, KeyEvent.VK_UP, KeyEvent.VK_RIGHT, true);
          NonOpaquePanel wrap = new NonOpaquePanel();
          wrap.setBorder(JBUI.Borders.emptyLeft(10));
          wrap.add(button);
          panel.add(wrap, BorderLayout.WEST);
          registeredVisible = true;
        }
      }

      toolbar.setLayout(new BoxLayout(toolbar, BoxLayout.X_AXIS));
      toolbar.add(
          createActionLink(
              "Configure",
              IdeActions.GROUP_WELCOME_SCREEN_CONFIGURE,
              AllIcons.General.GearPlain,
              !registeredVisible));
      toolbar.add(createActionLink("Get Help", IdeActions.GROUP_WELCOME_SCREEN_DOC, null, false));

      panel.add(toolbar, BorderLayout.EAST);

      panel.setBorder(JBUI.Borders.empty(0, 0, 8, 11));
      return panel;
    }
 @Override
 public void update(AnActionEvent e) {
   Presentation presentation = e.getPresentation();
   presentation.setEnabled(!myForwardStack.isEmpty());
 }
 @Override
 public void update(AnActionEvent e) {
   super.update(e);
   Presentation presentation = e.getPresentation();
   presentation.setEnabled(myContainerNodes.size() > 1);
 }
 public void update(AnActionEvent e) {
   Presentation presentation = e.getPresentation();
   presentation.setEnabled(!myBackStack.isEmpty());
 }
 @Override
 public final void update(@NotNull final AnActionEvent event) {
   final Presentation presentation = event.getPresentation();
   presentation.setEnabled(myInfo.isVisible());
 }
 @Override
 public void update(AnActionEvent e) {
   super.update(e);
   final Presentation presentation = e.getPresentation();
   presentation.setEnabled(allTargetsAreValid());
 }