Skip to content

Commit

Permalink
Merge main into feature/viewRefactor
Browse files Browse the repository at this point in the history
  • Loading branch information
taldekar committed Feb 25, 2025
1 parent f076a99 commit db14c48
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 94 deletions.
3 changes: 0 additions & 3 deletions plugin/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
relationship="right"
visible="false">
</view>
<<<<<<< HEAD
<view
id="software.aws.toolkits.eclipse.amazonq.views.AmazonQChatWebview"
relative="software.aws.toolkits.eclipse.amazonq.views.ToolkitLoginWebview"
Expand Down Expand Up @@ -160,8 +159,6 @@
relationship="right"
visible="false">
</view>
=======
>>>>>>> 4c33324 (Integrate browser based views in ViewContainer (#359))
</perspectiveExtension>
</extension>
<extension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,65 +277,6 @@ private String getFocusOnChatPromptFunction() {
""";
}

private String generateCss() {
return """
<style>
body,
html {
background-color: var(--mynah-color-bg);
color: var(--mynah-color-text-default);
height: 100vh;
width: 100%%;
overflow: hidden;
margin: 0;
padding: 0;
}
.mynah-ui-icon-plus,
.mynah-ui-icon-cancel {
-webkit-mask-size: 155% !important;
mask-size: 155% !important;
mask-position: center;
scale: 60%;
}
.mynah-ui-icon-tabs {
-webkit-mask-size: 102% !important;
mask-size: 102% !important;
mask-position: center;
}
textarea:placeholder-shown {
line-height: 1.5rem;
}
</style>
""";
}

private String generateJS(final String jsEntrypoint) {
var chatQuickActionConfig = generateQuickActionConfig();
var disclaimerAcknowledged = Activator.getPluginStore().get(PluginStoreKeys.CHAT_DISCLAIMER_ACKNOWLEDGED);
return String.format("""
<script type="text/javascript" src="%s" defer></script>
<script type="text/javascript">
%s
const init = () => {
waitForFunction('ideCommand')
.then(() => {
amazonQChat.createChat({
postMessage: (message) => {
ideCommand(JSON.stringify(message));
}
}, {
quickActionCommands: %s,
disclaimerAcknowledged: %b
});
})
.catch(error => console.error('Error initializing chat:', error));
}
window.addEventListener('load', init);
</script>
""", jsEntrypoint, getWaitFunction(), chatQuickActionConfig, "true".equals(disclaimerAcknowledged));
}

/*
* Generates javascript for chat options to be supplied to Chat UI defined here
* https://github.com/aws/language-servers/blob/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ public AmazonQBrowserProvider() {
// Test constructor that accepts a platform
public AmazonQBrowserProvider(final PluginPlatform platform) {
this.pluginPlatform = platform;
<<<<<<< HEAD
=======
Display.getDefault().asyncExec(this::publishBrowserCompatibilityState);
>>>>>>> 4c33324 (Integrate browser based views in ViewContainer (#359))
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.part.ViewPart;

import io.reactivex.rxjava3.disposables.Disposable;
import software.aws.toolkits.eclipse.amazonq.broker.api.EventObserver;
import software.aws.toolkits.eclipse.amazonq.plugin.Activator;
import software.aws.toolkits.eclipse.amazonq.views.router.AmazonQViewType;
Expand All @@ -27,14 +26,8 @@ public final class AmazonQViewContainer extends ViewPart implements EventObserve
private Composite parentComposite;
private volatile StackLayout layout;
private Map<AmazonQViewType, BaseAmazonQView> views;
<<<<<<< HEAD
private volatile AmazonQViewType activeViewType;
private volatile BaseAmazonQView currentView;
=======
private AmazonQViewType activeViewType;
private BaseAmazonQView currentView;
private Disposable activeViewTypeSubscription;
>>>>>>> 4c33324 (Integrate browser based views in ViewContainer (#359))
private final ReentrantLock containerLock;

public AmazonQViewContainer() {
Expand Down Expand Up @@ -64,33 +57,20 @@ public void createPartControl(final Composite parent) {
parent.setLayout(gridLayout);

parentComposite = parent;
<<<<<<< HEAD

updateChildView();
=======

setupStaticMenuActions();
updateChildView();
}

private void setupStaticMenuActions() {
new AmazonQStaticActions(getViewSite());
>>>>>>> 4c33324 (Integrate browser based views in ViewContainer (#359))
}

private void updateChildView() {
Display.getDefault().asyncExec(() -> {
try {
containerLock.lock();
BaseAmazonQView newView = views.get(activeViewType);

if (currentView != null) {
<<<<<<< HEAD
if (currentView instanceof AmazonQChatWebview) {
((AmazonQChatWebview) currentView).disposeBrowserState();
}
=======
>>>>>>> 4c33324 (Integrate browser based views in ViewContainer (#359))
Control[] children = parentComposite.getChildren();
for (Control child : children) {
if (child != null && !child.isDisposed()) {
Expand All @@ -101,14 +81,7 @@ private void updateChildView() {
currentView.dispose();
}

<<<<<<< HEAD
newView.setViewSite(getViewSite());
=======
if (activeViewType == AmazonQViewType.CHAT_VIEW
|| activeViewType == AmazonQViewType.TOOLKIT_LOGIN_VIEW) {
((AmazonQView) newView).setViewSite(getViewSite());
}
>>>>>>> 4c33324 (Integrate browser based views in ViewContainer (#359))

Composite newViewComposite = newView.setupView(parentComposite);
GridData gridData = new GridData(SWT.CENTER, SWT.CENTER, true, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private void refreshActiveView(final PluginState pluginState) {

if (pluginState.browserCompatibilityState() == BrowserCompatibilityState.DEPENDENCY_MISSING) {
newActiveView = AmazonQViewType.DEPENDENCY_MISSING_VIEW;
} else if (pluginState.lspState().hasFailed()) {
} else if (pluginState.lspState() == LspState.FAILED) {
newActiveView = AmazonQViewType.LSP_STARTUP_FAILED_VIEW;
} else if (pluginState.chatWebViewAssetState() == ChatWebViewAssetState.DEPENDENCY_MISSING
|| pluginState.toolkitLoginWebViewAssetState() == ToolkitLoginWebViewAssetState.DEPENDENCY_MISSING) {
Expand Down

0 comments on commit db14c48

Please sign in to comment.