@Inject public SpellingService(SpellingServerOperations server, UIPrefs uiPrefs) { server_ = server; uiPrefs_ = uiPrefs; uiPrefs .spellingDictionaryLanguage() .addValueChangeHandler( new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { invalidateCache(); } }); uiPrefs .spellingCustomDictionaries() .addValueChangeHandler( new ValueChangeHandler<JsArrayString>() { @Override public void onValueChange(ValueChangeEvent<JsArrayString> event) { invalidateCache(); } }); }
@Inject public Shell( ConsoleServerOperations server, EventBus eventBus, Display display, Session session, GlobalDisplay globalDisplay, Commands commands, UIPrefs uiPrefs, ErrorManager errorManager) { super(); ((Binder) GWT.create(Binder.class)).bind(commands, this); server_ = server; eventBus_ = eventBus; view_ = display; globalDisplay_ = globalDisplay; commands_ = commands; errorManager_ = errorManager; input_ = view_.getInputEditorDisplay(); historyManager_ = new CommandLineHistory(input_); browseHistoryManager_ = new CommandLineHistory(input_); prefs_ = uiPrefs; inputAnimator_ = new ShellInputAnimator(view_.getInputEditorDisplay()); view_.setMaxOutputLines(session.getSessionInfo().getConsoleActionsLimit()); keyDownPreviewHandlers_ = new ArrayList<KeyDownPreviewHandler>(); keyPressPreviewHandlers_ = new ArrayList<KeyPressPreviewHandler>(); InputKeyDownHandler handler = new InputKeyDownHandler(); // This needs to be a capturing key down handler or else Ace will have // handled the event before we had a chance to prevent it view_.addCapturingKeyDownHandler(handler); view_.addKeyPressHandler(handler); eventBus.addHandler(ConsoleInputEvent.TYPE, this); eventBus.addHandler(ConsoleWriteOutputEvent.TYPE, this); eventBus.addHandler(ConsoleWriteErrorEvent.TYPE, this); eventBus.addHandler(ConsoleWritePromptEvent.TYPE, this); eventBus.addHandler(ConsoleWriteInputEvent.TYPE, this); eventBus.addHandler(ConsolePromptEvent.TYPE, this); eventBus.addHandler(ConsoleResetHistoryEvent.TYPE, this); eventBus.addHandler(ConsoleRestartRCompletedEvent.TYPE, this); eventBus.addHandler(ConsoleExecutePendingInputEvent.TYPE, this); eventBus.addHandler(SendToConsoleEvent.TYPE, this); eventBus.addHandler(DebugModeChangedEvent.TYPE, this); eventBus.addHandler(RunCommandWithDebugEvent.TYPE, this); eventBus.addHandler(UnhandledErrorEvent.TYPE, this); final CompletionManager completionManager = new RCompletionManager( view_.getInputEditorDisplay(), null, new CompletionPopupPanel(), server, null, null); addKeyDownPreviewHandler(completionManager); addKeyPressPreviewHandler(completionManager); addKeyDownPreviewHandler(new HistoryCompletionManager(view_.getInputEditorDisplay(), server)); uiPrefs .insertMatching() .bind( new CommandWithArg<Boolean>() { public void execute(Boolean arg) { AceEditorNative.setInsertMatching(arg); } }); sessionInit(session); }