@@ -80,25 +80,75 @@ on mouseUp
8080 revIDEAnswerFile "stack"
8181
8282 # Get the path of to the file
83- local tStackFilePath
84- put the result into tStackFilePath
83+ local tStackFilePaths
84+ put the result into tStackFilePaths
8585
86- if tStackFilePath is not empty then
87- local tEditorValue , tNewLine
88- put the short name of stack tStackFilePath & comma & tStackFilePath into tNewLine
89- put the editorValue of me into tEditorValue
90- if tEditorValue is empty then
91- put tNewLine into tEditorValue
92- else
93- put return & tNewLine after tEditorValue
94- end if
95- set the editorValue of me to tEditorValue
96- updateProperty
86+ if tStackFilePaths is not empty AND tStackFilePaths is not "cancel" then
87+ addStacks tStackFilePaths
9788 end if
9889 break
9990 end switch
10091end mouseUp
10192
93+
94+ on dragEnter
95+ if the short name of the target is "stackFilesField" then
96+ if the dragData["files" ] is not empty then
97+ local tExtensions , tFile
98+
99+ set the wholematches to true
100+ put revIDEAcceptedTypes("stack" ) into tExtensions
101+ repeat for each line tFile in the dragData["files" ]
102+ if fileExtension(tFile ) is among the items of tExtensions then
103+ set the dragAction to "copy"
104+ exit repeat
105+ end if
106+ end repeat
107+ end if
108+ else
109+ pass dragEnter
110+ end if
111+ end dragEnter
112+
113+
114+ on dragDrop
115+ if the short name of the target is "stackFilesField" then
116+ addStacks the dragData["files" ]
117+ else
118+ pass dragDrop
119+ end if
120+ end dragDrop
121+
122+
123+ private command addStacks pStackFilePaths
124+ local tEditorValue , tNewLine
125+
126+ put the editorValue of me into tEditorValue
127+
128+ repeat for each line tStackFilePath in pStackFilePaths
129+ put the short name of stack tStackFilePath & comma & tStackFilePath into tNewLine
130+ if tEditorValue is empty then
131+ put tNewLine into tEditorValue
132+ else
133+ put return & tNewLine after tEditorValue
134+ end if
135+ end repeat
136+ set the editorValue of me to tEditorValue
137+ updateProperty
138+ end addStacks
139+
140+ private function fileExtension pFilename
141+ set the itemDelimiter to "/"
142+ put the last item of pFilename into pFilename
143+ set the itemDelimiter to "."
144+ if the number of items of pFilename > 1 then
145+ return the last item of pFilename
146+ else
147+ return empty
148+ end if
149+ end fileExtension
150+
151+
102152on valueChanged
103153 local tValue
104154 put field "stackFilesField" into tValue
0 commit comments