CanScan
Loading...
Searching...
No Matches
fr.softsf.canscan.util.BrowserHelper Enum Reference

Singleton service for browser operations in Swing applications. More...

+ Collaboration diagram for fr.softsf.canscan.util.BrowserHelper:

Public Member Functions

boolean openInBrowser (String url)
 Attempts to open a URL in the default browser asynchronously with a 2-second timeout.
 

Public Attributes

 INSTANCE
 

Private Member Functions

void handleError (String message, Exception e, String url)
 Displays error dialog to user with failure details.
 
boolean tryOpenBrowser (String url)
 Executes Desktop.browse or falls back to the native xdg-open command on Linux if the AWT Desktop API fails to support the BROWSE action.
 

Static Private Attributes

static final String ERROR = "ERROR"
 
static final int TIMEOUT_SECONDS = 2
 

Detailed Description

Singleton service for browser operations in Swing applications.

Provides robust URL opening with timeout protection using the Desktop API.

Member Function Documentation

◆ handleError()

void fr.softsf.canscan.util.BrowserHelper.handleError ( String message,
Exception e,
String url )
private

Displays error dialog to user with failure details.

Parameters
messageerror description
eexception that occurred
urlthe URL that failed to open

◆ openInBrowser()

boolean fr.softsf.canscan.util.BrowserHelper.openInBrowser ( String url)

Attempts to open a URL in the default browser asynchronously with a 2-second timeout.

Parameters
urlThe URL to open.
Returns
true if the launch command completed successfully within the timeout;
false
otherwise (error details are displayed via a dialog).
Exceptions
NullPointerExceptionif url is null.
+ Here is the call graph for this function:

◆ tryOpenBrowser()

boolean fr.softsf.canscan.util.BrowserHelper.tryOpenBrowser ( String url)
private

Executes Desktop.browse or falls back to the native xdg-open command on Linux if the AWT Desktop API fails to support the BROWSE action.

Parameters
urlThe URL to open.
Returns
true if the browser was successfully called; false on internal error.
+ Here is the call graph for this function:

Member Data Documentation

◆ ERROR

final String fr.softsf.canscan.util.BrowserHelper.ERROR = "ERROR"
staticprivate

◆ INSTANCE

fr.softsf.canscan.util.BrowserHelper.INSTANCE

◆ TIMEOUT_SECONDS

final int fr.softsf.canscan.util.BrowserHelper.TIMEOUT_SECONDS = 2
staticprivate

The documentation for this enum was generated from the following file: