Introduce View Container and base view components#338
Introduce View Container and base view components#338nborges-aws merged 14 commits intofeature/viewRefactorfrom
Conversation
| parent.setLayout(gridLayout); | ||
|
|
||
| setupStaticMenuActions(); | ||
| updateChildView(activeView, ViewId.RE_AUTHENTICATE_VIEW); |
There was a problem hiding this comment.
Do we need both the active view and the view ID to be passed in?
| } | ||
|
|
||
| if (views.containsKey(newViewId)) { | ||
| BaseAmazonQView newView = views.get(newViewId); |
There was a problem hiding this comment.
Should we track the active view ID here for when the parent composite is disposed?
| private Disposable viewChangeEventSubscription; | ||
|
|
||
| public AmazonQViewContainer() { | ||
| viewChangeEventSubscription = Activator.getEventBroker().subscribe(ViewId.class, this); |
There was a problem hiding this comment.
You would need to subscribe to these events in the createPartControl every time if you dispose the subscription in the dispose call. I think Jonathan prefers not disposing the subscription.
|
|
||
| package software.aws.toolkits.eclipse.amazonq.views.router; | ||
|
|
||
| public enum ViewId { |
There was a problem hiding this comment.
I think this class was renamed in the ViewRouter PR so it might have gotten added accidentally.
|
|
||
| //default view passed in from router | ||
| //possible we'll use chatView as default? | ||
| activeView = views.get(currentActiveViewId); |
There was a problem hiding this comment.
This view might get disposed before being created if createPartControl calls updateChildView the first time. Not sure if that causes any issues.
| new AmazonQStaticActions(getViewSite()); | ||
| } | ||
|
|
||
| private void updateChildView() { |
There was a problem hiding this comment.
There might be race condition if both the createPartControl and onEvent call these methods simultaneously.
| * 2. viewContainer.init(currentView) | ||
| */ | ||
|
|
||
| public void initializeViews(final AmazonQViewType currentActiveViewId) { |
There was a problem hiding this comment.
Could we move this to the constructor?
…382) * improved handling of lsp failure state (#309) * Introduce ViewRouter Component (#337) * improved handling of lsp failure state * add static mock to lsp connection test case * Integrate Event Broker in LspStatusManager * Add ViewRouter POC * Fix code formatting bug * Add method to retrieve observables * Add listeners for combined state streams and view update request * Add listeners for combined state streams and view update request * Add listeners for combined state streams and view update request * Add functionality for hot event streams that track latest event (#340) * Add functionality for hot subscribers that track latest event * Add test to ensure event stream isolation * Fix missing subscription disposal in test * Use autoConnect to implicitly manage stream connection * Remove active view update request listener * Add ViewRouter tests * Remove public constructor * Remove public constructor and unused event in tests * Add comments * Add documentation for EventBroker * Remove ViewRouter initialization * Remove LspInitializingView from ID enum * Add documentation for ViewRouter * Refactor and enhance EventBroker tests * Refactor ViewRouter tests for clarity * Remove PluginState class into separate file * Add documentation to subscription management logic * Add support for notifying multiple late-subscribers over time of latest state (#342) * Remove CODE_REFERENCE_VIEW * Rename newActiveViewId to newActiveView * Rename ViewId class to AmazonQViewType * Revert "Integrate Event Broker in LspStatusManager" This reverts commit 374e549. * Revert "improved handling of lsp failure state" This reverts commit 13c55ac. * Refactor EventBroker and enhance tests (#343) --------- Co-authored-by: Nicolas Borges <nickdb@amazon.com> * Introduce View Container and base view components (#338) * Add Browser Provider component (#357) * Pass populated AWS_CA_BUNDLE env var to Flare (#341) * Add UI notification to alert user of deprecated manifest version (#312) * Add webview dependency missing logic to ViewRouter * Revert commit 'Add UI notification to alert user of deprecated manifest version' * Revert 'Pass populated AWS_CA_BUNDLE env var to Flare' --------- Co-authored-by: Jonathan Breedlove <breedloj@amazon.com> Co-authored-by: Nicolas <nborges.aws@gmail.com> * Add Webview Asset Providers (#358) * Pass populated AWS_CA_BUNDLE env var to Flare (#341) * Add UI notification to alert user of deprecated manifest version (#312) * Add webview dependency missing logic to ViewRouter * Revert commit 'Add UI notification to alert user of deprecated manifest version' * Revert 'Pass populated AWS_CA_BUNDLE env var to Flare' * Rebase changes from Browser Provider PR * Fix ViewRouter --------- Co-authored-by: Jonathan Breedlove <breedloj@amazon.com> Co-authored-by: Nicolas <nborges.aws@gmail.com> * Integrate browser based views in ViewContainer (#359) * Pass populated AWS_CA_BUNDLE env var to Flare (#341) * Add UI notification to alert user of deprecated manifest version (#312) * Revert commit 'Add UI notification to alert user of deprecated manifest version' * Revert 'Pass populated AWS_CA_BUNDLE env var to Flare' * Rebase changes from Browser Provider PR * Fix ViewRouter * Integrate browser based views in ViewContainer * Fix checkstyle issues * Fix AmazonQBrowserProvider tests * Fix bug due to display sync exec call * Add semaphore locking to container to prevent race conditions * Add browser focus handling * Add state checking methods to LspState * Clean up code * Remove unnecessary parent assignment from chat webview * Refactor ViewVisibilityManager to default to one view * Add accidentally removed telemetry emissions * Update plugin descriptor (#360) * Move semaphore locking/unlocking to try/finally block --------- Co-authored-by: Jonathan Breedlove <breedloj@amazon.com> Co-authored-by: Nicolas <nborges.aws@gmail.com> * Separate Chat and Toolkit Login web view asset state event stream (#361) * Pass populated AWS_CA_BUNDLE env var to Flare (#341) * Add UI notification to alert user of deprecated manifest version (#312) * Revert commit 'Add UI notification to alert user of deprecated manifest version' * Revert 'Pass populated AWS_CA_BUNDLE env var to Flare' * Rebase changes from Browser Provider PR * Fix ViewRouter * Integrate browser based views in ViewContainer * Fix checkstyle issues * Fix AmazonQBrowserProvider tests * Fix bug due to display sync exec call * Add semaphore locking to container to prevent race conditions * Add browser focus handling * Separate Chat and Toolkit Login webview asset event stream * Separate Chat and Toolkit Login webview asset event stream * Add state checking methods to LspState * Clean up code * Remove unnecessary parent assignment from chat webview * Refactor ViewVisibilityManager to default to one view * Add accidentally removed telemetry emissions * Fix issue in a comment due to stash * Update AssetProviders to publish state everytime content is fetched * Update plugin descriptor (#360) * Remove business logic from asset provider constructors * Remove redundant methods to check state --------- Co-authored-by: Jonathan Breedlove <breedloj@amazon.com> Co-authored-by: Nicolas <nborges.aws@gmail.com> * Refactor view actions and move setup code to base view (#370) * Refactor actions and move to base view * Improve disposal logic * Fix minor bugs * Fix minor bugs * Remove unnecessary BaseView class (#371) * Remove LspStatusManager (#365) * Remove LspStatusManager * Refactor browser provider (#366) * Move publishing browser status to Activator * Fix potential memory visibility bug (#367) * Fix thread visibility bug * Fix thread visibility bug * Remove chat asset provider (#368) * Fix thread visibility bug * Remove ChatAssetProvider * Fix bugs in ViewRefactor feature branch (#362) * Remove redundant state check method * Fix bugs in view refactor branch * Fix checkstyle issues * Make webview asset provider disposal more selective * Reset content on dispose * Redirect old views to point to the ViewContainer (#380) * Redirect old view IDs to point to ViewContainer * Redirect old view IDs to point to ViewContainer * Auto detection of proxy settings * Make keystore custom cert injection additive * Introduce ViewRouter Component (#337) * improved handling of lsp failure state * add static mock to lsp connection test case * Integrate Event Broker in LspStatusManager * Add ViewRouter POC * Fix code formatting bug * Add method to retrieve observables * Add listeners for combined state streams and view update request * Add listeners for combined state streams and view update request * Add listeners for combined state streams and view update request * Add functionality for hot event streams that track latest event (#340) * Add functionality for hot subscribers that track latest event * Add test to ensure event stream isolation * Fix missing subscription disposal in test * Use autoConnect to implicitly manage stream connection * Remove active view update request listener * Add ViewRouter tests * Remove public constructor * Remove public constructor and unused event in tests * Add comments * Add documentation for EventBroker * Remove ViewRouter initialization * Remove LspInitializingView from ID enum * Add documentation for ViewRouter * Refactor and enhance EventBroker tests * Refactor ViewRouter tests for clarity * Remove PluginState class into separate file * Add documentation to subscription management logic * Add support for notifying multiple late-subscribers over time of latest state (#342) * Remove CODE_REFERENCE_VIEW * Rename newActiveViewId to newActiveView * Rename ViewId class to AmazonQViewType * Revert "Integrate Event Broker in LspStatusManager" This reverts commit 374e549. * Revert "improved handling of lsp failure state" This reverts commit 13c55ac. * Refactor EventBroker and enhance tests (#343) --------- Co-authored-by: Nicolas Borges <nickdb@amazon.com> * Add Browser Provider component (#357) * Pass populated AWS_CA_BUNDLE env var to Flare (#341) * Add UI notification to alert user of deprecated manifest version (#312) * Add webview dependency missing logic to ViewRouter * Revert commit 'Add UI notification to alert user of deprecated manifest version' * Revert 'Pass populated AWS_CA_BUNDLE env var to Flare' --------- Co-authored-by: Jonathan Breedlove <breedloj@amazon.com> Co-authored-by: Nicolas <nborges.aws@gmail.com> * Add Webview Asset Providers (#358) * Pass populated AWS_CA_BUNDLE env var to Flare (#341) * Add UI notification to alert user of deprecated manifest version (#312) * Add webview dependency missing logic to ViewRouter * Revert commit 'Add UI notification to alert user of deprecated manifest version' * Revert 'Pass populated AWS_CA_BUNDLE env var to Flare' * Rebase changes from Browser Provider PR * Fix ViewRouter --------- Co-authored-by: Jonathan Breedlove <breedloj@amazon.com> Co-authored-by: Nicolas <nborges.aws@gmail.com> * Integrate browser based views in ViewContainer (#359) * Pass populated AWS_CA_BUNDLE env var to Flare (#341) * Add UI notification to alert user of deprecated manifest version (#312) * Revert commit 'Add UI notification to alert user of deprecated manifest version' * Revert 'Pass populated AWS_CA_BUNDLE env var to Flare' * Rebase changes from Browser Provider PR * Fix ViewRouter * Integrate browser based views in ViewContainer * Fix checkstyle issues * Fix AmazonQBrowserProvider tests * Fix bug due to display sync exec call * Add semaphore locking to container to prevent race conditions * Add browser focus handling * Add state checking methods to LspState * Clean up code * Remove unnecessary parent assignment from chat webview * Refactor ViewVisibilityManager to default to one view * Add accidentally removed telemetry emissions * Update plugin descriptor (#360) * Move semaphore locking/unlocking to try/finally block --------- Co-authored-by: Jonathan Breedlove <breedloj@amazon.com> Co-authored-by: Nicolas <nborges.aws@gmail.com> * Merge main into feature/viewRefactor * Refactor asset providers (#383) * Refactor asset provider to handle JS asset setup * Move progress listener for flicker bug out of asset providers * Pre-fetch assets to publish asset state on event broker * Consolidate events into their own package (#385) * Refactor asset provider to handle JS asset setup * Move events to their own package * Move progress listener for flicker bug out of asset providers * Clean up code * Refactor asset provider interface (#386) * Refactor asset provider interface * Update initialize method to only fire once * Trigger LSP configuration pull on preference update (#388) * Open Flare version constraint (#389) * Bump version to 1.0.4-SNAPSHOT * Add dropdown menu on top level Q toolbar icon * Add item for opening Q Chat * Introduce ViewRouter Component (#337) * improved handling of lsp failure state * add static mock to lsp connection test case * Integrate Event Broker in LspStatusManager * Add ViewRouter POC * Fix code formatting bug * Add method to retrieve observables * Add listeners for combined state streams and view update request * Add listeners for combined state streams and view update request * Add listeners for combined state streams and view update request * Add functionality for hot event streams that track latest event (#340) * Add functionality for hot subscribers that track latest event * Add test to ensure event stream isolation * Fix missing subscription disposal in test * Use autoConnect to implicitly manage stream connection * Remove active view update request listener * Add ViewRouter tests * Remove public constructor * Remove public constructor and unused event in tests * Add comments * Add documentation for EventBroker * Remove ViewRouter initialization * Remove LspInitializingView from ID enum * Add documentation for ViewRouter * Refactor and enhance EventBroker tests * Refactor ViewRouter tests for clarity * Remove PluginState class into separate file * Add documentation to subscription management logic * Add support for notifying multiple late-subscribers over time of latest state (#342) * Remove CODE_REFERENCE_VIEW * Rename newActiveViewId to newActiveView * Rename ViewId class to AmazonQViewType * Revert "Integrate Event Broker in LspStatusManager" This reverts commit 374e549. * Revert "improved handling of lsp failure state" This reverts commit 13c55ac. * Refactor EventBroker and enhance tests (#343) --------- Co-authored-by: Nicolas Borges <nickdb@amazon.com> * Add Browser Provider component (#357) * Pass populated AWS_CA_BUNDLE env var to Flare (#341) * Add UI notification to alert user of deprecated manifest version (#312) * Add webview dependency missing logic to ViewRouter * Revert commit 'Add UI notification to alert user of deprecated manifest version' * Revert 'Pass populated AWS_CA_BUNDLE env var to Flare' --------- Co-authored-by: Jonathan Breedlove <breedloj@amazon.com> Co-authored-by: Nicolas <nborges.aws@gmail.com> * Add Webview Asset Providers (#358) * Pass populated AWS_CA_BUNDLE env var to Flare (#341) * Add UI notification to alert user of deprecated manifest version (#312) * Add webview dependency missing logic to ViewRouter * Revert commit 'Add UI notification to alert user of deprecated manifest version' * Revert 'Pass populated AWS_CA_BUNDLE env var to Flare' * Rebase changes from Browser Provider PR * Fix ViewRouter --------- Co-authored-by: Jonathan Breedlove <breedloj@amazon.com> Co-authored-by: Nicolas <nborges.aws@gmail.com> * Integrate browser based views in ViewContainer (#359) * Pass populated AWS_CA_BUNDLE env var to Flare (#341) * Add UI notification to alert user of deprecated manifest version (#312) * Revert commit 'Add UI notification to alert user of deprecated manifest version' * Revert 'Pass populated AWS_CA_BUNDLE env var to Flare' * Rebase changes from Browser Provider PR * Fix ViewRouter * Integrate browser based views in ViewContainer * Fix checkstyle issues * Fix AmazonQBrowserProvider tests * Fix bug due to display sync exec call * Add semaphore locking to container to prevent race conditions * Add browser focus handling * Add state checking methods to LspState * Clean up code * Remove unnecessary parent assignment from chat webview * Refactor ViewVisibilityManager to default to one view * Add accidentally removed telemetry emissions * Update plugin descriptor (#360) * Move semaphore locking/unlocking to try/finally block --------- Co-authored-by: Jonathan Breedlove <breedloj@amazon.com> Co-authored-by: Nicolas <nborges.aws@gmail.com> * Refactor view actions and move setup code to base view (#370) * Refactor actions and move to base view * Improve disposal logic * Fix minor bugs * Fix minor bugs * Auto detection of proxy settings * Integrate browser based views in ViewContainer (#359) * Pass populated AWS_CA_BUNDLE env var to Flare (#341) * Add UI notification to alert user of deprecated manifest version (#312) * Revert commit 'Add UI notification to alert user of deprecated manifest version' * Revert 'Pass populated AWS_CA_BUNDLE env var to Flare' * Rebase changes from Browser Provider PR * Fix ViewRouter * Integrate browser based views in ViewContainer * Fix checkstyle issues * Fix AmazonQBrowserProvider tests * Fix bug due to display sync exec call * Add semaphore locking to container to prevent race conditions * Add browser focus handling * Add state checking methods to LspState * Clean up code * Remove unnecessary parent assignment from chat webview * Refactor ViewVisibilityManager to default to one view * Add accidentally removed telemetry emissions * Update plugin descriptor (#360) * Move semaphore locking/unlocking to try/finally block --------- Co-authored-by: Jonathan Breedlove <breedloj@amazon.com> Co-authored-by: Nicolas <nborges.aws@gmail.com> * Refactor asset providers (#383) * Refactor asset provider to handle JS asset setup * Move progress listener for flicker bug out of asset providers * Pre-fetch assets to publish asset state on event broker * Integrate AmazonQCommonActions change * Integrate AmazonQCommonActions change * Remove duplicate events * Fix global drop-down visibility bug * Fix UdateUtil bug * Fix UdateUtil bug * Fix missing imports * Improve timing of early startup activity (#393) (#394) * Improve timing of early startup activity * Fix unit test Co-authored-by: Jonathan Breedlove <breedloj@amazon.com> Co-authored-by: Ishan Taldekar <taldekar@amazon.com> * Remove unused imports * Fix Event Broker subscription disposal bug (#392) (#395) * Fix Event Broker subscription disposal bug * Add null check Co-authored-by: Ishan Taldekar <taldekar@amazon.com> * Remove dispose method * Remove redundant classes --------- Co-authored-by: Nicolas <nborges.aws@gmail.com> Co-authored-by: Nicolas Borges <nickdb@amazon.com> Co-authored-by: Jonathan Breedlove <breedloj@amazon.com> Co-authored-by: aws-toolkit-automation <43144436+aws-toolkit-automation@users.noreply.github.com>
Issue #336
Description of changes:
This PR introduces the view container component and a updated base view as part of a larger refactor of the view handling in the plugin. Changes include refactoring browser-less views to implement the new base view, and creating logic to display all content using a singular view. The code here is dependent on previous PR #309 and PR #337.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.