Example #1
0
 @Override
 public EventHandler<ActionEvent> handler(
     Editor model, EditorView view, EditorController controller) {
   return event -> {
     List<String> words = new ArrayList<>();
     words.add(EnumCommand.REMOVE.getText(view.getBundle()));
     words.add(((GuiView) view).getCacheSelected());
     run(model, view, controller, new Command(words, view.getBundle()));
     ((GuiView) view).clearCacheTextField();
   };
 }
Example #2
0
 @Override
 public boolean run(Editor model, EditorView view, EditorController controller, Command command) {
   if (!command.hasWord(1)) {
     view.showError(view.getTranslation("REMOVE_ERROR1"));
   }
   if (!model.removeCache(command.getWord(1))) {
     view.showError(view.getTranslation("REMOVE_ERROR2"));
   }
   if (!view.isConsole()) ((GuiView) view).update();
   return false;
 }