Пример #1
0
 @Override
 public List<TerminalAction> getActions() {
   return Lists.newArrayList(
       new TerminalAction(
               "Copy",
               mySettingsProvider.getCopyKeyStrokes(),
               new Predicate<KeyEvent>() {
                 @Override
                 public boolean apply(KeyEvent input) {
                   return handleCopy(true);
                 }
               })
           .withMnemonicKey(KeyEvent.VK_C)
           .withEnabledSupplier(
               new Supplier<Boolean>() {
                 @Override
                 public Boolean get() {
                   return mySelection != null;
                 }
               }),
       new TerminalAction(
               "Paste",
               mySettingsProvider.getPasteKeyStrokes(),
               new Predicate<KeyEvent>() {
                 @Override
                 public boolean apply(KeyEvent input) {
                   handlePaste();
                   return true;
                 }
               })
           .withMnemonicKey(KeyEvent.VK_P)
           .withEnabledSupplier(
               new Supplier<Boolean>() {
                 @Override
                 public Boolean get() {
                   return getClipboardString() != null;
                 }
               }),
       new TerminalAction(
               "Clear Buffer",
               mySettingsProvider.getClearBufferKeyStrokes(),
               new Predicate<KeyEvent>() {
                 @Override
                 public boolean apply(KeyEvent input) {
                   clearBuffer();
                   return true;
                 }
               })
           .withMnemonicKey(KeyEvent.VK_K)
           .withEnabledSupplier(
               new Supplier<Boolean>() {
                 @Override
                 public Boolean get() {
                   return !myTerminalTextBuffer.isUsingAlternateBuffer();
                 }
               })
           .separatorBefore(true));
 }