PluginSupport.st
changeset 9031 625d473ea13e
child 9037 ab156dd0adf0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PluginSupport.st	Wed Dec 21 15:32:39 2005 +0100
@@ -0,0 +1,84 @@
+"
+ COPYRIGHT (c) 2005 by Claus Gittinger
+              All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+
+"{ Package: 'stx:libbasic' }"
+
+Object subclass:#PluginSupport
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'System-Support'
+!
+
+!PluginSupport class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 2005 by Claus Gittinger
+              All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+!
+
+documentation
+"
+    Provides support functions to run stx in a browser window as a plugin.
+    (actually, it could be started from any other application just the same...)
+
+    [author:]
+        Claus Gittinger
+
+    [see also:]
+        Smalltalk
+"
+! !
+
+!PluginSupport class methodsFor:'startup'!
+
+start:anApplicationClass inWindowWithID:windowID parameters:parameters
+    |app v browserWindow|
+
+    browserWindow := ExternalTopView newWithID:windowID.
+    browserWindow viewBackground:(Color red).
+    browserWindow clear.
+
+    (anApplicationClass isSubclassOf:ApplicationModel) ifTrue:[
+        app := anApplicationClass new.
+        app window:browserWindow.
+        app open.
+    ] ifFalse:[
+        v := anApplicationClass new.
+        browserWindow becomeParentOf:v.
+    ].
+
+    "/ wait forEver
+    Semaphore new wait.
+!
+
+startInBrowserWithWindowID:windowID parameters:parameters
+    self 
+        start:(WorkspaceApplication ? Workspace)
+        inWindowWithID:windowID 
+        parameters:parameters
+! !
+
+!PluginSupport class methodsFor:'documentation'!
+
+version
+    ^ '$Header: /cvs/stx/stx/libbasic/PluginSupport.st,v 1.1 2005-12-21 14:32:39 cg Exp $'
+! !