Skip to content

Commit fba32da

Browse files
committed
fix some checkstyle issues
1 parent e10afd4 commit fba32da

File tree

2 files changed

+67
-68
lines changed

2 files changed

+67
-68
lines changed

plugin/src/software/aws/toolkits/eclipse/amazonq/views/AmazonQChatWebview.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
package software.aws.toolkits.eclipse.amazonq.views;
55

66
import java.nio.file.Path;
7-
87
import org.eclipse.jetty.server.Server;
98
import org.eclipse.swt.browser.BrowserFunction;
109
import org.eclipse.swt.widgets.Composite;
@@ -58,12 +57,12 @@ public Object function(final Object[] arguments) {
5857
}
5958

6059
private String getContent() {
61-
String jsFile = PluginUtils.getAwsDirectory(LspConstants.LSP_SUBDIRECTORY).resolve("amazonq-ui.js").toString();
60+
String jsFile = PluginUtils.getAwsDirectory(LspConstants.LSP_SUBDIRECTORY).resolve("amazonq-ui.js").toString();
6261
var jsParent = Path.of(jsFile).getParent();
6362
var jsDirectoryPath = Path.of(jsParent.toUri()).normalize().toString();
6463

6564
server = setupVirtualServer(jsDirectoryPath);
66-
if(server == null) {
65+
if (server == null) {
6766
return "Failed to load JS";
6867
}
6968

plugin/src/software/aws/toolkits/eclipse/amazonq/views/AmazonQView.java

Lines changed: 65 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -104,70 +104,70 @@ private void setupActions(final Browser browser, final boolean isLoggedIn) {
104104
amazonQCommonActions = new AmazonQCommonActions(browser, isLoggedIn, getViewSite());
105105
}
106106

107-
private void setupAuthStatusListeners() {
108-
authStatusChangedListener = this::handleAuthStatusChange;
109-
AuthUtils.addAuthStatusChangeListener(amazonQCommonActions.getSignoutAction());
110-
AuthUtils.addAuthStatusChangeListener(amazonQCommonActions.getFeedbackDialogContributionAction());
111-
}
112-
113-
/**
114-
* Sets up virtual host mapping for the given path using jetty server
115-
*
116-
* @param jsPath
117-
* @return server launched
118-
*/
119-
protected Server setupVirtualServer(String jsPath) {
120-
Server server = null;
121-
try {
122-
server = new Server(0);
123-
var servletContext = new ContextHandler();
124-
servletContext.setContextPath("/");
125-
servletContext.addVirtualHosts(new String[] { "localhost" });
126-
127-
var handler = new ResourceHandler();
128-
129-
ResourceFactory resourceFactory = ResourceFactory.of(server);
130-
handler.setBaseResource(resourceFactory.newResource(jsPath));
131-
handler.setDirAllowed(true);
132-
servletContext.setHandler(handler);
133-
134-
server.setHandler(servletContext);
135-
server.start();
136-
137-
return server;
138-
139-
} catch (Exception e) {
140-
stopVirtualServer(server);
141-
PluginLogger.error("Error occurred while attempting to start a virtual server for " + jsPath, e);
142-
return null;
143-
}
144-
}
145-
146-
protected void stopVirtualServer(Server server) {
147-
if (server != null) {
148-
try {
149-
server.stop();
150-
} catch (Exception e) {
151-
PluginLogger.error("Error occurred when attempting to stop the virtual server", e);
152-
}
153-
}
154-
}
155-
156-
@Override
157-
public final void setFocus() {
158-
browser.setFocus();
159-
}
160-
161-
/**
162-
* Disposes of the resources associated with this view.
163-
*
164-
* This method is called when the view is closed. It removes the authentication
165-
* status change listener and the selection listener from the page.
166-
*/
167-
@Override
168-
public void dispose() {
169-
AuthUtils.removeAuthStatusChangeListener(authStatusChangedListener);
170-
super.dispose();
171-
}
107+
private void setupAuthStatusListeners() {
108+
authStatusChangedListener = this::handleAuthStatusChange;
109+
AuthUtils.addAuthStatusChangeListener(amazonQCommonActions.getSignoutAction());
110+
AuthUtils.addAuthStatusChangeListener(amazonQCommonActions.getFeedbackDialogContributionAction());
111+
}
112+
113+
/**
114+
* Sets up virtual host mapping for the given path using jetty server
115+
*
116+
* @param jsPath
117+
* @return server launched
118+
*/
119+
protected Server setupVirtualServer(String jsPath) {
120+
Server server = null;
121+
try {
122+
server = new Server(0);
123+
var servletContext = new ContextHandler();
124+
servletContext.setContextPath("/");
125+
servletContext.addVirtualHosts(new String[] { "localhost" });
126+
127+
var handler = new ResourceHandler();
128+
129+
ResourceFactory resourceFactory = ResourceFactory.of(server);
130+
handler.setBaseResource(resourceFactory.newResource(jsPath));
131+
handler.setDirAllowed(true);
132+
servletContext.setHandler(handler);
133+
134+
server.setHandler(servletContext);
135+
server.start();
136+
137+
return server;
138+
139+
} catch (Exception e) {
140+
stopVirtualServer(server);
141+
PluginLogger.error("Error occurred while attempting to start a virtual server for " + jsPath, e);
142+
return null;
143+
}
144+
}
145+
146+
protected void stopVirtualServer(Server server) {
147+
if (server != null) {
148+
try {
149+
server.stop();
150+
} catch (Exception e) {
151+
PluginLogger.error("Error occurred when attempting to stop the virtual server", e);
152+
}
153+
}
154+
}
155+
156+
@Override
157+
public final void setFocus() {
158+
browser.setFocus();
159+
}
160+
161+
/**
162+
* Disposes of the resources associated with this view.
163+
*
164+
* This method is called when the view is closed. It removes the authentication
165+
* status change listener and the selection listener from the page.
166+
*/
167+
@Override
168+
public void dispose() {
169+
AuthUtils.removeAuthStatusChangeListener(authStatusChangedListener);
170+
super.dispose();
171+
}
172172

173173
}

0 commit comments

Comments
 (0)