// Path: src/com/github/kennedyoliveira/ultimatepastebin/service/ToolWindowService.java
// public interface ToolWindowService {
// 
//   /**
//    * @return The tree with the pastes and user information
//    */
//   Tree getTree();
// 
//   /**
//    * Initiate the actions for fetching user and trending pastes and update the toolwindow with results
//    */
//   void fetchPastes();
// 
//   /**
//    * Initiate the action for fetching user pastes and update the toolwindow with results
//    */
//   void fetchUserPastes();
// 
//   /**
//    * Initiate the action for fetching trend pastes and update the toolwindow with results
//    */
//   void fetchTrendPastes();
// 
//   /**
//    * @return A selected paste in the {@link #getTree()}
//    */
//   Optional<Paste> getSelectedPaste();
// 
//   /**
//    * Checks of the {@code paste} is a Trend paste.
//    *
//    * @param paste Paste to be checked.
//    * @return {@code true} if trend, {@code false} otherwise.
//    */
//   boolean isTrendPast(Paste paste);
// }


import com.github.kennedyoliveira.pastebin4j.Paste;
import com.github.kennedyoliveira.ultimatepastebin.service.ToolWindowService;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.components.ServiceManager;
import java.util.Optional;
package com.github.kennedyoliveira.ultimatepastebin.action;



/**
 * <p>This class is a base for actions that needs that a paste is selected to be marked as enabled</p>
 */
public abstract class AbstractPasteSelectedAction extends AnAction {

  @Override
  public void update(AnActionEvent e) {
    super.update(e);

    e.getPresentation().setEnabled(getSelectedPaste().isPresent());
  }

  protected Optional<Paste> getSelectedPaste() {
// Path: src/com/github/kennedyoliveira/ultimatepastebin/service/ToolWindowService.java
// public interface ToolWindowService {
// 
//   /**
//    * @return The tree with the pastes and user information
//    */
//   Tree getTree();
// 
//   /**
//    * Initiate the actions for fetching user and trending pastes and update the toolwindow with results
//    */
//   void fetchPastes();
// 
//   /**
//    * Initiate the action for fetching user pastes and update the toolwindow with results
//    */
//   void fetchUserPastes();
// 
//   /**
//    * Initiate the action for fetching trend pastes and update the toolwindow with results
//    */
//   void fetchTrendPastes();
// 
//   /**
//    * @return A selected paste in the {@link #getTree()}
//    */
//   Optional<Paste> getSelectedPaste();
// 
//   /**
//    * Checks of the {@code paste} is a Trend paste.
//    *
//    * @param paste Paste to be checked.
//    * @return {@code true} if trend, {@code false} otherwise.
//    */
//   boolean isTrendPast(Paste paste);
// }


// Path: src/com/github/kennedyoliveira/ultimatepastebin/action/AbstractPasteSelectedAction.java
import com.github.kennedyoliveira.pastebin4j.Paste;
import com.github.kennedyoliveira.ultimatepastebin.service.ToolWindowService;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.components.ServiceManager;
import java.util.Optional;

package com.github.kennedyoliveira.ultimatepastebin.action;



/**
 * <p>This class is a base for actions that needs that a paste is selected to be marked as enabled</p>
 */
public abstract class AbstractPasteSelectedAction extends AnAction {

  @Override
  public void update(AnActionEvent e) {
    super.update(e);

    e.getPresentation().setEnabled(getSelectedPaste().isPresent());
  }

  protected Optional<Paste> getSelectedPaste() {
    final ToolWindowService toolWindowService = ServiceManager.getService(ToolWindowService.class);