Skip to content

Commit

Permalink
code convention edits in update prompt for checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Borges committed Jan 23, 2025
1 parent 4708658 commit 5554c03
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
public final class PersistentToolkitNotification extends ToolkitNotification {
private final Consumer<Boolean> checkboxCallback;

public PersistentToolkitNotification(Display display, String title, String description, Consumer<Boolean> checkboxCallback) {
public PersistentToolkitNotification(final Display display, final String title,
final String description, final Consumer<Boolean> checkboxCallback) {
super(display, title, description);
this.checkboxCallback = checkboxCallback;
}
Expand Down Expand Up @@ -63,7 +64,7 @@ protected void createContentArea(final Composite parent) {
// make button text clickable
checkboxLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseUp(MouseEvent e) {
public void mouseUp(final MouseEvent e) {
doNotShowCheckbox.setSelection(!doNotShowCheckbox.getSelection());
if (checkboxCallback != null) {
checkboxCallback.accept(doNotShowCheckbox.getSelection());
Expand All @@ -73,7 +74,7 @@ public void mouseUp(MouseEvent e) {

doNotShowCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
public void widgetSelected(final SelectionEvent e) {
if (checkboxCallback != null) {
checkboxCallback.accept(doNotShowCheckbox.getSelection());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ private Image getInfoIcon() {
return this.infoIcon;
}

/**
* Creates the content area for the notification.
* Subclasses may override this method to customize the notification content.
*
* @param parent the parent composite
*/
@Override
protected void createContentArea(final Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
Expand All @@ -59,12 +65,12 @@ protected void createContentArea(final Composite parent) {
}

@Override
protected String getPopupShellTitle() {
protected final String getPopupShellTitle() {
return this.title;
}

@Override
protected void initializeBounds() {
protected final void initializeBounds() {
Rectangle clArea = getPrimaryClientArea();
Point initialSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
int height = Math.max(initialSize.y, MIN_HEIGHT);
Expand Down Expand Up @@ -105,7 +111,7 @@ private void repositionNotifications() {
}

@Override
public boolean close() {
public final boolean close() {
activeNotifications.remove(this);
repositionNotifications();
if (this.infoIcon != null && !this.infoIcon.isDisposed()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
import software.aws.toolkits.eclipse.amazonq.plugin.Activator;
import software.aws.toolkits.eclipse.amazonq.telemetry.metadata.PluginClientMetadata;

public class UpdateUtils {
public final class UpdateUtils {
//env for this link?
private static final String requestURL = "https://amazonq.eclipsetoolkit.amazonwebservices.com/artifacts.xml.xz";
private static final String REQUESTURL = "https://amazonq.eclipsetoolkit.amazonwebservices.com/artifacts.xml.xz";
private static Version mostRecentNotificationVersion;
private static Version remoteVersion;
private static Version localVersion;
Expand All @@ -40,7 +40,7 @@ private UpdateUtils() {

private boolean newUpdateAvailable() {
//fetch artifact file containing version info from repo
remoteVersion = fetchRemoteArtifactVersion(requestURL);
remoteVersion = fetchRemoteArtifactVersion(REQUESTURL);

//return early if either version is unavailable
if (remoteVersion == null || localVersion == null) {
Expand All @@ -59,7 +59,7 @@ public void checkForUpdate() {
}
}

private Version fetchRemoteArtifactVersion(String repositoryUrl) {
private Version fetchRemoteArtifactVersion(final String repositoryUrl) {
HttpURLConnection connection = null;
try {
URL url = new URL(repositoryUrl);
Expand Down Expand Up @@ -116,7 +116,7 @@ private void showNotification() {
});
}

private static boolean remoteVersionIsGreater(Version remote, Version local) {
private static boolean remoteVersionIsGreater(final Version remote, final Version local) {
return remote.compareTo(local) > 0;
}
}

0 comments on commit 5554c03

Please sign in to comment.