13397
|
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 |
AbstractDesktop subclass:#UnixDesktop
|
|
15 |
instanceVariableNames:''
|
|
16 |
classVariableNames:''
|
|
17 |
poolDictionaries:''
|
|
18 |
category:'System-Desktop'
|
|
19 |
!
|
|
20 |
|
|
21 |
!UnixDesktop 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 |
!UnixDesktop class methodsFor:'accessing'!
|
|
38 |
|
|
39 |
priority
|
|
40 |
|
|
41 |
^1
|
|
42 |
|
|
43 |
"Modified: / 11-08-2009 / 16:40:06 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
44 |
! !
|
|
45 |
|
|
46 |
!UnixDesktop class methodsFor:'accessing - defaults'!
|
|
47 |
|
|
48 |
defaultEditorCommand
|
|
49 |
^ (OperatingSystem getEnvironment: 'VISUAL')
|
|
50 |
ifNil: [ (OperatingSystem getEnvironment: 'EDITOR') ]
|
|
51 |
|
|
52 |
"Created: / 11-08-2009 / 16:53:52 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
53 |
! !
|
|
54 |
|
|
55 |
!UnixDesktop class methodsFor:'testing'!
|
|
56 |
|
|
57 |
isAvailable
|
|
58 |
|
|
59 |
^OperatingSystem isUNIXlike
|
|
60 |
|
|
61 |
"Modified: / 11-08-2009 / 16:40:30 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
62 |
! !
|
|
63 |
|
|
64 |
!UnixDesktop methodsFor:'accessing - commands'!
|
|
65 |
|
|
66 |
editorCommand
|
|
67 |
|
|
68 |
^UserPreferences current editorCommand
|
|
69 |
ifNil:[self class defaultEditorCommand]
|
|
70 |
|
|
71 |
"
|
|
72 |
Desktop editorCommand
|
|
73 |
"
|
|
74 |
|
|
75 |
"Created: / 11-08-2009 / 17:32:42 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
76 |
! !
|
|
77 |
|
|
78 |
!UnixDesktop methodsFor:'operations'!
|
|
79 |
|
|
80 |
edit: filenames
|
|
81 |
|
|
82 |
"
|
|
83 |
Opens desktop's preferred editor on given filenames.
|
|
84 |
|
|
85 |
filenames - a String or Filename or collection of those.
|
|
86 |
"
|
|
87 |
|
|
88 |
^self execute: self editorCommand filenames: filenames
|
|
89 |
|
|
90 |
"
|
|
91 |
Desktop edit: '/home/janfrog/.emacs'
|
|
92 |
"
|
|
93 |
|
|
94 |
"Created: / 11-08-2009 / 17:35:57 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
95 |
! !
|
|
96 |
|
|
97 |
!UnixDesktop methodsFor:'operations - private'!
|
|
98 |
|
|
99 |
execute: command filenames: filenames
|
|
100 |
|
|
101 |
| filenamesAsStrings placeholders |
|
|
102 |
filenamesAsStrings := (self toArrayOfFilenames: filenames) collect:[:f|f asString].
|
|
103 |
placeholders := Dictionary new.
|
|
104 |
placeholders
|
|
105 |
at: 'f' put: (filenamesAsStrings asStringWith: Character space);
|
|
106 |
at: 'F' put: filenamesAsStrings first.
|
|
107 |
|
|
108 |
^self execute: command placeholders: placeholders.
|
|
109 |
|
|
110 |
"Created: / 11-08-2009 / 17:40:10 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
111 |
!
|
|
112 |
|
|
113 |
execute: command placeholders: placeholders
|
|
114 |
|
|
115 |
^OperatingSystem
|
|
116 |
executeCommand:(command expandPlaceholdersWith: placeholders)
|
|
117 |
|
|
118 |
"
|
|
119 |
Desktop edit: '/home/janfrog/.emacs'
|
|
120 |
"
|
|
121 |
|
|
122 |
"Created: / 11-08-2009 / 17:41:45 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
123 |
! !
|
|
124 |
|
|
125 |
!UnixDesktop class methodsFor:'documentation'!
|
|
126 |
|
|
127 |
version_CVS
|
|
128 |
^ '$Header: /cvs/stx/stx/libbasic/UnixDesktop.st,v 1.1 2011-06-28 10:10:03 vrany Exp $'
|
|
129 |
!
|
|
130 |
|
|
131 |
version_SVN
|
|
132 |
^ ' Id: UnixDesktop.st 10517 2010-04-26 18:26:38Z vranyj1 '
|
|
133 |
! !
|