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