13392
|
1 |
"
|
|
2 |
COPYRIGHT (c) 2006 by eXept Software AG
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
"{ Package: 'stx:libbasic' }"
|
|
13 |
|
21901
|
14 |
"{ NameSpace: Smalltalk }"
|
|
15 |
|
13392
|
16 |
Object subclass:#AbstractDesktop
|
|
17 |
instanceVariableNames:''
|
|
18 |
classVariableNames:'Current'
|
|
19 |
poolDictionaries:''
|
|
20 |
category:'System-Desktop'
|
|
21 |
!
|
|
22 |
|
|
23 |
!AbstractDesktop class methodsFor:'documentation'!
|
|
24 |
|
|
25 |
copyright
|
|
26 |
"
|
|
27 |
COPYRIGHT (c) 2006 by eXept Software AG
|
|
28 |
All Rights Reserved
|
|
29 |
|
|
30 |
This software is furnished under a license and may be used
|
|
31 |
only in accordance with the terms of that license and with the
|
|
32 |
inclusion of the above copyright notice. This software may not
|
|
33 |
be provided or otherwise made available to, or used by, any
|
|
34 |
other person. No title to or ownership of the software is
|
|
35 |
hereby transferred.
|
|
36 |
"
|
|
37 |
! !
|
|
38 |
|
|
39 |
!AbstractDesktop class methodsFor:'initialization'!
|
|
40 |
|
|
41 |
initialize
|
|
42 |
|
|
43 |
"
|
|
44 |
self initialize.
|
|
45 |
Desktop
|
|
46 |
"
|
|
47 |
|
|
48 |
Current := nil.
|
|
49 |
Smalltalk at: #Desktop put:self current
|
|
50 |
|
|
51 |
"Created: / 11-08-2009 / 17:09:52 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
52 |
! !
|
|
53 |
|
|
54 |
!AbstractDesktop class methodsFor:'instance creation'!
|
|
55 |
|
|
56 |
new
|
|
57 |
^ self basicNew initialize.
|
|
58 |
! !
|
|
59 |
|
|
60 |
!AbstractDesktop class methodsFor:'accessing'!
|
|
61 |
|
|
62 |
best
|
|
63 |
|
|
64 |
"
|
|
65 |
AbstractDesktop best
|
|
66 |
"
|
|
67 |
|
|
68 |
(self allSubclasses asSortedCollection: [:a :b|a priority > b priority])
|
|
69 |
do:[:cls|cls isAvailable ifTrue:[^cls new]].
|
|
70 |
^nil "maybe error?"
|
|
71 |
|
|
72 |
"Created: / 11-08-2009 / 17:09:52 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
73 |
"Modified: / 28-06-2011 / 11:50:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
74 |
!
|
|
75 |
|
|
76 |
current
|
|
77 |
|
21901
|
78 |
Current isNil ifTrue: [Current := self best].
|
13392
|
79 |
^Current
|
|
80 |
|
|
81 |
"Created: / 11-08-2009 / 17:08:26 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
21901
|
82 |
"Modified: / 22-06-2017 / 12:57:47 / cg"
|
13392
|
83 |
!
|
|
84 |
|
|
85 |
priority
|
|
86 |
|
|
87 |
"The higher numbers a checked first"
|
|
88 |
|
|
89 |
self subclassResponsibility
|
|
90 |
|
|
91 |
"Created: / 11-08-2009 / 16:38:23 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
92 |
! !
|
|
93 |
|
|
94 |
!AbstractDesktop class methodsFor:'testing'!
|
|
95 |
|
|
96 |
isAvailable
|
|
97 |
|
|
98 |
"Returns true if this desktop is available on this computer"
|
|
99 |
|
|
100 |
self subclassResponsibility
|
|
101 |
|
|
102 |
"Created: / 11-08-2009 / 16:38:11 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
103 |
! !
|
|
104 |
|
|
105 |
!AbstractDesktop methodsFor:'operations'!
|
|
106 |
|
|
107 |
edit: filenames
|
|
108 |
|
|
109 |
"
|
|
110 |
Opens desktop's preferred editor on given filenames.
|
|
111 |
|
|
112 |
filenames - a String or Filename or collection of those.
|
|
113 |
"
|
|
114 |
|
|
115 |
| files |
|
|
116 |
files := self toArrayOfFilenames: filenames.
|
|
117 |
|
|
118 |
"Created: / 11-08-2009 / 17:31:14 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
119 |
! !
|
|
120 |
|
|
121 |
!AbstractDesktop methodsFor:'utilities'!
|
|
122 |
|
|
123 |
toArrayOfFilenames: filenameOrCollectionOfThose
|
|
124 |
|
|
125 |
^(filenameOrCollectionOfThose isCollection
|
|
126 |
and:[filenameOrCollectionOfThose isString not])
|
|
127 |
ifTrue:[filenameOrCollectionOfThose collect:[:e|e asFilename]]
|
|
128 |
ifFalse:[Array with:filenameOrCollectionOfThose asFilename]
|
|
129 |
|
|
130 |
"Created: / 11-08-2009 / 17:28:24 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
131 |
! !
|
|
132 |
|
|
133 |
!AbstractDesktop class methodsFor:'documentation'!
|
|
134 |
|
|
135 |
version_CVS
|
21901
|
136 |
^ '$Header$'
|
13392
|
137 |
!
|
|
138 |
|
|
139 |
version_SVN
|
21901
|
140 |
^ '$ Id: AbstractDesktop.st 10517 2010-04-26 18:26:38Z vranyj1 $'
|
13392
|
141 |
! !
|
|
142 |
|
21901
|
143 |
|
13392
|
144 |
AbstractDesktop initialize!
|