in plugin/src/software/aws/toolkits/eclipse/amazonq/util/QInvocationSession.java [96:135]
public synchronized boolean start(final ITextEditor editor) throws ExecutionException {
if (!isActive()) {
if (!Activator.getLoginService().getAuthState().isLoggedIn()) {
Activator.getLogger().warn("Attempted to start inline session while logged out.");
this.end();
return false;
}
contextService = PlatformUI.getWorkbench()
.getService(IContextService.class);
if (contextService.getActiveContextIds().contains(Constants.INLINE_CHAT_CONTEXT_ID)) {
Activator.getLogger().warn("Attempted to start inline session while inline chat is processing.");
this.end();
return false;
}
Activator.getLogger().info("Starting inline session");
transitionToInvokingState();
contextActivation = contextService.activateContext(Constants.INLINE_SUGGESTIONS_CONTEXT_ID);
// Start session logic here
this.editor = editor;
viewer = getActiveTextViewer(editor);
if (viewer == null) {
// cannot continue the invocation
throw new IllegalStateException("no viewer available");
}
var widget = viewer.getTextWidget();
terminationListener = QEclipseEditorUtils.getInlineTerminationListener();
widget.addFocusListener(terminationListener);
suggestionsContext = new QSuggestionsContext();
inlineTextFont = QEclipseEditorUtils.getInlineTextFont(widget, Q_INLINE_HINT_TEXT_STYLE);
inlineTextFontBold = QEclipseEditorUtils.getInlineCloseBracketFontBold(widget);
invocationOffset = widget.getCaretOffset();
return true;
} else {
return false;
}
}