From VisualWorks®, 7.6 of February 8, 2008 on March 3, 2008 at 9:41:45 pm (Dialog confirm: 'You are filing-in a Parcel source file!\\While this is possible it will not have\the same effect as loading the parcel.\None of the Parcel''s prerequisites will\be loaded and none of its load actions\will be performed.\\Are you sure you want to file-in?' withCRs) ifFalse: [self error: 'Parcel file-in abandoned. Choose terminate or close.'] <class> <name>ExternalWebBrowser</name> <environment>Smalltalk</environment> <super>Core.Object</super> <private>false</private> none activeWindow shouldLaunchNewWindow currentExternalBrowser currentExternalBrowser <imports></imports> <category></category> <attributes> <package>ExternalWebBrowser</package> </attributes> </class> <comment> ExternalWebBrowser
BrowserLaunchService is the object that handles the launching of external browsers across platforms.
</comment> <class> <name>OsxBrowserLaunchService</name> <environment>Smalltalk</environment> <super>ExternalWebBrowser</super> <private>false</private> none <imports></imports> <category>Browsing-Assist</category> <attributes> <package>ExternalWebBrowser</package> </attributes> </class> <comment> OsxBrowserLaunchService
Uses the 'open' command. From the 'open' man page... "... The open command opens a file (or a directory or URL), just as if you had double-clicked the file's icon. If no application name is specified, the default application as determined via LaunchServices is used to open the specified files. If the file is in the form of a URL, the file will be opened as a URL..."
</comment> <class> <name>MacBrowserLaunchService</name> <environment>Smalltalk</environment> <super>ExternalWebBrowser</super> <private>false</private> none <imports></imports> <category>Browsing-Assist</category> <attributes> <package>ExternalWebBrowser</package> </attributes> </class> <comment> MacBrowserLaunchService
MacBrowserLaunchService launches a default Unix browser
</comment> <class> <name>UnixBrowserLaunchService</name> <environment>Smalltalk</environment> <super>ExternalWebBrowser</super> <private>false</private> none <imports></imports> <category>Browsing-Assist</category> <attributes> <package>ExternalWebBrowser</package> </attributes> </class> <comment> UnixBrowserLaunchService
UnixBrowserLaunchService launches a default Unix browser
</comment> <class> <name>BrowserLaunchFailed</name> <environment>Smalltalk</environment> <super>Core.Exception</super> <private>false</private> none <imports></imports> <category>Browsing-Assist</category> <attributes> <package>ExternalWebBrowser</package> </attributes> </class> <comment> BrowserLaunchFailed
BrowserLaunchFailed is raised if a default browser was not found
</comment> <class> <name>WindowsBrowserLaunchService</name> <environment>Smalltalk</environment> <super>ExternalWebBrowser</super> <private>false</private> none <imports></imports> <category>Browsing-Assist</category> <attributes> <package>ExternalWebBrowser</package> </attributes> </class> <comment> WindowsBrowserLaunchService
WindowsBrowserLaunchService launches a default Windows browser
</comment> <methods> ExternalWebBrowser <category>accessing</category>
activeWindow ^activeWindow
activeWindow: anObject activeWindow := anObject
currentExternalBrowser ^(currentExternalBrowser isNil or: [currentExternalBrowser isEmpty]) ifTrue: [currentExternalBrowser := self class currentExternalBrowser] ifFalse: [currentExternalBrowser]
currentExternalBrowser: anObject currentExternalBrowser := anObject. self class currentExternalBrowser: anObject
shouldLaunchNewWindow ^shouldLaunchNewWindow isNil ifTrue: [shouldLaunchNewWindow := false] ifFalse: [shouldLaunchNewWindow]
shouldLaunchNewWindow: anObject shouldLaunchNewWindow := anObject
</methods> <methods> ExternalWebBrowser <category>private</category>
fallbackBrowserOpen: link BrowserLaunchFailed signalWith: 'Browser Launch Failed. \Cannot find a default browser' withCRs
privateOpenBrowserOn: link self subclassResponsibility
</methods> <methods> ExternalWebBrowser <category>api</category>
openBrowserOn: link [self privateOpenBrowserOn: link] fork
</methods> <methods> ExternalWebBrowser class <category>testing</category>
matchesPlatform ^self subclassResponsibility
</methods> <methods> ExternalWebBrowser class <category>accessing</category>
current "Transitional implementation. we're going to move all this instance side stuff over to the class side real soon now." ^self new
currentExternalBrowser ^currentExternalBrowser ifNil: [currentExternalBrowser := self getDefaultBrowserPath]
currentExternalBrowser: anObject currentExternalBrowser := anObject
</methods> <methods> ExternalWebBrowser class <category>instance creation</category>
new ^self subclassForPlatform basicNew
new: aWindow ^self new activeWindow: aWindow
subclassForPlatform "Classes deeper in the heirarchy take precedence over their parents" self allSubclasses do: [:subclass | subclass subclassForPlatform ifNotNil: [:anAnswer | ^anAnswer]. subclass matchesPlatform ifTrue: [^subclass]]. ^nil
</methods> <methods> ExternalWebBrowser class <category>API</category>
open: aString self current openBrowserOn: aString
</methods> <methods> ExternalWebBrowser class <category>defaults</category>
getDefaultBrowserPath ^nil
</methods> <methods> OsxBrowserLaunchService <category>api</category>
privateOpenBrowserOn: link [UnixProcess forkJob: 'open' arguments: (Array with: link)] on: Error do: [:ex | self fallbackBrowserOpen: link. ex return]
</methods> <methods> OsxBrowserLaunchService class <category>testing</category>
matchesPlatform ^'*MacOSX' match: OSHandle currentPlatformID
</methods> <methods> MacBrowserLaunchService <category>api</category>
privateOpenBrowserOn: link " | browserPath appPath | browserPath := self currentExternalBrowser. appPath := browserPath, ' ', link. " 'MacAEManager finderOpen: link' halt
</methods> <methods> MacBrowserLaunchService class <category>testing</category>
matchesPlatform ^OSHandle currentOS == #mac
</methods> <methods> UnixBrowserLaunchService <category>private-unix</category>
getBrowserArgs: link ^self isMozillaBrowser ifTrue: [self getMozillaArgs: link] ifFalse: [Array with: link]
openExistingUnix: link ^UnixProcess forkJob: self currentExternalBrowser arguments: (self getBrowserArgs: link)
openNewUnix: link ^UnixProcess forkJob: self currentExternalBrowser arguments: (Array with: link)
</methods> <methods> UnixBrowserLaunchService <category>private-mozilla</category>
getMozillaArgs: link self shouldLaunchNewWindow ifTrue: [^Array with: link]. ^Array with: '-remote' with: 'openURL(''' , link , ''')'
</methods> <methods> UnixBrowserLaunchService <category>testing</category>
isFailedReuseOfMozilla: resultString self isMozillaBrowser ifFalse: [^false]. ^'*no running*' match: resultString asLowercase
isMozillaBrowser | browserString | browserString := self currentExternalBrowser asLowercase. ^('*netscape*' match: browserString) or: ['*mozilla*' match: browserString]
</methods> <methods> UnixBrowserLaunchService <category>api</category>
privateOpenBrowserOn: link | result | result := UnixProcess forkJob: self currentExternalBrowser arguments: (self getBrowserArgs: link). (self isFailedReuseOfMozilla: result) ifTrue: [self openNewUnix: link]
</methods> <methods> UnixBrowserLaunchService class <category>testing</category>
matchesPlatform ^OSHandle currentOS== #unix and: [OsxBrowserLaunchService matchesPlatform not]
</methods> <methods> UnixBrowserLaunchService class <category>defaults</category>
getDefaultBrowserPath "Return an empty string if the browser can not be found, clients are not expecting nil." ^#('/etc/alternatives/x-www-browser' '/usr/bin/gnome-open') detect: [:path | path asFilename exists] ifNone: [String new]
</methods> <methods> WindowsBrowserLaunchService <category>api</category>
privateOpenBrowserOn: link OSSystemSupport concreteClass new ShellExecute: nil with: 'open' with: link with: nil with: nil with: 1
</methods> <methods> WindowsBrowserLaunchService class <category>defaults</category>
getDefaultBrowserPath "try two different tacks to get the default browser" | app | app := self getWinKey: '' using: #('http' 'shell' 'open' 'command') andRoot: #HKEY_CLASSES_ROOT. app isNil ifTrue: [ app := self getWinKey: '' using: #('htmlfile' 'shell' 'open' 'command') andRoot: #HKEY_CLASSES_ROOT]. ^app
getWinKey: keyname using: path andRoot: root | ifc rootCode | ifc := OSSystemSupport concreteClass new. rootCode := ifc perform: root. ^ifc getVariableWithRoot: rootCode path: path name: keyname ifAbsent: [nil]
</methods> <methods> WindowsBrowserLaunchService class <category>testing</category>
matchesPlatform ^OSHandle currentOS == #win32
</methods> <methods> OS.Win32SystemSupport class <category>libraries</category>
shell32_dll <library: 'win'> ^'shell32.dll'
</methods> <methods> OS.Win32SystemSupport <category>procedures</category>
ShellExecute: hwnd with: lpOperation with: lpFile with: lpParameters with: lpDirectory with: nShowCmd <C: unsigned int ShellExecuteA(HWND hwnd, LPCTSTR lpOperation, LPCTSTR lpFile, LPCTSTR lpParameters, LPCTSTR lpDirectory,int nShowCmd )> ^self externalAccessFailedWith: _errorCode
</methods> "Imported Classes:" self error: 'Attempting to file-in parcel imports. Choose terminate or close' <class> <name>Object</name> <environment>Core</environment> <super></super> <private>false</private> none <imports></imports> <category>Kernel-Objects</category> <attributes> <package>Kernel-Objects</package> </attributes> </class> <class> <name>Exception</name> <environment>Core</environment> <super>Core.GenericException</super> <private>false</private> none <imports></imports> <category>Kernel-Exception Handling</category> <attributes> <package>Kernel-Exception Handling</package> </attributes> </class> <class> <name>Win32SystemSupport</name> <environment>OS</environment> <super>OS.OSSystemSupport</super> <private>false</private> none <imports> OS.Win32SystemSupportDictionary.* </imports> <category>OS-Support</category> <attributes> <includeFiles></includeFiles> <includeDirectories></includeDirectories> <libraryFiles><item>kernel32.dll</item> <item>gdi32.dll</item> <item>advapi32.dll</item> <item>user32.dll</item></libraryFiles> <libraryDirectories></libraryDirectories> false full <package>OS-Support</package> </attributes> </class>