Skip to content

Introduce region expansion feature #424

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 150 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
150 commits
Select commit Hold shift + click to select a range
607ffb4
Add region expansion changes
taldekar Apr 21, 2025
8cc4e24
Fix bug in remove listener
taldekar Apr 21, 2025
30d0c88
Fix AmazonQBrowserProvider initialization bug
taldekar Apr 21, 2025
81d81a1
Move away from gamma
taldekar Apr 21, 2025
6c9754d
Revert DefaultLoginServiceTest
taldekar Apr 21, 2025
361258f
Revert internal codewhisperer flags
taldekar Apr 21, 2025
99781cb
Fix DefaultLoginServiceTest
taldekar Apr 22, 2025
f993305
Fix DefaultLoginServiceTest
taldekar Apr 22, 2025
829609a
Remove raw lsp message logging
taldekar Apr 22, 2025
398b3c9
Fix minor formatting issues
taldekar Apr 22, 2025
f621afa
Fix minor formatting issues
taldekar Apr 22, 2025
ca945a4
Fix browser preserving in login webview
taldekar Apr 23, 2025
f964453
Fix login view browser caching
taldekar Apr 23, 2025
6c92606
Rename browser provider function for clarity
taldekar Apr 23, 2025
1eee603
Revert plugin.xml changes
taldekar Apr 23, 2025
e289726
Revert plugin.xml changes
taldekar Apr 23, 2025
a4df970
Cleanup addressing comments
taldekar Apr 23, 2025
db49167
Fix asset provider regression
taldekar Apr 23, 2025
935bf3d
Fix formatting issues
taldekar Apr 24, 2025
d42d6e6
Remove maven settings
taldekar Apr 24, 2025
4bf1628
Region expansion improvements (#426)
taldekar Apr 29, 2025
54a98a8
Address blocking in LspStartupActivity (#425) (#428)
aws-toolkit-automation Apr 29, 2025
656d0a4
Merge branch 'feature/regionExpansion' into autoMerge/feature/regionE…
taldekar Apr 30, 2025
45ba81e
Merge pull request #430 from aws/autoMerge/feature/regionExpansion
taldekar Apr 30, 2025
1083257
Partial region expansion
taldekar May 14, 2025
9a00b6d
Add support for cross-profile customizations
taldekar May 14, 2025
9e419ee
Fix tests
taldekar May 14, 2025
d0f6984
Fix minor UX bugs
taldekar May 14, 2025
f57d7bd
Add line when not scrollable instead of empty space
taldekar May 15, 2025
93dbc9c
Add profile name to customization dialog
taldekar May 15, 2025
b9a9914
Add logic to verify profile and customization selection on start up
taldekar May 16, 2025
63f665b
Remove unused initialization future
taldekar May 16, 2025
c692094
Fix light theme in profile selection view
taldekar May 16, 2025
7a57c81
Validate incoming profiles to ensure that all required fields are pre…
taldekar May 20, 2025
8513620
PoC changes for chat context
breedloj Apr 22, 2025
5ad6ad1
Add preferences for project context
breedloj Apr 22, 2025
ece2caf
Clean up
breedloj Apr 22, 2025
8561bb4
Update QLspConnectionProvider.java
breedloj Apr 28, 2025
2a64e97
Initial changes for context selection
breedloj Apr 29, 2025
40ba462
Propagate ChatOptions to Mynah
breedloj Apr 29, 2025
350bca4
add handling for link click events
nborges-aws Apr 29, 2025
8b21be2
Add notification event for insert at cursor and prompt option change …
nborges-aws Apr 29, 2025
dabf6eb
Support for showDocument LSP callback for local files
breedloj Apr 30, 2025
d0dfc29
Pass raw JSON chat messages from server to Mynah
breedloj Apr 30, 2025
26f461e
Fix tests and address race condition with onReady
breedloj May 1, 2025
e54f63b
add notification event for file click
nborges-aws Apr 30, 2025
05490a8
fix to run showDocument event on UI thread
nborges-aws Apr 30, 2025
3b3a6f6
Initial history implementation
breedloj May 1, 2025
5da1e55
Implement createPrompt
breedloj May 1, 2025
d4b48fa
Implement prompt option acknowledged
breedloj May 1, 2025
e0662b7
Implement chat export functionality
breedloj May 2, 2025
2ddb91f
add handling for stop chat response event
nborges-aws May 1, 2025
5f16e20
use generic tab params for stop chat response
nborges-aws May 1, 2025
5f0cd95
Add open file/diff capabilities
taldekar May 1, 2025
72499a1
improvements to command handling and fix fall through bug
nborges-aws May 2, 2025
e87a173
Fix open file/diff editor issues
taldekar May 2, 2025
daf42bd
fix conflict with agentic chat diff causing NPE
nborges-aws May 2, 2025
7800b04
Properly handle openTab
breedloj May 2, 2025
8232542
Handle showDocument for default.md case
breedloj May 2, 2025
8809c0f
Pass context objects verbatim
breedloj May 2, 2025
35150d2
Wire up window capability in initialize
breedloj May 2, 2025
6e79177
Fix no diff displayed issue
taldekar May 5, 2025
be93054
Fix sendChatUpdate
breedloj May 5, 2025
02cbfed
Fix CSS colors for prompt backgrounds
breedloj May 5, 2025
5dca42c
Remove Thread.sleep for onReady
breedloj May 6, 2025
9ff6363
Fix editor id bug
taldekar May 6, 2025
30b3d10
Remove a bunch of dead code
breedloj May 7, 2025
f90d716
Add Checkstyle rule for copyright header
breedloj May 7, 2025
dd31a5f
Fix file content getting pulled out in diff bug
taldekar May 7, 2025
dc9f378
Fix exists bug from diff
taldekar May 7, 2025
45697d5
Disable inline chat prompt
taldekar May 7, 2025
a4be9bf
Another attempt to fix CSS issues by redrawing icons periodically
breedloj May 7, 2025
cbfef8b
Fix a bunch of JS and CSS 𓌏
breedloj May 8, 2025
cac4d2f
Add support for openSettings chat UI callback
breedloj May 8, 2025
9e39e48
Gate the number of partial responses that are passed to the UI
breedloj May 8, 2025
8a87cc7
Synchronize on partial result token
breedloj May 9, 2025
f776d71
Remove unnecessary lock on LSP instance retrieval
breedloj May 9, 2025
90abe10
Set minimum length for partial response to be passed through
breedloj May 9, 2025
53aabe0
Fix arrow glitch in chat UI and trigger eager refreshing
breedloj May 9, 2025
076b185
Fix cancellation race condition issue
breedloj May 9, 2025
ebfb109
Process cancellation partials immediately
breedloj May 12, 2025
e9cdbdc
Improve reliability of background threads
breedloj May 12, 2025
2d8645a
Fix inline suggestions auto trigger bug
taldekar May 12, 2025
3abf6a3
Fix adapter calls
taldekar May 12, 2025
b89e815
Improve deduplication of preview pages logic
taldekar May 13, 2025
82e4ebb
Fix css bug
taldekar May 13, 2025
a422fe2
Add -DWEBKIT_DISABLE_BACK_FORWARD_CACHE=1 flag for apple crash bug
taldekar May 13, 2025
3c92ea8
Run zoom once per browser
taldekar May 13, 2025
07e6cb0
New approach for refreshing icons on visibility event
breedloj May 13, 2025
f3e4031
Revert "Run zoom once per browser"
taldekar May 13, 2025
5311b51
Revert "Add -DWEBKIT_DISABLE_BACK_FORWARD_CACHE=1 flag for apple cras…
taldekar May 13, 2025
1012ebc
Implement refresh LSP callbacks
breedloj May 13, 2025
1cd12ae
Rev Maven dependency versions
breedloj May 14, 2025
f276e87
Add preference action item to menu
breedloj May 14, 2025
406cf61
Remove preview editor dedup logic
taldekar May 15, 2025
1a91099
Revert browser zoom
taldekar May 16, 2025
9b34a95
Display redirect URL on auth processing screen
breedloj May 16, 2025
1c9f68a
Address chat theme CSS injection race condition
breedloj May 19, 2025
544ca08
Support for undo and redo gestures in chat input
breedloj May 20, 2025
a9d952e
remove all ref to inline chat task upon end session
nborges-aws May 20, 2025
54e423d
Update JsonHandler to retrieve keys hierarchially and add value to ob…
taldekar May 5, 2025
0bc136b
remove layers of abstraction from chat event flow and simplify object…
nborges-aws May 5, 2025
4f43a60
fix missing getData call in lsp chat command
nborges-aws May 6, 2025
8a6ef18
clean and fix test
taldekar May 6, 2025
245cf7a
Fix button click error handling
taldekar May 6, 2025
9fea548
Delete accidental file
taldekar May 6, 2025
f08ec6a
Fix button click error handling
taldekar May 6, 2025
fd14d45
Fix button click error handling
taldekar May 6, 2025
c3c54bf
Fix gson serailization/deserialization issues
taldekar May 7, 2025
1237457
Delete plugin/aws.txt
taldekar May 7, 2025
78ea56c
Gate the number of partial responses that are passed to the UI
breedloj May 8, 2025
d245b5b
Partial chat communication manager fix
taldekar May 9, 2025
34a07af
Fix ChatCommunicationManagerTest
taldekar May 9, 2025
7effa50
Fix cancellation race condition issue
breedloj May 9, 2025
6541d4e
Process cancellation partials immediately
breedloj May 12, 2025
db38ffe
Improve reliability of background threads
breedloj May 12, 2025
8537776
Fix adapter calls
taldekar May 12, 2025
c39f4e5
Improve deduplication of preview pages logic
taldekar May 13, 2025
7c9adae
Fix css bug
taldekar May 13, 2025
479e4a4
Add -DWEBKIT_DISABLE_BACK_FORWARD_CACHE=1 flag for apple crash bug
taldekar May 13, 2025
b8cd737
Run zoom once per browser
taldekar May 13, 2025
4d6cc3c
New approach for refreshing icons on visibility event
breedloj May 13, 2025
dfad058
Revert "Add -DWEBKIT_DISABLE_BACK_FORWARD_CACHE=1 flag for apple cras…
taldekar May 13, 2025
4d39576
Implement refresh LSP callbacks
breedloj May 13, 2025
97ea08c
Use isExternal flag in showDocument LSP callbacks
breedloj May 14, 2025
35a27c8
Rev Maven dependency versions
breedloj May 14, 2025
1822995
remove layers of abstraction from chat event flow and simplify object…
nborges-aws May 5, 2025
be2a48a
Partial chat communication manager fix
taldekar May 9, 2025
267db7e
Fix tests
taldekar May 15, 2025
05de84c
Remove ChatMessageProvider
taldekar May 15, 2025
99b0920
Remove exclusion rules in gson
taldekar May 15, 2025
f700976
Revert ThreadingUtils changes
taldekar May 21, 2025
c096b28
Refactor chat communication manager
taldekar May 21, 2025
a3c264f
Fix ChatWebViewAssetProvider regression
taldekar May 21, 2025
eb349e4
Remove test added during plugin test
taldekar May 21, 2025
646e4fd
Add JsonProperty tag to TelemetryEvent record
taldekar May 21, 2025
0de46d7
Revert ChatAsyncResultManager changes
taldekar May 21, 2025
0636955
Add region expansion changes
taldekar Apr 21, 2025
f003b03
Move away from gamma
taldekar Apr 21, 2025
e219b2b
Partial region expansion
taldekar May 14, 2025
861415d
Fix regressions
taldekar May 21, 2025
18045c4
Remove classpath
taldekar May 22, 2025
ed5c0b2
Fix plugin classpath
taldekar May 22, 2025
4486398
Revert .gitignore
taldekar May 22, 2025
99d6a90
Remove .settings
taldekar May 22, 2025
e5ec756
Restore eclipse prefs file
taldekar May 22, 2025
a17814a
Fix LspStartupActivity
taldekar May 22, 2025
718ad57
Fix Q scopes
taldekar May 22, 2025
9134c76
Fix Lsp configuration
taldekar May 22, 2025
8458312
Revert plugin.xml
taldekar May 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions plugin/.settings/org.eclipse.m2e.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the impact of checking this in?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a maven file. Wasn't sure if this was necessitated by other updates. I'll remove this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll update the .gitignore as well.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

package software.aws.toolkits.eclipse.amazonq.broker.events;

public enum QDeveloperProfileState {
NOT_APPLICABLE, SELECTED, AVAILABLE
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
import software.aws.toolkits.eclipse.amazonq.lsp.auth.model.AuthState;

public record ViewRouterPluginState(AuthState authState, AmazonQLspState lspState, BrowserCompatibilityState browserCompatibilityState,
ChatWebViewAssetState chatWebViewAssetState, ToolkitLoginWebViewAssetState toolkitLoginWebViewAssetState) {
ChatWebViewAssetState chatWebViewAssetState, ToolkitLoginWebViewAssetState toolkitLoginWebViewAssetState,
QDeveloperProfileState qDeveloperProfileState) {
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

package software.aws.toolkits.eclipse.amazonq.customization;
package software.aws.toolkits.eclipse.amazonq.configuration.customization;

import java.util.Collections;
import java.util.List;
Expand All @@ -14,6 +14,8 @@
import software.amazon.awssdk.utils.StringUtils;
import software.aws.toolkits.eclipse.amazonq.exception.AmazonQPluginException;
import software.aws.toolkits.eclipse.amazonq.lsp.model.GetConfigurationFromServerParams;
import software.aws.toolkits.eclipse.amazonq.lsp.model.GetConfigurationFromServerParams.ExpectedResponseType;
import software.aws.toolkits.eclipse.amazonq.lsp.model.LspServerConfigurations;
import software.aws.toolkits.eclipse.amazonq.plugin.Activator;
import software.aws.toolkits.eclipse.amazonq.views.model.Customization;

Expand All @@ -27,20 +29,26 @@ public static void triggerChangeConfigurationNotification() {
try {
Activator.getLogger().info("Triggering configuration pull from Amazon Q LSP server");
Activator.getLspProvider().getAmazonQServer()
.thenAccept(server -> server.getWorkspaceService().didChangeConfiguration(new DidChangeConfigurationParams()));
.thenAccept(server -> server.getWorkspaceService()
.didChangeConfiguration(new DidChangeConfigurationParams()))
.get();
} catch (Exception e) {
Activator.getLogger().error("Error occurred while sending change configuration notification to Amazon Q LSP server", e);
throw new AmazonQPluginException(e);
}
}

public static CompletableFuture<List<Customization>> listCustomizations() {
GetConfigurationFromServerParams params = new GetConfigurationFromServerParams();
params.setSection("aws.q");
GetConfigurationFromServerParams params = new GetConfigurationFromServerParams(
ExpectedResponseType.CUSTOMIZATION);
return Activator.getLspProvider().getAmazonQServer()
.thenCompose(server -> server.getConfigurationFromServer(params))
.thenCompose(server -> {
CompletableFuture<LspServerConfigurations<Customization>> config = server
.getConfigurationFromServer(params);
return config;
})
.thenApply(configurations -> Optional.ofNullable(configurations)
.map(config -> config.getCustomizations().stream()
.map(config -> config.getConfigurations().stream()
.filter(customization -> customization != null && StringUtils.isNotBlank(customization.getName()))
.collect(Collectors.toList()))
.orElse(Collections.emptyList()))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,243 @@
// Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

package software.aws.toolkits.eclipse.amazonq.configuration.profiles;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;

import org.eclipse.mylyn.commons.ui.dialogs.AbstractNotificationPopup;
import org.eclipse.swt.widgets.Display;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

import software.amazon.awssdk.utils.StringUtils;
import software.aws.toolkits.eclipse.amazonq.broker.events.QDeveloperProfileState;
import software.aws.toolkits.eclipse.amazonq.exception.AmazonQPluginException;
import software.aws.toolkits.eclipse.amazonq.lsp.model.GetConfigurationFromServerParams;
import software.aws.toolkits.eclipse.amazonq.lsp.model.GetConfigurationFromServerParams.ExpectedResponseType;
import software.aws.toolkits.eclipse.amazonq.lsp.model.LspServerConfigurations;
import software.aws.toolkits.eclipse.amazonq.plugin.Activator;
import software.aws.toolkits.eclipse.amazonq.util.Constants;
import software.aws.toolkits.eclipse.amazonq.util.ObjectMapperFactory;
import software.aws.toolkits.eclipse.amazonq.util.ToolkitNotification;
import software.aws.toolkits.eclipse.amazonq.views.ViewConstants;
import software.aws.toolkits.eclipse.amazonq.views.model.QDeveloperProfile;
import software.aws.toolkits.eclipse.amazonq.views.model.UpdateConfigurationParams;

public final class QDeveloperProfileUtil {

private static final QDeveloperProfileUtil INSTANCE;
private List<QDeveloperProfile> profiles;
private QDeveloperProfile savedDeveloperProfile;
private QDeveloperProfile selectedDeveloperProfile;
private CompletableFuture<Void> profileSelectionTask;
private static final ObjectMapper OBJECT_MAPPER = ObjectMapperFactory.getInstance();

static {
INSTANCE = new QDeveloperProfileUtil();
}

public static QDeveloperProfileUtil getInstance() {
return INSTANCE;
}

private QDeveloperProfileUtil() { // prevent initialization
try {
savedDeveloperProfile = Optional
.ofNullable(Activator.getPluginStore().get(ViewConstants.Q_DEVELOPER_PROFILE_SELECTION_KEY))
.map(json -> {
try {
return deserializeProfile(json);
} catch (final JsonProcessingException e) {
Activator.getLogger().error("Failed to process cached profile", e);
return null;
}
}).orElse(null);

} catch (Exception e) {
Activator.getLogger().error("Failed to deserialize developer profile", e);
}
profileSelectionTask = new CompletableFuture<>();
profiles = new ArrayList<QDeveloperProfile>();
}

private QDeveloperProfile deserializeProfile(final String json) throws JsonProcessingException {
return OBJECT_MAPPER.readValue(json, QDeveloperProfile.class);
}

private String serializeProfile(final QDeveloperProfile developerProfile) throws JsonProcessingException {
return OBJECT_MAPPER.writeValueAsString(developerProfile);
}

public void initialize() {
if (savedDeveloperProfile != null) {
setDeveloperProfile(savedDeveloperProfile);
}
}

public synchronized List<QDeveloperProfile> queryForDeveloperProfiles(final boolean tryApplyCachedProfile) {
CompletableFuture<List<QDeveloperProfile>> profilesFuture = Activator.getLspProvider().getAmazonQServer()
.thenCompose(server -> {
GetConfigurationFromServerParams params = new GetConfigurationFromServerParams(
ExpectedResponseType.Q_DEVELOPER_PROFILE);
CompletableFuture<LspServerConfigurations<QDeveloperProfile>> response = server
.getConfigurationFromServer(params);
return response;
}).thenApply(this::processConfigurations).exceptionally(throwable -> {
Activator.getLogger().error("Error occurred while fetching the list of Q Developer Profile: ",
throwable);
throw new AmazonQPluginException(throwable);
}).thenApply(result -> {
return handleSelectedProfile(result, tryApplyCachedProfile);
});
try {
profiles = profilesFuture.get();
} catch (InterruptedException | ExecutionException e) {
Activator.getLogger().error("Failed to fetch developer profiles: ", e);
}

return profiles;
}

public synchronized CompletableFuture<Void> getProfileSelectionTaskFuture() {
if (profileSelectionTask != null && !profileSelectionTask.isDone()) {
return profileSelectionTask;
}
profileSelectionTask = new CompletableFuture<Void>();
return profileSelectionTask;
}

private boolean isValidProfile(final QDeveloperProfile profile) {
return profile != null && StringUtils.isNotBlank(profile.getName());
}

private List<QDeveloperProfile> handleSelectedProfile(final List<QDeveloperProfile> profiles,
final boolean tryApplyCachedProfile) {
boolean isProfileSet = false;
if (profiles.size() <= 1) {
isProfileSet = handleSingleOrNoProfile(profiles, tryApplyCachedProfile);
} else {
isProfileSet = handleMultipleProfiles(profiles, tryApplyCachedProfile);
}

if (!isProfileSet) {
Activator.getEventBroker().post(QDeveloperProfileState.class, QDeveloperProfileState.AVAILABLE);
}
return profiles;
}

private boolean handleSingleOrNoProfile(final List<QDeveloperProfile> profiles,
final boolean tryApplyCachedProfile) {
if (!profiles.isEmpty() && tryApplyCachedProfile) {
setDeveloperProfile(profiles.get(0));
return true;
}
return false;
}

private boolean handleMultipleProfiles(final List<QDeveloperProfile> profiles,
final boolean tryApplyCachedProfile) {
boolean isProfileSelected = false;
if (selectedDeveloperProfile != null) {
isProfileSelected = profiles.stream()
.anyMatch(profile -> profile.getArn().equals(selectedDeveloperProfile.getArn()));

if (isProfileSelected && tryApplyCachedProfile) {
setDeveloperProfile(selectedDeveloperProfile);
}
}
return isProfileSelected;
}

private List<QDeveloperProfile> processConfigurations(
final LspServerConfigurations<QDeveloperProfile> configurations) {
return Optional.ofNullable(configurations).map(
config -> config.getConfigurations().stream().filter(this::isValidProfile).collect(Collectors.toList()))
.orElse(Collections.emptyList());
}

public List<QDeveloperProfile> getDeveloperProfiles(final boolean tryApplyCachedProfile) {
if (profiles != null && !profiles.isEmpty()) {
return profiles;
}
return queryForDeveloperProfiles(tryApplyCachedProfile);
}

public void setDeveloperProfile(final QDeveloperProfile developerProfile) {
if (developerProfile == null || (selectedDeveloperProfile != null
&& selectedDeveloperProfile.getArn().equals(developerProfile.getArn()))) {
return;
}

selectedDeveloperProfile = developerProfile;
saveSelectedProfile();

String section = "aws.q";
Map<String, Object> settings = Map.of("profileArn", selectedDeveloperProfile.getArn());
Activator.getLspProvider().getAmazonQServer()
.thenCompose(server -> server.updateConfiguration(new UpdateConfigurationParams(section, settings)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally this and other configuration update logic should live in a specific component. The CustomizationUtil originally served that purpose but we've outgrown it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh I see, I'll look into this.

.thenRun(() -> {
showNotification(selectedDeveloperProfile.getName());
Activator.getEventBroker().post(QDeveloperProfileState.class, QDeveloperProfileState.SELECTED);
if (profileSelectionTask != null) {
profileSelectionTask.complete(null);
}
profiles = null;
})
.exceptionally(throwable -> {
Activator.getLogger().error("Error occurred while setting Q Developer Profile: ", throwable);
throw new AmazonQPluginException(throwable);
});
}

private void showNotification(final String developerProfileName) {
Display.getDefault().asyncExec(() -> {
AbstractNotificationPopup notification = new ToolkitNotification(Display.getCurrent(),
Constants.IDE_DEVELOPER_PROFILES_NOTIFICATION_TITLE,
String.format(Constants.IDE_DEVELOPER_PROFILES_NOTIFICATION_BODY_TEMPLATE, developerProfileName));
notification.open();
});
}

public void clearSelectedProfile() {
Activator.getPluginStore().remove(ViewConstants.Q_DEVELOPER_PROFILE_SELECTION_KEY);
selectedDeveloperProfile = null;
}

private void saveSelectedProfile() {
try {
String serializedSelectedProfile = serializeProfile(selectedDeveloperProfile);

if (serializedSelectedProfile != null) {
Activator.getPluginStore().put(ViewConstants.Q_DEVELOPER_PROFILE_SELECTION_KEY,
serializedSelectedProfile);
}
} catch (final JsonProcessingException e) {
Activator.getLogger().error("Failed to cache Q developer profile");
}
}

public boolean isProfileSelectionRequired() {
if (profiles == null || profiles.isEmpty()) {
queryForDeveloperProfiles(false);

if (profiles.size() == 1) {
handleSingleOrNoProfile(profiles, true);
}
}
return profiles.size() > 1;
}

public QDeveloperProfile getSelectedProfile() {
return selectedDeveloperProfile;
}

}
Loading