<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>The answer of an example implementation is below.<br>
    </p>
    <p>Now on <br>
    </p>
    <p><a class="moz-txt-link-freetext" href="https://github.com/DrCuis/Technical/wiki/How_do_I_read_a_file_dragged_and_dropped_on_to_the_desktop">https://github.com/DrCuis/Technical/wiki/How_do_I_read_a_file_dragged_and_dropped_on_to_the_desktop</a></p>
    <p>to be developed into a HowTo document.</p>
    <p>--Hannes<br>
    </p>
    <p>--------------------------------------------------------------------------------------------------------------------------------------------------------<br>
    </p>
    <p>An example class <code>ReadDroppedFile</code> which implements a
      method
      <code>readDocBookFromFileEntry: aFileEntry</code>
      which is called when a file with a name ending with <code>book.xml</code>
      is dropped onto the desktop.</p>
    <div
class="snippet-clipboard-content notranslate position-relative overflow-auto">
      <pre class="notranslate"><code>'From Cuis7.3 [latest update: #7102] on 9 May 2025 at 7:21:59 pm'!
!classDefinition: #ReadDroppedFile category: #MyFileDragAndDropExample!
Object subclass: #ReadDroppedFile
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        category: 'MyFileDragAndDropExample'!

"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!

!classDefinition: 'ReadDroppedFile class' category: #MyFileDragAndDropExample!
ReadDroppedFile class
        instanceVariableNames: ''!

!ReadDroppedFile class methodsFor: 'as yet unclassified' stamp: 'hjh 5/9/2025 19:07:40'!
fileReaderServicesForFileEntry: aFileName suffix: aSuffix


(aFileName name endsWith: 'book.xml') ifTrue: [
        
                ^ { self serviceReadDocBookFile } ].

        ^#()! !

!ReadDroppedFile class methodsFor: 'as yet unclassified' stamp: 'hjh 5/9/2025 19:20:23'!
readDocBookFromFileEntry: aFileEntry

Transcript show: aFileEntry name; cr! !

!ReadDroppedFile class methodsFor: 'as yet unclassified' stamp: 'hjh 5/9/2025 19:19:15'!
serviceReadDocBookFile


^ (SimpleServiceEntry
                provider: self 
                label: 'import as DocBook file'
                selector: #readDocBookFromFileEntry:
                description: 'import image as DocBook'
                buttonLabel: 'import DocBook'
                icon: #imageIcon
                ) argumentGetter: [ :fileList | fileList selectedFileEntry ]! !
</code></pre>
    </div>
    <pre class="notranslate"><code>
</code></pre>
    <div class="zeroclipboard-container position-absolute right-0 top-0">
    </div>
  </body>
</html>