Search in sources :

Example 1 with QuickAssistProcessor

use of org.eclipse.che.ide.api.editor.quickfix.QuickAssistProcessor in project che by eclipse.

the class OrionEditorPresenter method initializeEditor.

@Override
protected void initializeEditor(final EditorAgent.OpenEditorCallback callback) {
    QuickAssistProcessor processor = configuration.getQuickAssistProcessor();
    if (quickAssistantFactory != null && processor != null) {
        quickAssistant = quickAssistantFactory.createQuickAssistant(this);
        quickAssistant.setQuickAssistProcessor(processor);
    }
    editorInit = new OrionEditorInit(configuration, this.codeAssistantFactory, this.quickAssistant, this);
    Promise<Void> initializerPromise = editorModule.getInitializerPromise();
    initializerPromise.catchError(new Operation<PromiseError>() {

        @Override
        public void apply(PromiseError arg) throws OperationException {
            displayErrorPanel(constant.editorInitErrorMessage());
            callback.onInitializationFailed();
        }
    }).thenPromise(new Function<Void, Promise<String>>() {

        @Override
        public Promise<String> apply(Void arg) throws FunctionException {
            return documentStorage.getDocument(input.getFile());
        }
    }).then(new Operation<String>() {

        @Override
        public void apply(String content) throws OperationException {
            createEditor(content);
        }
    }).catchError(new Operation<PromiseError>() {

        @Override
        public void apply(PromiseError arg) throws OperationException {
            displayErrorPanel(constant.editorFileErrorMessage());
            callback.onInitializationFailed();
        }
    });
}
Also used : FunctionException(org.eclipse.che.api.promises.client.FunctionException) QuickAssistProcessor(org.eclipse.che.ide.api.editor.quickfix.QuickAssistProcessor) Operation(org.eclipse.che.api.promises.client.Operation) Promise(org.eclipse.che.api.promises.client.Promise) PromiseError(org.eclipse.che.api.promises.client.PromiseError) OperationException(org.eclipse.che.api.promises.client.OperationException)

Aggregations

FunctionException (org.eclipse.che.api.promises.client.FunctionException)1 Operation (org.eclipse.che.api.promises.client.Operation)1 OperationException (org.eclipse.che.api.promises.client.OperationException)1 Promise (org.eclipse.che.api.promises.client.Promise)1 PromiseError (org.eclipse.che.api.promises.client.PromiseError)1 QuickAssistProcessor (org.eclipse.che.ide.api.editor.quickfix.QuickAssistProcessor)1