From VisualWorks®, 7.6 of February 8, 2008 on March 3, 2008 at 9:43:47 pm (Dialog confirm: 'You are filing-in a Parcel source file!\\While this is possible it will not have\the same effect as loading the parcel.\None of the Parcel''s prerequisites will\be loaded and none of its load actions\will be performed.\\Are you sure you want to file-in?' withCRs) ifFalse: [self error: 'Parcel file-in abandoned. Choose terminate or close.'] <name>FileTools</name> <environment>Tools</environment> <private>false</private> <imports> private Smalltalk.* </imports> <category>Tools-File Browser</category> <attributes> <package>Tools-File Browser</package> </attributes> <comment> Tools.FileTools
This name space contains the new, as of VW 7, tools for working with files, mostly the new file browser.
</comment> <class> <name>XMLSourceWalkerState</name> <environment>Tools.FileTools</environment> <super>Core.Object</super> <private>false</private> none walker tag <imports></imports> <category>Tools-File Browser</category> <attributes> <package>Tools-File Browser</package> </attributes> </class> <comment> Tools.FileTools.XMLSourceWalkerState
I represent a state of the source walker. I look at the open and close tags of elements passed by the walker as arguments of messages #start: and #end:, as well as at character data. My subclasses define these methods to do meaningful processing, such as collecting character data, grouping elements together, and eventually notifying the walker of the end of meaningful elements in the input. Subclasses must implement the following messages: dispatching end: start: Instance Variables: tag <String> The tag I am processing. walker <XMLSourceWalker> The walker I am working with.
</comment> <class> <name>XMLSourceWalkerTopState</name> <environment>Tools.FileTools</environment> <super>Tools.FileTools.XMLSourceWalkerState</super> <private>false</private> none <imports></imports> <category>Tools-File Browser</category> <attributes> <package>Tools-File Browser</package> </attributes> </class> <comment> Tools.FileTools.XMLSourceWalkerTopState
I represent the state the walker enters when it sees 'st-source' tag in the initial state: the top level of a Smalltalk fileout document.
</comment> <class> <name>XMLSourceWalkerAccumulatorState</name> <environment>Tools.FileTools</environment> <super>Tools.FileTools.XMLSourceWalkerState</super> <private>false</private> none characters nestLevel acceptSelector <imports></imports> <category>Tools-File Browser</category> <attributes> <package>Tools-File Browser</package> </attributes> </class> <comment> Tools.FileTools.XMLSourceWalkerAccumulatorState
I am an state that accumulates any and all character data it contains, including the data of elements contained by the current one. Any embedded elements are therefore silently ignored (but not their character contents). This is handy for reading method bodies, which may contain text emphasis tags. When the current element ends, I can invoke an arbitrary action of my walker. The action is initialized by the walker when it creates me. Instance Variables: characters <Stream> The stream accumulating the character data. acceptSelector <Symbol> A selector of a one-argument message. The message is sent to the walker with self as the argument when a close tag is encountered for the element whose data I am collecting. nestLevel <Integer> When accumulating data of contained elements, I use this variable to count nested elements with the same tag as myself, so that only my own close tag counts as the end of the element.
</comment> <class> <name>AbstractFileItem</name> <environment>Tools.FileTools</environment> <super>Core.Object</super> <private>false</private> none filename <imports></imports> <category>Tools-File Browser</category> <attributes> <package>Tools-File Browser</package> </attributes> </class> <comment> Tools.FileTools.AbstractFileItem
Instances of AbstractFileItem are used in the file browser views to represent various file entities, most notably files and directories. Instance Variables: filename <Filename> The platform-specific filename of the file system entity this item represents.
</comment> <class> <name>FileItem</name> <environment>Tools.FileTools</environment> <super>Tools.FileTools.AbstractFileItem</super> <private>false</private> none <imports></imports> <category>Tools-File Browser</category> <attributes> <package>Tools-File Browser</package> </attributes> </class> <comment> Tools.FileTools.FileItem
I represent a regular (i.e. not a directory) file.
</comment> <class> <name>FileViewer</name> <environment>Tools.FileTools</environment> <super>UI.ApplicationModel</super> <private>false</private> none browser <imports></imports> <category>Tools-File Browser</category> <attributes> <package>Tools-File Browser</package> </attributes> </class> <comment> Tools.FileTools.FileViewer
FileViewer is the abstract superclass of viewers: applications that display details of the currently selected file. All of them remember the browser they service, so that they can get information of the current selections, most often the channel that holds the current file selection. Whenever the current file selection changes, the viewer checks the current selection and then sends one of the two messages subclasses must implement: #updateForNoSelection or #updateFor: aFilename. Subclasses must implement the following messages: notifications updateFor: updateForNoSelection Instance Variables: browser <FileBrowser> The browser we are serving.
</comment> <class> <name>FileBlurbViewer</name> <environment>Tools.FileTools</environment> <super>Tools.FileTools.FileViewer</super> <private>false</private> none textHolder <imports></imports> <category>Tools-File Browser</category> <attributes> <package>Tools-File Browser</package> </attributes> </class> <comment> Tools.FileTools.FileBlurbViewer
I am an abstract superclass of simple viewers that display some formatted text to present a file. Subclasses should implement the message printBlurbFor:on: to print the text for a given file on the given text stream. Subclasses must implement the following messages: accessing printBlurbFor:on: Instance Variables: textHolder <ValueModel> The aspect of the text view that displays the blurb.
</comment> <class> <name>ParcelFileViewer</name> <environment>Tools.FileTools</environment> <super>Tools.FileTools.FileBlurbViewer</super> <private>false</private> none <imports></imports> <category>Tools-File Browser</category> <attributes> <package>Tools-File Browser</package> </attributes> </class> <comment> Tools.FileTools.ParcelFileViewer
This viewer displays the basic parcel file information: comment, various properties, as well as whether this parcel is loaded or not.
</comment> <class> <name>XMLSourceWalkerInitialState</name> <environment>Tools.FileTools</environment> <super>Tools.FileTools.XMLSourceWalkerState</super> <private>false</private> none <imports></imports> <category>Tools-File Browser</category> <attributes> <package>Tools-File Browser</package> </attributes> </class> <comment> Tools.FileTools.XMLSourceWalkerInitialState
I am the initial state of the source walker. I expect that a 'st-source' element should appear.
</comment> <class> <name>DirectorySelectionDialog</name> <environment>Tools.FileTools</environment> <super>UI.SimpleDialog</super> <private>false</private> none directoryTreeHolder initialDirectory <imports></imports> <category>Tools-Settings-UI</category> <attributes> <package>Tools-File Browser</package> </attributes> </class> <comment> Tools.FileTools.DirectorySelectionDialog
DirectorySelectionDialog is a dialog for selecting a directory in a tree. For now this is a simple implementation to quickly achieve that purpose. In future this class will be moved to the application with other reusable dialogs, but for now it is considered private to this application and subject to change without notice. Instance Variables: directoryTreeHolder <SelectionInList> The tree of DirectoryItems representing directories. initialDirectory <Filename> The directory to pre-select when the dialog opens.
</comment> <class> <name>TopLevelItem</name> <environment>Tools.FileTools</environment> <super>Core.Object</super> <private>false</private> none roots <imports></imports> <category>Tools-File Browser</category> <attributes> <package>Tools-File Browser</package> </attributes> </class> <comment> Tools.FileTools.TopLevelItem
VolumesNode is created for the purpose of serving as the root of the tree hierarchy. So its children are hardcoded to be the volumes available. The root is not displayed in the tree view, so its presentation is irrelevant. It would become relevant if it was decided to show it as an artificial node, à la "My Computer" in Windows.
</comment> <class> <name>SourceFormatter</name> <environment>Tools.FileTools</environment> <super>Core.Object</super> <private>false</private> none output currentEmphasis <imports></imports> <category>Tools-File Browser</category> <attributes> <package>Tools-File Browser</package> </attributes> </class> <comment> Tools.FileTools.SourceFormatter
I produce a formatted representation of the XML fileout. The output is supposed to be readable rather than executable, and therefore resembles code listings in the Blue Book more than it does the equivalent chunk fileouts. Instance Variables: output <TextStream> description of output streamStack <OrderedCollection> description of streamStack tagStack <OrderedCollection> description of tagStack
</comment> <class> <name>FileInformationViewer</name> <environment>Tools.FileTools</environment> <super>Tools.FileTools.FileBlurbViewer</super> <private>false</private> none <imports></imports> <category>Tools-File Browser</category> <attributes> <package>Tools-File Browser</package> </attributes> </class> <comment> Tools.FileTools.FileInformationViewer
This viewer displays the basic file information: size, creation and last modification dates, etc.
</comment> <class> <name>XMLTreeViewer</name> <environment>Tools.FileTools</environment> <super>Tools.FileTools.FileViewer</super> <private>false</private> none nodeTreeHolder textHolder <imports> private XML.* </imports> <category>Tools-File Browser</category> <attributes> <package>Tools-File Browser</package> </attributes> </class> <comment> Tools.FileTools.XMLTreeViewer
This viewer is an XML tree browser: it displays the tree of XML nodes of a file, with a text view to the right showing the currently selected node. Instance Variables: nodeTreeHolder <SelectionInList> The aspect of the XML tree view. textHolder <ValueModel> The aspect of the current node text view.
</comment> <class> <name>DirectoryItem</name> <environment>Tools.FileTools</environment> <super>Tools.FileTools.AbstractFileItem</super> <private>false</private> none cachedSubdirectoryItems <imports></imports> <category>Tools-File Browser</category> <attributes> <package>Tools-File Browser</package> </attributes> </class> <comment> Tools.FileTools.DirectoryItem
I represent a directory on the disk. I can report the files I contain, as well as my subdirectories.
</comment> <class> <name>XMLSourceWalkerNotification</name> <environment>Tools.FileTools</environment> <super>Core.Notification</super> <private>false</private> none state <imports></imports> <category>Tools-File Browser</category> <attributes> <package>Tools-File Browser</package> </attributes> </class> <comment> Tools.FileTools.XMLSourceWalkerNotification
I am a notification raised by a state when it encounters a state it does not expect to see. The unexpected state is ignored if this notification goes unclaimed. Instance Variables: state <XMLSourceWalkerState> The state the encountered an unexpected element.
</comment> <class> <name>XMLSourceViewer</name> <environment>Tools.FileTools</environment> <super>Tools.FileTools.FileViewer</super> <private>false</private> none textHolder <imports> private XML.* </imports> <category>Tools-File Browser</category> <attributes> <package>Tools-File Browser</package> </attributes> </class> <comment> Tools.FileTools.XMLSourceViewer
This viewer presents Smalltalk fileouts in XML form as readable formatted text. This instance collaborates with SourceFormatter and XMLSourceWalker to produce the formatted printout. Instance Variables: textHolder <ValueHolder> The aspect of the text view displaying the text.
</comment> <class> <name>FileContentsViewer</name> <environment>Tools.FileTools</environment> <super>Tools.FileTools.FileViewer</super> <private>false</private> none previewTextHolder fullTextHolder lastSubBuilder <imports></imports> <category>Tools-File Browser</category> <attributes> <package>Tools-File Browser</package> </attributes> </class> <comment> Tools.FileTools.FileContentsViewer
This viewer displays the file as text. However, unlike the blurb viewer, the amount of text displayed can be quite large, and the viewer protects against possible problems by showing large files in preview mode first. This viewer handles all issues related to managing the two modes; concrete subclasses should only implement methods #textForEntireFile: and #textForFileBeginning:. Subclasses must implement the following messages: private textForEntireFile: textForFileBeginning: Instance Variables: fullTextHolder <ValueModel> A model that supplies (and potentially accepts) the full file text for the TextEditor that displays it. lastSubBuilder <UIBuilder | nil> The UIBuilder last used to build the interface; used to give keyboard focus to a correct text widget in the subbuilder. previewTextHolder <ValueModel> A model that supplies the preview text of the file.
</comment> <class> <name>XMLSourceWalkerCollectorState</name> <environment>Tools.FileTools</environment> <super>Tools.FileTools.XMLSourceWalkerState</super> <private>false</private> none elements acceptSelector <imports></imports> <category>Tools-File Browser</category> <attributes> <package>Tools-File Browser</package> </attributes> </class> <comment> Tools.FileTools.XMLSourceWalkerCollectorState
I am a state used to process elements that contain other elements, tags and character content of which we are interested in. For example, a class definition element contains elements for things like the class name, superclass name, environment. A class definition element is processed by a collector state, which uses AccumulatorStates to process it sub-elements. Instance Variables: acceptSelector <Symbol> The selector of the message sent to the walker when the element processed by this state ends. elements <OrderedCollection of: XMLSourceWalkerAccumulatorState> States that processed the elements contained inside this element.
</comment> <class> <name>XMLSourceWalkerDefinitionState</name> <environment>Tools.FileTools</environment> <super>Tools.FileTools.XMLSourceWalkerCollectorState</super> <private>false</private> none <imports></imports> <category>Tools-File Browser</category> <attributes> <package>Tools-File Browser</package> </attributes> </class> <comment> Tools.FileTools.XMLSourceWalkerDefinitionState
I am a special kind of the Collector state. I recognize that one of my sub-elements, with the tag 'attributes', has to be processed with a Collector state, rather than with Accumulator states as all other sub-elements. I am used to process the three definition kinds found in file-outs: class, namespace, and shared variable.
</comment> <class> <name>XMLSourceWalker</name> <environment>Tools.FileTools</environment> <super>XML.SAXDriver</super> <private>false</private> none client currentTag states <imports></imports> <category>Tools-File Browser</category> <attributes> <package>Tools-File Browser</package> </attributes> </class> <comment> Tools.FileTools.XMLSourceWalker
I am a kind of SAX driver that performs semantic analysis on an XML tree, expected to be an XML Smalltalk fileout. When fileout elements such as class, namespace and method definitions are recognized, the 'client' object is notified by sending it messages. As of VW 7, the only client is SourceFormatter, which produces a nicely formatted printout of the text. Future application could be building out-of-the-image code objects, to allow browsers work on fileouts. While analyzing the input, the walker works as a more or less state machine, with the current state representing the element currently being parsed. The state takes care of figuring out what to do about elements and character data coming in from the parser. Instance Variables: client <Object> The object notified when parts of XML Smalltalk fileout are recognized currentTag <String> The last XML tag encountered by the SAX driver. states <OrderedCollection or: XMLSourceWalkerState> The stack of walk states; the topmost (last) state is the state that is currently processing input.
</comment> <class> <name>FileHexViewer</name> <environment>Tools.FileTools</environment> <super>Tools.FileTools.FileContentsViewer</super> <private>false</private> none <imports></imports> <category>Tools-File Browser</category> <attributes> <package>Tools-File Browser</package> </attributes> </class> <comment> Tools.FileTools.FileHexViewer
This viewer displays the file in the traditional hex (a.k.a. hacker) form. It is always read-only. UI specs are redefined to make the text view use fixed pitch font.
</comment> <class> <name>SpecialDirectoryItem</name> <environment>Tools.FileTools</environment> <super>Tools.FileTools.DirectoryItem</super> <private>false</private> none name avoidHasChildrenQuery <imports></imports> <category>Tools-File Browser</category> <attributes> <package>Tools-File Browser</package> </attributes> </class> <comment> Tools.FileTools.SpecialDirectoryItem
I represent a drive of those filesystems that have this concept, or a remote directory, i.e. a directory that is not to be found among the children of any of the root volumes, as reported by Filename of this image. One case when remote directories are used is under Windows, when the user requests to go to a directory on another machine, using "\\machine\volume" directory format. The target directory is then shown as a top-level item in the folder tree, and is represented with an instance of this class. This is necessary to avoid building a tree of a network drive, which may be extremely expensive. Instance variables: name <String | nil> if not nil, this rather than the underlying filename's tail is used as the displayString of the item, and appears in various lists. avoidHasChildrenQuery <Boolean> Items with this attribute set to true do not give a real answer to #hasChildren message and instead report true always. Such drives always show up in the directory tree as expandable. This is useful if the cost of query is too high.
</comment> <class> <name>FileBrowser</name> <environment>Tools.FileTools</environment> <super>UI.ApplicationModel</super> <private>false</private> none directoryTreeHolder patternChoices fileListHolder patternHolder fileSelectionChannel currentViewer statusTextRightHolder statusTextLeftHolder viewerListHolder menuBarHolder encodingChannel <imports></imports> <category>Tools-File Browser</category> <attributes> <package>Tools-File Browser</package> </attributes> </class> <comment> Tools.FileTools.FileBrowser
I am the core of the file browser implementation. I show the currently known directories as several trees in a tree view. Files of the selected directory that match the current pattern are displayed in a file list. A zoomable tabbed notebook of viewers shows all viewers that think they are able to display the currently selected file. When a tab is selected, an instance of a viewer class is created to service the client area of the notebook. The instance sends #fileSelectionChannel message to the browser to obtain a ValueHolder with the filename of the currently selected file. Instance Variables: currentViewer <FileViewer> An instance of a concrete subclass of FileViewer that is the current application serving the client area of the viewer notebook. directoryTreeHolder <SelectionInList> The aspect of the directory tree TreeView. fileListHolder <SelectionInList> The aspect of the file list ListView. fileSelectionChannel <ValueHolder on: Filename> The browser always puts the filename of the currently selected file into this ValueHolder. The current file viewer monitors this to update itself when selection changes. menuBarHolder <ValueHolder on: Menu> This ValueHolder contains the menu currently used for the window menu bar. patternChoices <ValueHolder on: List> A holder with the list of pattern choices visible when the pattern drop-down box is pulled down. patternHolder <ValueHolder on: String> A holder with the currently selected pattern. statusTextLeftHolder <ValueHolder on: Text> A holder on the text appearing in the left-hand portion of the status bar. statusTextRightHolder <ValueHolder on: Text> A holder on the text appearing in the right-hand portion of the status bar. viewerListHolder <SelectionInList> The aspect of the viewer tab control, holds the list of viewer classes available for the currently selected file, and the currently selected class. encodingChannel <ValueHolder on: Symbol> The encoding menu stores its selection here. Interested viewers may register for updates.
</comment> <class> <name>FileTextViewer</name> <environment>Tools.FileTools</environment> <super>Tools.FileTools.FileContentsViewer</super> <private>false</private> none originalFileTimestamp <imports></imports> <category>Tools-File Browser</category> <attributes> <package>Tools-File Browser</package> </attributes> </class> <comment> Tools.FileTools.FileTextViewer
This viewer displays the file as readable (or unreadable, as the case may be) text. When the viewer is in the full mode, it works as a file editor: modifying and accepting the text writes it out into the file. In the preview mode, the text displayed is read-only. Instance variables: originalFileTimestamp <Timestamp> Whenever a file is read in to be displayed, its modification timestamp is saved here. When a file is saved, we verify that its timestamp is still the same. If it isn't, the user should be warned.
</comment> <class> <name>DirectoryContentsViewer</name> <environment>Tools.FileTools</environment> <super>Tools.FileTools.FileBlurbViewer</super> <private>false</private> none <imports></imports> <category>Tools-File Browser</category> <attributes> <package>Tools-File Browser</package> </attributes> </class> <comment> Tools.FileTools.DirectoryContentsViewer
Work in progress.
</comment> <name>InitialSelectionPreference</name> <environment>Tools.FileTools.FileBrowser</environment> <private>false</private> <constant>false</constant> <category>preferences</category> <initializer>#default</initializer> <attributes> <package>Tools-File Browser</package> </attributes> <methods> Tools.FileTools.XMLSourceWalkerState <category>dispatching</category>
characters: aString "Any pcdata is silently ignored."
end: tagString self subclassResponsibility
start: tagString self subclassResponsibility
xmlComment: aString walker acceptXMLComment: aString
</methods> <methods> Tools.FileTools.XMLSourceWalkerState <category>initialize-release</category>
initialize: aWalker walker := aWalker. tag := walker currentTag
</methods> <methods> Tools.FileTools.XMLSourceWalkerState <category>accessing</category>
tag ^tag
</methods> <methods> Tools.FileTools.XMLSourceWalkerState <category>signalling</category>
signalUnexpectedElement: tagString XMLSourceWalkerNotification new state: self; messageText: (#UnexpectedElementColon << #dialogs >> 'Unexpected element: ') asString, tagString; raise
</methods> <methods> Tools.FileTools.XMLSourceWalkerState class <category>instance creation</category>
for: aFormatter ^self new initialize: aFormatter
</methods> <methods> Tools.FileTools.XMLSourceWalkerTopState <category>dispatching</category>
end: tagString tagString = 'st-source' ifTrue: [^walker leaveState]. self signalUnexpectedElement: tagString
start: tagString tagString = 'time-stamp' ifTrue: [^walker enterTimeStampState]. tagString = 'copyright' ifTrue: [^walker enterCopyrightState]. tagString = 'class' ifTrue: [^walker enterClassState]. tagString = 'name-space' ifTrue: [^walker enterNameSpaceState]. tagString = 'shared-variable' ifTrue: [^walker enterSharedVarState]. tagString = 'comment' ifTrue: [^walker enterCommentState]. tagString = 'methods' ifTrue: [^walker enterMethodsState]. tagString = 'initialize' ifTrue: [^walker enterInitializeState]. tagString = 'remove' ifTrue: [^walker enterRemoveState]. tagString = 'remove-selector' ifTrue: [^walker enterRemoveSelectorState]. tagString = 'rename' ifTrue: [^walker enterRenameState]. tagString = 'relocate' ifTrue: [^walker enterRelocateState]. tagString = 'reorganize' ifTrue: [^walker enterReorganizeState]. tagString = 'reorganize-data' ifTrue: [^walker enterReorganizeDataState]. tagString = 'do-it' ifTrue: [^walker enterDoItState]. self signalUnexpectedElement: tagString. ^walker enterBogusState
</methods> <methods> Tools.FileTools.XMLSourceWalkerAccumulatorState <category>initialize-release</category>
acceptSelector: aSymbol acceptSelector := aSymbol
initialize: aWalker super initialize: aWalker. characters := WriteStream on: (String new: 100). nestLevel := 0
</methods> <methods> Tools.FileTools.XMLSourceWalkerAccumulatorState <category>accessing</category>
contents ^characters contents
</methods> <methods> Tools.FileTools.XMLSourceWalkerAccumulatorState <category>dispatching</category>
characters: aString characters nextPutAll: aString
end: tagString "Any embedded tags are ignored and their contents are assimilated." tagString = tag ifTrue: [nestLevel = 0 ifTrue: [self leave] ifFalse: [nestLevel := nestLevel - 1]]
leave walker leaveState. acceptSelector notNil ifTrue: [walker perform: acceptSelector with: self]
start: tagString "Any embedded tags are ignored and their character data are accumulated." tagString = tag ifTrue: [nestLevel := nestLevel + 1]
</methods> <methods> Tools.FileTools.XMLSourceWalkerAccumulatorState class <category>instance creation</category>
for: aWalker acceptSelector: aSymbol ^(self for: aWalker) acceptSelector: aSymbol
</methods> <methods> Tools.FileTools.AbstractFileItem <category>comparing</category>
= anotherItem ^filename = anotherItem asFilename
hash ^filename hash
</methods> <methods> Tools.FileTools.AbstractFileItem <category>accessing</category>
baseLocation ^filename class readBaseLocationFromStream: filename asString readStream
children "Answer the children of this item." self subclassResponsibility
matches: patternString ^patternString match: filename tail
parent ^DirectoryItem on: self parentFilename
parentFilename ^filename directory
</methods> <methods> Tools.FileTools.AbstractFileItem <category>printing</category>
asString ^filename asString
asText ^self asString
displayString ^filename tail
printOn: aStream super printOn: aStream. aStream nextPutAll: ' ('; nextPutAll: filename asString; nextPutAll: ')'
</methods> <methods> Tools.FileTools.AbstractFileItem <category>converting</category>
asFilename ^filename
</methods> <methods> Tools.FileTools.AbstractFileItem <category>testing</category>
isDirectory self subclassResponsibility
</methods> <methods> Tools.FileTools.AbstractFileItem <category>initialize - release</category>
initialize: aPlatformFilename filename := aPlatformFilename
</methods> <methods> Tools.FileTools.AbstractFileItem <category>visuals</category>
icon self subclassResponsibility
</methods> <methods> Tools.FileTools.AbstractFileItem class <category>private</category>
isDirectory: aFilename ^[aFilename isDirectory] on: OsError "for special files" do: [:ex | ex return: false]
isDrive: aFilename ^OSHandle currentOS = #win32 and: [aFilename asString = aFilename head]
</methods> <methods> Tools.FileTools.AbstractFileItem class <category>instance creation</category>
on: aPlatformFilename self == AbstractFileItem ifFalse: [^self new initialize: aPlatformFilename]. (self isDrive: aPlatformFilename) ifTrue: [^SpecialDirectoryItem new initialize: aPlatformFilename]. ^(self isDirectory: aPlatformFilename) ifTrue: [DirectoryItem new initialize: aPlatformFilename] ifFalse: [FileItem new initialize: aPlatformFilename]
</methods> <methods> Tools.FileTools.FileItem <category>accessing</category>
children ^Array new
matches: patternString ^patternString match: filename tail
</methods> <methods> Tools.FileTools.FileItem <category>testing</category>
isDirectory ^false
</methods> <methods> Tools.FileTools.FileItem <category>visuals</category>
icon | tail | tail := filename tail. (#('*.st' '*.pst' '*.cha') anySatisfy: [:pattern | pattern match: tail]) ifTrue: [^ListIconLibrary visualFor: #textPage]. ('*.pcl' match: tail) ifTrue: [^ListIconLibrary visualFor: #loadedParcel]. ^ListIconLibrary visualFor: #blankPage
</methods> <methods> Tools.FileTools.FileViewer <category>initialize-release</category>
browser: aFileBrowser browser := aFileBrowser. browser fileSelectionChannel onChangeSend: #update to: self
postBuildWith: aBuilder super postBuildWith: aBuilder. self "adjustReadOnlyWidgetBackground: #text;" "still not sure we ought to do this" update
release super release. browser fileSelectionChannel retractInterestsFor: self
</methods> <methods> Tools.FileTools.FileViewer <category>notifications</category>
update | filename | Cursor wait showWhile: [filename := self selectedFilename. filename isNil ifTrue: [self updateForNoSelection] ifFalse: [self updateFor: filename]]
updateFor: aFilename "A file has been selected. Update whatever is needed to show it properly." self subclassResponsibility
updateForNoSelection "A file has been unselected, but I am still the current viewer. Update whatever is needed to show nothing properly." self subclassResponsibility
</methods> <methods> Tools.FileTools.FileViewer <category>actions</category>
debugIt self withTextViewControllerDo: [:controller | controller debugIt]
doIt self withTextViewControllerDo: [:controller | controller doIt]
inspectIt self withTextViewControllerDo: [:controller | controller inspectIt]
takeKeyboardFocus | wrapper | wrapper := self builder componentAt: #text. wrapper notNil ifTrue: [wrapper takeKeyboardFocus]
</methods> <methods> Tools.FileTools.FileViewer <category>private</category>
adjustReadOnlyWidgetBackground: aSymbol with: aBuilder "The default policy of giving distinguished backgrounds colors to read-only widgets looks bad in some cases. Change the specified widget to use regular text colors." | preferences | (aBuilder componentAt: aSymbol) ifNotNil: [:wrapper | preferences := LookPreferences new backgroundColor: SymbolicPaint textDataBackground asColorValue. preferences := preferences foregroundColor: SymbolicPaint textDataForeground asColorValue. wrapper widgetState colors: preferences]
selectedFilename ^browser fileSelectionChannel value
withTextViewControllerDo: aBlock | controller | builder notNil ifTrue: [controller := (builder componentAt: #text) widget controller. aBlock value: controller]
</methods> <methods> Tools.FileTools.FileViewer class <category>accessing</category>
isConcrete ^(self class includesSelector: #markedAsAbstractViewer) not
isInterestedInFile: aFilename self subclassResponsibility
markedAsAbstractViewer "This method is never executed and only serves as a flag to FileViewer>>isConcrete to indicate that this class should not be asked whether it can display a file."
tabLabel self subclassResponsibility
tabPosition self subclassResponsibility
</methods> <methods> Tools.FileTools.FileBlurbViewer <category>aspects</category>
textHolder "This method was generated by UIDefiner. Any edits made here may be lost whenever methods are automatically defined. The initialization provided below may have been preempted by an initialize method." ^textHolder isNil ifTrue: [textHolder := String new asValue] ifFalse: [textHolder]
</methods> <methods> Tools.FileTools.FileBlurbViewer <category>accessing</category>
printBlurbFor: aFilename on: stream self subclassResponsibility
</methods> <methods> Tools.FileTools.FileBlurbViewer <category>updating</category>
updateFor: aFilename | stream | stream := TextStream on: (String new: 100). self printBlurbFor: aFilename on: stream. self textHolder value: stream contents
updateForNoSelection self textHolder value: String new
</methods> <methods> Tools.FileTools.FileBlurbViewer class <category>accessing</category>
markedAsAbstractViewer "This method is never executed and only serves as a flag to FileViewer>>isConcrete to indicate that this class should not be asked whether it can display a file."
</methods> <methods> Tools.FileTools.ParcelFileViewer <category>private</category>
capitalized: aStringOrSymbol | copy | copy := aStringOrSymbol asString copy. copy at: 1 put: copy first asUppercase. ^copy
printComment: anArray on: aTextStream aTextStream nextPutAll: anArray first; cr; cr
printHeaderOn: aStream usingProperties: propertyCollection | name parcel version | name := propertyCollection detect: [:some | some key = #parcel] ifNone: ['' asValue]. version := propertyCollection detect: [:some | some key = #version] ifNone: ['' asValue]. aStream emphasis: #bold. (parcel := Parcel parcelNamed: name value) isNil ifTrue: [aStream nextPutAll: (#ThisParcelIsNotLoaded << #dialogs >> 'This parcel is not loaded') asString; cr; cr] ifFalse: [parcel version = version value ifTrue: [aStream nextPutAll: (#ThisParcelIsLoaded << #dialogs >> 'This parcel is loaded') asString; cr; cr] ifFalse: [aStream nextPutAll: ((#DifferentVersion1sIsLoaded << #dialogs >> 'A different version (<1s>) of this parcel is loaded') expandMacrosWith: parcel version); cr; cr]]. aStream emphasis: nil
printPrerequisites: anOrderedCollection on: aTextStream aTextStream emphasis: #bold; nextPutAll: (#PrerequisitesColon << #labels >> 'Prerequisites: ') asString; emphasis: nil; space. anOrderedCollection isEmpty ifTrue: [aTextStream nextPutAll: (#noneBracket << #labels >> '<none>') asString]. anOrderedCollection do: [:eachPair | | name | name := eachPair first. (Parcel parcelNamed: name) notNil ifTrue: [aTextStream emphasis: #bold]. aTextStream nextPutAll: name; emphasis: nil] separatedBy: [aTextStream nextPutAll: ', ']. aTextStream cr
printProperties: propertyCollection on: aTextStream propertyCollection do: [:each | self printProperty: each key value: each value on: aTextStream]
printProperty: aSymbol value: anObject on: aTextStream aSymbol = #comment ifTrue: [^self printComment: anObject on: aTextStream]. aSymbol = #prerequisiteParcels ifTrue: [^self printPrerequisites: anObject on: aTextStream]. aTextStream emphasis: #bold; nextPutAll: (self capitalized: aSymbol); nextPutAll: ': '; emphasis: nil; print: anObject; cr
propertiesFrom: aFilename | properties propertyItems commentItem | properties := [CodeReader new readInfoFromFileNamed: aFilename] on: OsError, CodeReader fileFormatSignal do: [:ex | ex return: Dictionary new]. propertyItems := SortedCollection sortBlock: [:a :b | a key <= b key]. properties keysAndValuesDo: [:key :value | propertyItems add: key -> value]. propertyItems := propertyItems asOrderedCollection. commentItem := propertyItems detect: [:some | some key = 'comment'] ifNone: []. commentItem notNil ifTrue: [propertyItems remove: commentItem. propertyItems addFirst: commentItem]. ^propertyItems
</methods> <methods> Tools.FileTools.ParcelFileViewer <category>accessing</category>
printBlurbFor: aFilename on: aTextStream | properties | properties := self propertiesFrom: aFilename. properties isEmpty ifTrue: [^aTextStream emphasis: #italic; nextPutAll: (#CannotRetrieveProperties << #dialogs >> 'Cannot retrieve parcel properties') asString]. self printHeaderOn: aTextStream usingProperties: properties; printProperties: properties on: aTextStream
</methods> <methods> Tools.FileTools.ParcelFileViewer class <category>accessing</category>
isInterestedInFile: aFilename ^'*.pcl' match: aFilename tail
tabLabel ^(#ParcelInformation << #labels >> 'Parcel Information') asString
tabPosition ^5
</methods> <methods> Tools.FileTools.XMLSourceWalkerInitialState <category>dispatching</category>
end: tagString self signalUnexpectedElement: tagString
start: tagString tagString = 'st-source' ifTrue: [^walker enterTopLevelState]. self signalUnexpectedElement: tagString
</methods> <methods> Tools.FileTools.DirectorySelectionDialog <category>notifications</category>
directorySelectionChanged (self wrapperAt: #okButton) isEnabled: self selection notNil
directoryTreeDoubleClicked self accept value: true
</methods> <methods> Tools.FileTools.DirectorySelectionDialog <category>initialize-release</category>
initialDirectory: aFilename initialDirectory := aFilename
initialize super initialize. initialDirectory := Filename defaultDirectory. self reloadDirectories
postBuildWith: aBuilder super postBuildWith: aBuilder. self setupDirectoryTreeWidget; directorySelectionChanged
postOpenWith: aBuilder super postOpenWith: aBuilder. initialDirectory notNil ifTrue: [self selectDirectory: initialDirectory]
</methods> <methods> Tools.FileTools.DirectorySelectionDialog <category>private</category>
reloadDirectories | model | model := TreeModel on: TopLevelItem current displayRoot: false. model hasChildrenBlock: [:item | item hasChildren]. self directoryTreeHolder list: model
setupDirectoryTreeWidget self directoryTreeHolder selectionIndexHolder onChangeSend: #directorySelectionChanged to: self. ^(builder componentAt: #directoryTree) widget useImage: #folderTreeIcon selectedImage: #folderTreeSelectedIcon
</methods> <methods> Tools.FileTools.DirectorySelectionDialog <category>accessing</category>
expandToDirectory: directoryFilename | target path treeModel lastExpanded | target := DirectoryItem on: directoryFilename. path := target parentDirectories. treeModel := self directoryTreeHolder list. lastExpanded := nil. Cursor wait showWhile: [path do: [:each | | index | index := treeModel indexOf: each. index = 0 ifTrue: [^lastExpanded]. treeModel expand: index. lastExpanded := each]]. ^target
selectDirectory: directoryFilename | lastKnownDirectoryItem | lastKnownDirectoryItem := self expandToDirectory: directoryFilename. self directoryTreeHolder selection: lastKnownDirectoryItem
selection ^self directoryTreeHolder selection
</methods> <methods> Tools.FileTools.DirectorySelectionDialog <category>aspects</category>
directoryTreeHolder "This method was generated by UIDefiner. Any edits made here may be lost whenever methods are automatically defined. The initialization provided below may have been preempted by an initialize method." ^directoryTreeHolder isNil ifTrue: [directoryTreeHolder := SelectionInTree new] ifFalse: [directoryTreeHolder]
</methods> <methods> Tools.FileTools.DirectorySelectionDialog <category>testing</category>
directorySelected ^self selection notNil
</methods> <methods> Tools.FileTools.DirectorySelectionDialog <category>actions</category>
createSubdirectory | newName newFilename directory | newName := Dialog request: (#NewDirectoryNameColon << #dialogs >> 'New directory name:'). newName isEmpty ifTrue: [^self]. directory := self selection. newFilename := directory asFilename construct: newName. newFilename makeDirectory. directory refresh. self directoryTreeHolder list refresh: directory. self selectDirectory: newFilename
</methods> <methods> Tools.FileTools.DirectorySelectionDialog class <category>utilities</category>
choose "Open a new instance with the current directory pre-selected. Answer a filename with the user's selection or nil if the dialog was cancelled." "self choose" ^self chooseInitially: Filename defaultDirectory
chooseInitially: aFilenameOrString "Open a new instance with the given directory pre-selected. Answer a filename with the user's selection or nil if the dialog was cancelled." | instance | instance := self new. instance initialDirectory: aFilenameOrString asFilename. ^instance open ifTrue: [instance selection asString] ifFalse: [nil]
</methods> <methods> Tools.FileTools.TopLevelItem <category>accessing</category>
add: anItem roots := roots copyWith: anItem
children ^roots
hasChildren ^roots notEmpty
</methods> <methods> Tools.FileTools.TopLevelItem <category>initialize-release</category>
roots: aCollection roots := aCollection
</methods> <methods> Tools.FileTools.TopLevelItem class <category>private</category>
sorted: itemCollection ^(itemCollection asSortedCollection: [:a :b | a displayString <= b displayString]) asArray
</methods> <methods> Tools.FileTools.TopLevelItem class <category>instance creation</category>
current "self current" | volumeItems | volumeItems := Filename volumes collect: (OSHandle currentOS = #win32 "On Windows short-cut file-system attribute collection for speed. We don't need it here." ifTrue: [[:each | SpecialDirectoryItem on: (FATFilename new named: each asLowercase)]] ifFalse: [[:each | DirectoryItem on: (Filename named: each)]]). ^self new roots: (self sorted: volumeItems)
</methods> <methods> Tools.FileTools.SourceFormatter <category>private</category>
asReadableName: tagString "Convert an XML tag string into a readable name." tagString = 'class-id' ifTrue: [^(#class << #dialogs >> 'class') asString]. ^tagString
isSpecified: aStringOrNil ^aStringOrNil notNil and: [aStringOrNil trimBlanks isEmpty not]
mergedEmphasis: emphasis currentEmphasis isNil ifTrue: [^emphasis]. ^(currentEmphasis isKindOf: Array) ifTrue: [(emphasis isKindOf: Array) ifTrue: [emphasis, currentEmphasis] ifFalse: [currentEmphasis copyWith: emphasis]] ifFalse: [(emphasis isKindOf: Array) ifTrue: [emphasis copyWith: currentEmphasis] ifFalse: [Array with: emphasis with: currentEmphasis]]
printIndentedLabel: aUserMessageOrString object: anObject output tab; emphasis: #italic; nextPutAll: aUserMessageOrString asString; nextPutAll: ':'; emphasis: nil; space; print: anObject; cr
printIndentedLabel: aUserMessageOrString string: anotherString output tab; emphasis: #italic; nextPutAll: aUserMessageOrString asString; nextPutAll: ':'; emphasis: nil; space; nextPutAll: anotherString; cr
printMethod: aString inClassNamed: nameString | sourceText | sourceText := aString asText makeSelectorBoldIn: (self targetClassForName: nameString). output nextPutAllText: sourceText; cr; cr
targetClassForName: nameString ^[nameString asQualifiedReference value] on: Error do: [:ex | ex return: Object]
withEmphasis: emphasis do: aBlock | oldEmphasis | oldEmphasis := currentEmphasis. currentEmphasis := self mergedEmphasis: emphasis. ^[output emphasis: currentEmphasis. aBlock value] ensure: [currentEmphasis := oldEmphasis. output emphasis: currentEmphasis]
</methods> <methods> Tools.FileTools.SourceFormatter <category>writing</category>
break output cr; cr
cr output cr
print: anObject "Print an object with the current emphasis." output print: anObject
space output space
tab output tab
write: aStringOrNil "Write a string with the current emphasis; treat nils as blanks." aStringOrNil notNil ifTrue: [output nextPutAll: aStringOrNil asString]
</methods> <methods> Tools.FileTools.SourceFormatter <category>initialize-release</category>
output: aWriteStream output := aWriteStream. currentEmphasis := nil
</methods> <methods> Tools.FileTools.SourceFormatter <category>accepting</category>
acceptClass: nameString superclass: superString environment: envStringOrNil private: privateStringOrNil indexedType: typeString instVars: varStringOrNil classInstVars: classVarStringOrNil imports: importsStringOrNil attributes: attributesArrayOrNil | fullName | fullName := (self isSpecified: envStringOrNil) ifTrue: [envStringOrNil, '.', nameString] ifFalse: [nameString]. self withEmphasis: #underline do: [self write: (#Class << #dialogs >> 'Class '). self withEmphasis: #bold do: [self write: fullName]]. self break. self printIndentedLabel: (#Superclass << #dialogs >> 'Superclass') string: superString; printIndentedLabel: (#Type << #dialogs >> 'Type') string: typeString. (self isSpecified: varStringOrNil) ifTrue: [self printIndentedLabel: (#InstanceVariables << #dialogs >> 'Instance variables') string: varStringOrNil]. (self isSpecified: classVarStringOrNil) ifTrue: [self printIndentedLabel: (#ClassInstanceVariables << #dialogs >> 'Class instance variables') string: classVarStringOrNil]. (self isSpecified: importsStringOrNil) ifTrue: [self printIndentedLabel: (#Imports << #dialogs >> 'Imports') string: importsStringOrNil]. attributesArrayOrNil notNil ifTrue: [self printIndentedLabel: (#Attributes << #dialogs >> 'Attributes') object: attributesArrayOrNil]. self cr
acceptComment: aString of: tagString named: nameString self withEmphasis: #underline do: [self withEmphasis: #bold do: [self write: nameString]. self write: (#Comment << #dialogs >> ' comment') asString]. self break; write: aString; break
acceptCopyright: aString self write: (#CopyrightC << #dialogs >> 'Copyright: '); write: aString; break
acceptDoIt: sourceString self withEmphasis: #(bold underline) do: [self write: (#DoIt << #labels >> 'Do It')]; break; write: sourceString; break
acceptGeneralComment: aString self withEmphasis: #italic do: [self write: aString]; cr
acceptInitialize: aString ofType: tagString self withEmphasis: #italic do: [self write: (#Initialize << #dialogs >> 'Initialize '); write: (self asReadableName: tagString); space; withEmphasis: #bold do: [self write: aString]]. self break
acceptMethodsFor: classNameString properties: propertyDictionary bodies: stringCollection | protocol | protocol := propertyDictionary at: 'category' ifAbsent: [nil]. self withEmphasis: #underline do: [self withEmphasis: #bold do: [self write: classNameString]; write: (protocol isNil ifTrue: [(#Methods1 << #dialogs >> ' methods')] ifFalse: [((#MethodsFor1s << #dialogs >> ' methods for ''<1s>''') expandMacrosWith: protocol)]); break]. stringCollection do: [:each | self printMethod: each inClassNamed: classNameString]
acceptNameSpace: nameString environment: envStringOrNil private: privateStringOrNil imports: importsStringOrNil attributes: attributesArrayOrNil | fullName private | fullName := (self isSpecified: envStringOrNil) ifTrue: [envStringOrNil, '.', nameString] ifFalse: [nameString]. self withEmphasis: #underline do: [self write: (#Namespace << #dialogs >> 'Namespace '); withEmphasis: #bold do: [self write: fullName]]. self break. private := (privateStringOrNil isNil or: [privateStringOrNil trimBlanks isEmpty]) ifTrue: ['false'] ifFalse: [privateStringOrNil]. self printIndentedLabel: (#Private << #dialogs >> 'Private') string: private. (self isSpecified: importsStringOrNil) ifTrue: [self printIndentedLabel: (#Imports << #dialogs >> 'Imports') string: importsStringOrNil]. attributesArrayOrNil notNil ifTrue: [self printIndentedLabel: (#Attributes << #dialogs >> 'Attributes') object: attributesArrayOrNil]. self cr
acceptRelocate: objectNameString to: environmentString self withEmphasis: #italic do: [self write: (#Move << #dialogs >> 'Move '); withEmphasis: #bold do: [self write: (self asReadableName: objectNameString)]; write: (#ToNamespace << #dialogs >> ' to namespace '); withEmphasis: #bold do: [self write: environmentString]; break]
acceptRemove: aString ofType: tagString self withEmphasis: #italic do: [self write: (#Remove << #dialogs >> 'Remove '); write: (self asReadableName: tagString); space; withEmphasis: #bold do: [self write: aString]]. self break
acceptRemoveSelector: aString inClass: classNameString self withEmphasis: #italic do: [self write: (#RemoveMethod << #dialogs >> 'Remove method '); withEmphasis: #bold do: [self write: classNameString; write: '>>'; write: aString]]. self break
acceptRename: objectNameString to: newNameString self withEmphasis: #italic do: [self write: (#Rename1 << #dialogs >> 'Rename '); withEmphasis: #bold do: [self write: objectNameString]; write: (#To << #dialogs >> ' to '); withEmphasis: #bold do: [self write: newNameString]]. self break
acceptReorganize: classNameString using: organizationString self withEmphasis: #italic do: [self write: (#ReorganizeClass << #dialogs >> 'Reorganize class '); withEmphasis: #bold do: [self write: classNameString]]. self break
acceptReorganizeData: classNameString using: organizationString self withEmphasis: #italic do: [self write: (#Reorganize << #dialogs >> 'Reorganize '); withEmphasis: #bold do: [self write: classNameString]]. self break
acceptSharedVar: nameString environment: envString private: privateStringOrNil constant: constantStringOrNil initializer: initializerStringOrNil attributes: attributesArrayOrNil | fullName private constant | fullName := envString, '.', nameString. self withEmphasis: #underline do: [self write: (#SharedVariable << #dialogs >> 'Shared Variable '); withEmphasis: #bold do: [self write: fullName]]. self break. private := (privateStringOrNil isNil or: [privateStringOrNil trimBlanks isEmpty]) ifTrue: ['false'] ifFalse: [privateStringOrNil]. self printIndentedLabel: (#Private << #dialogs >> 'Private') string: private. constant := (constantStringOrNil isNil or: [constantStringOrNil trimBlanks isEmpty]) ifTrue: ['false'] ifFalse: [constantStringOrNil]. self printIndentedLabel: (#Constant << #dialogs >> 'Constant') string: constant. (self isSpecified: initializerStringOrNil) ifTrue: [self printIndentedLabel: (#Initializer << #dialogs >> 'Initializer') object: initializerStringOrNil]. attributesArrayOrNil notNil ifTrue: [self printIndentedLabel: (#Attributes << #dialogs >> 'Attributes') object: attributesArrayOrNil]. self cr
acceptTimeStamp: aString self withEmphasis: #bold do: [self write: aString]; break
</methods> <methods> Tools.FileTools.SourceFormatter class <category>instance creation</category>
on: aWriteStream ^self new output: aWriteStream
</methods> <methods> Tools.FileTools.FileInformationViewer <category>accessing</category>
print: aString value: aBlock on: aStream | value | value := [aBlock value] on: Error do: [:ex | ex return: '?']. aStream emphasis: #bold; nextPutAll: aString asString; emphasis: nil; nextPutAll: ':'; tab; nextPutAll: value; cr
printBlurbFor: aFilename on: stream self print: (#Path << #labels >> 'Path') value: [aFilename asString] on: stream; print: (#Size << #labels >> 'Size') value: [aFilename fileSize printString] on: stream; print: (#Created << #labels >> 'Created') value: [self timestampStringAt: #created in: aFilename dates] on: stream; print: (#LastModified << #labels >> 'Last modified') value: [self timestampStringAt: #modified in: aFilename dates] on: stream; print: (#LastAccessed << #labels >> 'Last accessed') value: [self timestampStringAt: #accessed in: aFilename dates] on: stream
timestampStringAt: aSymbol in: aDictionary | array | array := aDictionary at: aSymbol. ^array first printString, ' ', array last printString
</methods> <methods> Tools.FileTools.FileInformationViewer class <category>accessing</category>
isInterestedInFile: aFilename ^true
tabLabel ^(#FileInformation << #labels >> 'File Information') asString
tabPosition ^100
</methods> <methods> Tools.FileTools.XMLTreeViewer <category>initialize-release</category>
initialize super initialize. textHolder := (AspectAdaptor forAspect: #noIndentPrintString) subjectChannel: self nodeTreeHolder selectionHolder; yourself
postBuildWith: aBuilder | treeView | super postBuildWith: aBuilder. "treeView := (aBuilder componentAt: #nodeTree) widget. treeView controller expandFullyRoot"
</methods> <methods> Tools.FileTools.XMLTreeViewer <category>private</category>
childrenOf: anXMLNode ^[anXMLNode children reject: [:some | some isText]] on: Error do: [:ex | ex return: #()]
parseXMLFrom: aFilename | document tree | document := XMLParser processDocumentInFilename: aFilename beforeScanDo: [:parser | parser validate: false]. self nodeTreeHolder list: (TreeModel on: document displayRoot: false childrenWith: [:node | self childrenOf: node]). tree := self nodeTreeHolder list. tree size to: 1 by: -1 do: [:index | tree expand: index]
updateFor: aFilename [self parseXMLFrom: aFilename] on: MalformedSignal do: [ :ex | "Ignore malformed errors caused by missing endtags. Would be nice to be more selective about the errors that get muffled, but the parser lacks interface for that." ex getSignal = BadCharacterSignal ifTrue: [ex resume]. ex return].
updateForNoSelection self nodeTreeHolder list: TreeModel new
</methods> <methods> Tools.FileTools.XMLTreeViewer <category>aspects</category>
nodeTreeHolder "This method was generated by UIDefiner. Any edits made here may be lost whenever methods are automatically defined. The initialization provided below may have been preempted by an initialize method." ^nodeTreeHolder isNil ifTrue: [nodeTreeHolder := SelectionInTree new] ifFalse: [nodeTreeHolder]
textHolder "This method was generated by UIDefiner. Any edits made here may be lost whenever methods are automatically defined. The initialization provided below may have been preempted by an initialize method." ^textHolder isNil ifTrue: [textHolder := String new asValue] ifFalse: [textHolder]
</methods> <methods> Tools.FileTools.XMLTreeViewer <category>actions</category>
inspectNode ^self nodeTreeHolder selection inspect
</methods> <methods> Tools.FileTools.XMLTreeViewer class <category>private</category>
couldBeXMLFile: aFilename ^#('*.xml' '*.st' '*.pst' '*.cha' '*.sou' '*.wsdl') anySatisfy: [:some | some match: aFilename tail]
isInterestedInFile: aFilename ^(self couldBeXMLFile: aFilename) and: [self startsAsXML: aFilename]
startsAsXML: aFilename | stream | ^[stream := aFilename readStream. [(stream next: 5) sameAs: '<?xml'] ensure: [stream close]] on: Error do: [:ex | ex return: false]
</methods> <methods> Tools.FileTools.XMLTreeViewer class <category>accessing</category>
tabLabel ^(#XMLTree << #labels >> 'XML Tree') asString
tabPosition ^70
</methods> <methods> Tools.FileTools.DirectoryItem <category>testing</category>
hasAnyChildren ^self subdirectoryItems isEmpty not or: [self fileItems isEmpty not]
hasChildren ^cachedSubdirectoryItems isNil ifTrue: [self privateHasSubdirectories] ifFalse: [cachedSubdirectoryItems notEmpty]
isDirectory ^true
</methods> <methods> Tools.FileTools.DirectoryItem <category>private</category>
privateHasSubdirectories "As constructing Filenames is an expensive operation, there is much speed to gain if we only do it until we encounter the first child directory." ^self directoryContents anySatisfy: [:filenameString | [(filename constructSafe: filenameString) isDirectory] on: OsError do: [:ex | ex return: false]]
retrieveSubdirectoryItems cachedSubdirectoryItems := self subdirectoryFilenames collect: [:each | DirectoryItem on: each]
</methods> <methods> Tools.FileTools.DirectoryItem <category>files</category>
directoryContents | names | names := [filename directoryContents] on: OsError do: [:ex | ex return: Array new]. ^names asSortedCollection asArray
directoryContentsFilenames ^self directoryContents collect: [:each | filename constructSafe: each]
fileFilenames ^self directoryContentsFilenames select: [:each | [each isDirectory not] on: OsError "special files signal it" do: [:ex | ex return: true]]
fileItems ^self fileFilenames collect: [:each | FileItem on: each]
fileItemsMatching: patternString | patterns | patterns := (patternString tokensBasedOn: $,) collect: [:each | each trimBlanks]. (patterns size = 1 and: [patterns first isEmpty]) ifTrue: [patterns := #('*')]. ^self fileItems select: [:each | patterns anySatisfy: [:any | each matches: any]]
</methods> <methods> Tools.FileTools.DirectoryItem <category>subdirectories</category>
children "This one, as opposed to #subdirectoryItems, is used in the UI so we are sure we want to display a busy cursor while doing it." ^Cursor wait showWhile: [self subdirectoryItems]
parentDirectories "Answer a collection of DirectoryItems representing all directories from the root of the filesystem (or my drive) to myself, beginning with the root." | parent | parent := self parent. ^parent = self ifTrue: [Array new] ifFalse: [parent withParentDirectories]
refresh cachedSubdirectoryItems := nil
subdirectoryFilenames ^self directoryContentsFilenames select: [:each | [each isDirectory] on: Error "special files signal it" do: [:ex | ex returnWith: false]]
subdirectoryItems cachedSubdirectoryItems isNil ifTrue: [self retrieveSubdirectoryItems]. ^cachedSubdirectoryItems
subdirectoryItemsMatching: patternString | patterns | patterns := (patternString tokensBasedOn: $,) collect: [:each | each trimBlanks]. (patterns size = 1 and: [patterns first isEmpty]) ifTrue: [patterns := #('*')]. ^self subdirectoryItems select: [:each | patterns anySatisfy: [:any | each matches: any]]
withParentDirectories "Answer a collection of DirectoryItems representing all directories from the root of the filesystem (or my drive) to myself, beginning with the root." | parent | parent := self parent. ^parent = self ifTrue: [Array with: self] ifFalse: [parent withParentDirectories copyWith: self]
</methods> <methods> Tools.FileTools.DirectoryItem <category>visuals</category>
folderTreeIcon ^TreeView closedFolder
folderTreeSelectedIcon ^TreeView openedFolder
icon ^TreeView closedFolder
</methods> <methods> Tools.FileTools.DirectoryItem class <category>testing</category>
example "self example" ^DirectoryItem on: 'c:\pps\' asFilename
</methods> <methods> Tools.FileTools.XMLSourceWalkerNotification <category>accessing</category>
state ^state
state: anObject state := anObject
</methods> <methods> Tools.FileTools.XMLSourceViewer <category>private</category>
parseXMLFrom: aFilename writingTo: output XMLParser processDocumentInFilename: aFilename beforeScanDo: [:parser | parser saxDriver: (XMLSourceWalker on: (SourceFormatter on: output)). parser validate: false]
updateFor: aFilename | output | output := TextStream on: (String new: 100). [self parseXMLFrom: aFilename writingTo: output] on: MalformedSignal do: [ :ex | "Ignore malformed errors caused by missing endtags. Would be nice to be more selective about the errors that get muffled, but the parser lacks interface for that." ex getSignal = BadCharacterSignal ifTrue: [ex resume]. ex return]. self textHolder value: output contents
updateForNoSelection self textHolder value: String new
</methods> <methods> Tools.FileTools.XMLSourceViewer <category>aspects</category>
textHolder "This method was generated by UIDefiner. Any edits made here may be lost whenever methods are automatically defined. The initialization provided below may have been preempted by an initialize method." ^textHolder isNil ifTrue: [textHolder := String new asValue] ifFalse: [textHolder]
</methods> <methods> Tools.FileTools.XMLSourceViewer <category>interface opening</category>
postBuildWith: aBuilder super postBuildWith: aBuilder. self adjustReadOnlyWidgetBackground: #text with: aBuilder
</methods> <methods> Tools.FileTools.XMLSourceViewer class <category>accessing</category>
isInterestedInFile: aFilename ^(self looksLikeSourceFilename: aFilename) and: [self startsAsXMLSource: aFilename]
looksLikeSourceFilename: aFilename ^#('*.st' '*.pst' '*.cha') anySatisfy: [:some | some match: aFilename tail]
startsAsXMLSource: aFilename | stream | ^[stream := aFilename readStream. [(stream next: 5) sameAs: '<?xml'] ensure: [stream close]] on: Error do: [:ex | ex return: false]
tabLabel ^(#FormattedSource << #labels >> 'Formatted Source') asString
tabPosition ^50
</methods> <methods> Tools.FileTools.FileContentsViewer <category>text</category>
fullTextHolder ^fullTextHolder
previewText | filename | filename := self selectedFilename. ^filename isNil ifTrue: [String new] ifFalse: [self textForFileBeginning: filename]
previewText: text ^false
previewTextHolder ^previewTextHolder
text | filename | filename := self selectedFilename. ^filename isNil ifTrue: [String new] ifFalse: [self textForEntireFile: filename]
text: aText ^true
</methods> <methods> Tools.FileTools.FileContentsViewer <category>private</category>
canDisplay: aFilename ^[aFilename isDirectory not and: [aFilename isReadable]] on: OsError do: [:ex | ex return: false]
largeFileMessage | sizeInK | sizeInK := self largeFileThreshold // 1000. ^(#largeFileShowingFirst << #labels >> 'Only <1p>K bytes of file contents are currently shown; use this to view entire file') expandMacrosWith: sizeInK
largeFileThreshold "Files larges than this number of bytes are displayed in preview mode first." ^50000
showFullInterface (builder componentAt: #view) widget client:self spec: #fullTextSpec builder: (lastSubBuilder := builder newSubBuilder)
showPreviewInterface (builder componentAt: #view) widget client:self spec: #previewSpec builder: (lastSubBuilder := builder newSubBuilder)
textForEntireFile: aFilename self subclassResponsibility
textForFileBeginning: aFilename self subclassResponsibility
withTextViewControllerDo: aBlock | controller | lastSubBuilder notNil ifTrue: [controller := (lastSubBuilder componentAt: #text) widget controller. aBlock value: controller]
</methods> <methods> Tools.FileTools.FileContentsViewer <category>initialize-release</category>
initialize super initialize. previewTextHolder := (PluggableAdaptor on: self) getSelector: #previewText putSelector: #previewText:. fullTextHolder := (PluggableAdaptor on: self) getSelector: #text putSelector: #text:
postBuildViewWith: aBuilder | controller | controller := (aBuilder componentAt: #text) widget controller. self adjustReadOnlyWidgetBackground: #text with: aBuilder. (controller respondsTo: #autoAccept:) ifTrue: [controller autoAccept: false]
postBuildWith: aBuilder "Only do the postBuild stuff if the builder is the same as the original one. Otherwise it means we've just built a subcanvas." aBuilder = builder ifTrue: [super postBuildWith: aBuilder] ifFalse: [self postBuildViewWith: aBuilder]
preBuildWith: aBuilder aBuilder labelAt: #largeFileMessage put: self largeFileMessage
</methods> <methods> Tools.FileTools.FileContentsViewer <category>actions</category>
loadEntireFile Cursor wait showWhile: [self showFullInterface]. self takeKeyboardFocus
takeKeyboardFocus | wrapper | lastSubBuilder notNil ifTrue: [wrapper := lastSubBuilder componentAt: #text. wrapper notNil ifTrue: [wrapper takeKeyboardFocus]]
</methods> <methods> Tools.FileTools.FileContentsViewer <category>updating</category>
okToSaveTextFor: aController ^true
updateFor: aFilename (self canDisplay: aFilename) ifTrue: [aFilename fileSize > self largeFileThreshold ifTrue: [self showPreviewInterface] ifFalse: [self showFullInterface]]
updateForNoSelection self showFullInterface
</methods> <methods> Tools.FileTools.FileContentsViewer class <category>accessing</category>
isInterestedInFile: aFilename ^[aFilename isDirectory not] on: OsError do: [:ex | ex return: false]
markedAsAbstractViewer "This method is never executed and only serves as a flag to FileViewer>>isConcrete to indicate that this class should not be asked whether it can display a file."
</methods> <methods> Tools.FileTools.XMLSourceWalkerCollectorState <category>initialize-release</category>
acceptSelector: aSymbol acceptSelector := aSymbol
initialize: aWalker super initialize: aWalker. elements := OrderedCollection new
</methods> <methods> Tools.FileTools.XMLSourceWalkerCollectorState <category>accessing</category>
contentsAt: aString ^(self elementWithTag: aString) contents
contentsAt: aString ifAbsent: aBlock ^(self elementWithTag: aString ifAbsent: [^aBlock value]) contents
contentsOrBlankAt: aString ^self contentsAt: aString ifAbsent: [String new]
elements ^elements
elementWithTag: aString ^elements detect: [:some | some tag = aString]
elementWithTag: aString ifAbsent: aBlock ^elements detect: [:some | some tag = aString] ifNone: aBlock
</methods> <methods> Tools.FileTools.XMLSourceWalkerCollectorState <category>dispatching</category>
end: tagString tagString = tag ifTrue: [walker leaveState. acceptSelector notNil ifTrue: [walker perform: acceptSelector with: self]]
start: tagString walker enterAccumulatorState. elements add: walker currentState
</methods> <methods> Tools.FileTools.XMLSourceWalkerCollectorState class <category>instance creation</category>
for: aWalker acceptSelector: aSymbol ^(self for: aWalker) acceptSelector: aSymbol
</methods> <methods> Tools.FileTools.XMLSourceWalkerDefinitionState <category>dispatching</category>
start: tagString tagString = 'attributes' ifTrue: [walker enterCollectorState] ifFalse: [walker enterAccumulatorState]. elements add: walker currentState
</methods> <methods> Tools.FileTools.XMLSourceWalker <category>states-entering</category>
enterAccumulatorState self enterState: (XMLSourceWalkerAccumulatorState for: self)
enterBogusState "The state that silently consumes the current and all contained tags." self enterState: (XMLSourceWalkerAccumulatorState for: self)
enterClassState self enterState: (XMLSourceWalkerDefinitionState for: self acceptSelector: #leftClass:)
enterCollectorState self enterState: (XMLSourceWalkerCollectorState for: self)
enterCommentState self enterState: (XMLSourceWalkerCollectorState for: self acceptSelector: #leftComment:)
enterCopyrightState self enterState: (XMLSourceWalkerAccumulatorState for: self acceptSelector: #leftCopyright:)
enterDoItState self enterState: (XMLSourceWalkerAccumulatorState for: self acceptSelector: #leftDoIt:)
enterInitializeState self enterState: (XMLSourceWalkerCollectorState for: self acceptSelector: #leftInitialize:)
enterMethodsState self enterState: (XMLSourceWalkerCollectorState for: self acceptSelector: #leftMethods:)
enterNameSpaceState self enterState: (XMLSourceWalkerDefinitionState for: self acceptSelector: #leftNameSpace:)
enterRelocateState self enterState: (XMLSourceWalkerCollectorState for: self acceptSelector: #leftRelocate:)
enterRemoveSelectorState self enterState: (XMLSourceWalkerCollectorState for: self acceptSelector: #leftRemoveSelector:)
enterRemoveState self enterState: (XMLSourceWalkerCollectorState for: self acceptSelector: #leftRemove:)
enterRenameState self enterState: (XMLSourceWalkerCollectorState for: self acceptSelector: #leftRename:)
enterReorganizeDataState self enterState: (XMLSourceWalkerCollectorState for: self acceptSelector: #leftReorganizeData:)
enterReorganizeState self enterState: (XMLSourceWalkerCollectorState for: self acceptSelector: #leftReorganize:)
enterSharedVarState self enterState: (XMLSourceWalkerDefinitionState for: self acceptSelector: #leftSharedVar:)
enterTimeStampState "<!ELEMENT time-stamp (#PCDATA)>" self enterState: (XMLSourceWalkerAccumulatorState for: self acceptSelector: #leftTimeStamp:)
enterTopLevelState self enterState: (XMLSourceWalkerTopState for: self)
</methods> <methods> Tools.FileTools.XMLSourceWalker <category>states-leaving</category>
leftClass: aClassState "<!ELEMENT class (name, environment?, super, private?, indexed-type, inst-vars?, class-inst-vars?, imports?, attributes?)>" client acceptClass: (aClassState contentsAt: 'name') superclass: (aClassState contentsAt: 'super') environment: (aClassState contentsAt: 'environment' ifAbsent: [nil]) private: (aClassState contentsAt: 'private' ifAbsent: [nil]) indexedType: (aClassState contentsAt: 'indexed-type') instVars: (aClassState contentsAt: 'inst-vars' ifAbsent: [nil]) classInstVars: (aClassState contentsAt: 'class-inst-vars' ifAbsent: [nil]) imports: (aClassState contentsAt: 'imports' ifAbsent: [nil]) attributes: (self attributesFrom: aClassState)
leftComment: aCollectorState "<!ELEMENT comment (%all-objects; , body)>" | commentedObject | commentedObject := aCollectorState elements first. client acceptComment: (aCollectorState contentsOrBlankAt: 'body') of: commentedObject tag named: commentedObject contents
leftCopyright: anAccumulatorState "<!ELEMENT copyright (#PCDATA)>" client acceptCopyright: anAccumulatorState contents
leftDoIt: anActionState "A <do-it> element has ended in the source. The argument is the state that accepted it." client acceptDoIt: anActionState contents
leftInitialize: aCollectorState "A <initialize> element has ended in the source. The argument is the state that accepted it." | object | object := aCollectorState elements first. client acceptInitialize: object contents ofType: object tag
leftMethods: aCollectorState "<!ELEMENT methods (class-id, properties?, (body | note)*)>" | elementStream classElement properties bodies | elementStream := ReadStream on: aCollectorState elements. classElement := elementStream next. properties := Dictionary new. [elementStream peek tag ~= 'body'] whileTrue: [ | element | element := elementStream next. properties at: element tag put: element contents]. bodies := OrderedCollection new. [elementStream atEnd] whileFalse: [bodies add: elementStream next contents]. client acceptMethodsFor: classElement contents properties: properties bodies: bodies
leftNameSpace: aClassState "<!ELEMENT name-space (name, environment?, private?, imports?, properties?)>" client acceptNameSpace: (aClassState contentsAt: 'name') environment: (aClassState contentsAt: 'environment' ifAbsent: [nil]) private: (aClassState contentsAt: 'private' ifAbsent: [nil]) imports: (aClassState contentsAt: 'imports' ifAbsent: [nil]) attributes: (self attributesFrom: aClassState)
leftRelocate: aCollectorState "<!ELEMENT relocate (%all-statics; , environment)>" | object environment | object := aCollectorState elements at: 1. environment := aCollectorState elements at: 2. client acceptRelocate: object contents to: environment contents
leftRemove: aCollectorState "<!ELEMENT remove %all-statics; >" | object | object := aCollectorState element first. client acceptRemove: object contents ofType: object tag
leftRemoveSelector: aCollectorState "<!ELEMENT remove-selector (class-id, selector)>" | classId selector | classId := aCollectorState elements at: 1. selector := aCollectorState elements at: 2. client acceptRemoveSelector: selector contents inClass: classId contents
leftRename: aCollectorState "<!ELEMENT rename (%all-statics; , name)>" | object name | object := aCollectorState elements at: 1. name := aCollectorState elements at: 2. client acceptRename: object contents to: name contents
leftReorganize: aCollectorState "<!ELEMENT reorganize (class-id, organization)> <!ELEMENT organization (#PCDATA)>" | classId organization | classId := aCollectorState elements at: 1. organization := aCollectorState elements at: 2. client acceptReorganize: classId contents using: organization contents
leftReorganizeData: aCollectorState "<!ELEMENT reorganize-data ((class-id | name-space-id), organization)> <!ELEMENT organization (#PCDATA)>" | data organization | data := aCollectorState elements at: 1. organization := aCollectorState elements at: 2. client acceptReorganizeData: data contents using: organization contents
leftSharedVar: aClassState "<!ELEMENT shared-variable (name, environment, private?, constant?, initializer?)>" client acceptSharedVar: (aClassState contentsAt: 'name') environment: (aClassState contentsAt: 'environment') private: (aClassState contentsAt: 'private' ifAbsent: [nil]) constant: (aClassState contentsAt: 'constant' ifAbsent: [nil]) initializer: (aClassState contentsAt: 'initializer' ifAbsent: [nil]) attributes: (self attributesFrom: aClassState)
leftTimeStamp: anActionState "<!ELEMENT time-stamp (#PCDATA)>" client acceptTimeStamp: anActionState contents
</methods> <methods> Tools.FileTools.XMLSourceWalker <category>SAX dispatch</category>
characters: aString self currentState characters: aString
comment: data from: start to: stop self currentState xmlComment: (data copyFrom: start to: stop)
endElement: namespaceURI localName: localName qName: name currentTag := name trimBlanks. self currentState end: currentTag
startElement: namespaceURI localName: localName qName: name attributes: attributes currentTag := name trimBlanks. self currentState start: currentTag
</methods> <methods> Tools.FileTools.XMLSourceWalker <category>privileged</category>
acceptXMLComment: aString client acceptGeneralComment: aString
attributesFrom: aState | attributeElement attributes | attributeElement := aState elementWithTag: 'attributes' ifAbsent: [^nil]. attributes := OrderedCollection new. attributeElement elements do: [:each | attributes add: (Array with: each tag asSymbol with: each contents)]. ^attributes asArray
currentState ^states last
currentTag ^currentTag
enterState: aState states addLast: aState
leaveState states removeLast
</methods> <methods> Tools.FileTools.XMLSourceWalker <category>initialize-release</category>
initialize: anObject client := anObject. states := OrderedCollection with: (XMLSourceWalkerInitialState for: self)
</methods> <methods> Tools.FileTools.XMLSourceWalker class <category>instance creation</category>
on: anObject ^self new initialize: anObject
</methods> <methods> Tools.FileTools.FileHexViewer <category>private</category>
textForEntireFile: aFilename | fileStream textStream base | fileStream := aFilename readStream. [fileStream binary. textStream := TextStream on: (String new: 1000). base := 0. [fileStream atEnd] whileFalse: [self writeDataLineFrom: fileStream address: base to: textStream. base := base + 16]] ensure: [fileStream close]. ^textStream contents
textForFileBeginning: aFilename | fileStream textStream base | fileStream := aFilename readStream. [fileStream binary. textStream := TextStream on: (String new: 1000). base := 0. [fileStream atEnd or: [base > self largeFileThreshold]] whileFalse: [self writeDataLineFrom: fileStream address: base to: textStream. base := base + 16]] ensure: [fileStream close]. textStream emphasis: #italic; nextPutAll: (#RestNotShown << #dialogs >> '--- rest not shown ---') asString; cr. ^textStream contents
writeDataLineFrom: readStream address: baseAddress to: aStream | readBytes byte | baseAddress printOn: aStream paddedWith: $0 to: 6 base: 16. aStream next: 2 put: Character space. readBytes := OrderedCollection new: 16. [readBytes size = 16 or: [readStream atEnd]] whileFalse: [byte := readStream next. readBytes add: byte. byte printOn: aStream paddedWith: $0 to: 2 base: 16. aStream space]. readBytes size < 16 ifTrue: [(16 - readBytes size) * 3 timesRepeat: [aStream space]]. aStream space. readBytes do: [:each | | char | char := each asCharacter. (each between: 32 and: 127) ifTrue: [aStream nextPut: char] ifFalse: [aStream nextPut: $.]]. aStream cr
</methods> <methods> Tools.FileTools.FileHexViewer class <category>accessing</category>
tabLabel ^(#Binary << #labels >> 'Binary') asString
tabPosition ^20
</methods> <methods> Tools.FileTools.SpecialDirectoryItem <category>initialize-release</category>
initialize: aPlatformFilename avoidHasChildrenQuery := self isPotentiallySlow: aPlatformFilename. super initialize: aPlatformFilename
name: aString name := aString
</methods> <methods> Tools.FileTools.SpecialDirectoryItem <category>printing</category>
displayString ^name isNil ifTrue: [filename asString asUppercase] ifFalse: [name]
</methods> <methods> Tools.FileTools.SpecialDirectoryItem <category>accessing</category>
parent ^nil
parentFilename self shouldNotImplement
</methods> <methods> Tools.FileTools.SpecialDirectoryItem <category>private</category>
isPotentiallySlow: aPlatformFilename ^'ab\' includes: aPlatformFilename asString first asLowercase
privateHasSubdirectories ^avoidHasChildrenQuery or: [super privateHasSubdirectories]
</methods> <methods> Tools.FileTools.FileBrowser <category>file list</category>
copyFile self withSelectedFilenameDo: [:filename | | name newFilename | name := Dialog requestFileNameWithMessage: (#CopyFileToColon << #labels >> 'Copy File To:') default: (self selectedDirectory asFilename constructString: filename tail) version: #new ifFail: [^self] for: builder window. newFilename := name asFilename. filename copyTo: newFilename. self reloadFiles; selectFileNamed: newFilename]
copyFilename self withSelectedFilenameDo: [:name | ParagraphEditor currentSelection: name asString]
createFile | name newFilename | name := Dialog requestFileNameWithMessage: (#CreateNewFileNamedColon << #labels >> 'Create New File Named:') default: (self selectedDirectory asFilename constructString: 'new.txt') version: #new ifFail: [^self] for: builder window. newFilename := name asFilename. newFilename exists ifFalse: [newFilename writeStream close]. self reloadFiles; selectFileNamed: newFilename
createItemOf: aView at: index reversing: aBoolean | item label wrapper | item := aView sequence at: index. label := self createLabelAndIconOf: item for: aView. ^aBoolean ifTrue: [wrapper := ReversingWrapper on: label. wrapper reverse setValue: true. wrapper] ifFalse: [label]
createLabelAndIconOf: item for: aView ^(ExtendedLabelAndIcon with: item displayString attributes: aView textStyle offset: 0 @ 0) icon: item icon; yourself
fileEdit | selected workspace | selected := self selectedFile. selected isNil ifTrue: [Workspace open] ifFalse: [workspace := Workspace withFile: selected asFilename. workspace encoding: encodingChannel value. workspace open]
fileIn self withSelectedFilenameDo: [:name | Notice show: (#FilingInN1S << #dialogs >> 'Filing in<n><1s>' expandMacrosWith: name tail) while: [(name withEncoding: encodingChannel value) fileIn]]
fileIntoNewChangeSet self withSelectedFilenameDo: [:name | | setName newSet | setName := self requestNewChangeSetNameFor: name ifCancel: [^self]. newSet := NamedChangeSet withName: setName. NamedChangeSet addChangeSet: newSet. ChangeSet current: newSet. Notice show: (#FilingInN1S << #dialogs >> 'Filing in<n><1s>' expandMacrosWith: name tail) while: [(name withEncoding: encodingChannel value) fileIn]. ChangeSet current dirty: false. ChangeSet changed]
fileListDoubleClicked: aController self withSelectedFilenameDo: [:filename | filename isDirectory ifTrue: [self selectDirectory: filename] ifFalse: [self fileEdit]]
fileSelected self publishEmptySelection; setGuessedFileEncoding; updateViewerTabs; updateStatusBar; refreshMenuBar; refreshToolbar; publishSelection
fileSelectionChannel ^fileSelectionChannel
initializeFiles fileSelectionChannel := nil asValue. self fileListHolder selectionIndexHolder onChangeSend: #fileSelected to: self
inspectFilename ^self selectedFile asFilename inspect
isFileoutFilename: aFilename | tail | tail := aFilename tail. ^#('*.st' '*.pst' '*.cha') anySatisfy: [:pattern | pattern match: tail]
isParcelFilename: aFilename ^'*.pcl' match: aFilename tail
loadParcel self withSelectedFilenameDo: [:name | Notice show: (#LoadingParcelN1S << #dialogs >> 'Loading Parcel<n><1s>' expandMacrosWith: name asString) while: [Parcel loadParcelFrom: name]]
openChanges self withSelectedFilenameDo: [:name | ChangeList openOnFileNamed: name]
openConflicts self withSelectedFilenameDo: [:name | | changeList | changeList := ChangeList new. changeList checkSystem: #exact; showConflicts: true; scanFilename: name. changeList open]
publishEmptySelection fileSelectionChannel value: nil
publishSelection fileSelectionChannel value: (self selectedFile ifNotNil: [:fileItem | fileItem asFilename] ifNil: [self selectedDirectory ifNotNil: [:dirItem | dirItem asFilename]])
refreshFiles | currentFile | currentFile := self selectedFile. self reloadFiles. self fileListHolder selection: currentFile
refreshFilesAndSelect: aFilename self reloadFiles. self selectFileNamed: aFilename
reloadFiles | currentFolder pattern directories files | currentFolder := self selectedDirectory. currentFolder isNil ifTrue: [^self fileListHolder list: List new]. pattern := self patternHolder value. directories := currentFolder subdirectoryItemsMatching: pattern. files := currentFolder fileItemsMatching: pattern. self fileListHolder list: (directories, files) asList
removeDirectory: aDirectoryItem | parent | aDirectoryItem hasAnyChildren ifTrue: [Dialog warn: (#CannotRremoveDirectoryIsNotEmpty << #dialogs >> 'Cannot remove: the selected directory is not empty.'). ^self]. (Dialog confirm: ((#RemoveDirectory1sQ << #dialogs >> 'Remove directory "<1s>"?') expandMacrosWith: aDirectoryItem asFilename tail)) ifFalse: [^self]. parent := self selectedDirectory. aDirectoryItem asFilename delete. parent refresh. self directoryTreeHolder list refresh: parent. self reloadFiles
removeFile self withSelectedFileDo: [:file | (Dialog confirm: ((#RemoveFile1sQ << #dialogs >> 'Remove file "<1s>"?') expandMacrosWith: file asFilename tail)) ifFalse: [^self]. file asFilename delete. self reloadFiles]
removeFile: aFileItem (Dialog confirm: ((#RemoveFile1sQ << #dialogs >> 'Remove file "<1s>"?') expandMacrosWith: aFileItem asFilename tail)) ifFalse: [^self]. aFileItem asFilename delete. self reloadFiles
removeFileOrDirectory self withSelectedFileOrDirectoryDo: [:file | file isDirectory ifTrue: [self removeDirectory: file] ifFalse: [self removeFile: file]]
renameFile self withSelectedFileDo: [:file | | newName directory newFilename | newName := Dialog request: (#RenameTheFileAsColon << #dialogs >> 'Rename the file as:') initialAnswer: file asFilename tail. newName isEmpty ifTrue: [^self]. directory := self selectedDirectory. newFilename := directory asFilename construct: newName. file asFilename renameTo: newFilename. self reloadFiles. self selectFileNamed: newFilename]
renameFileOrDirectory self withSelectedFilenameDo: [:filename | | isDirectory newName directory newFilename | isDirectory := filename isDirectory. newName := (Dialog request: ((#RenameTheDirectoryOrFileAsColon << #dialogs >> 'Rename the <1?directory:file> as:') expandMacrosWith: isDirectory) initialAnswer: filename tail) trimBlanks. newName isEmpty ifTrue: [^self]. directory := self selectedDirectory. newFilename := directory asFilename construct: newName. filename renameTo: newFilename. isDirectory ifTrue: [directory refresh. self directoryTreeHolder list refresh: directory]. self reloadFiles. self selectFileNamed: newFilename]
requestNewChangeSetNameFor: aFilename ifCancel: aBlock | tail | tail := aFilename tail. ^NamedChangeSet requestUniqueName: (#FileIntoNewChangeSet << #dialogs >> 'File into new change set named:') initial: (tail copyFrom: 1 to: tail size - aFilename extension size) ifCancel: aBlock
selectedFile ^self fileListHolder selection
selectedVisualBlock ^[:view :index | BoundedWrapper on: (self createItemOf: view at: index reversing: true)]
selectFileNamed: aFilename self fileListHolder selection: (FileItem on: aFilename)
setGuessedFileEncoding encodingChannel setValue: (self selectedFile ifNil: [#default] ifNotNil: [:fileItem | self guessEncodingFor: fileItem asFilename])
setupFileListWidget | listWidget | listWidget := (builder componentAt: #files) widget. listWidget visualBlock: self unselectedVisualBlock. listWidget selectedVisualBlock: self selectedVisualBlock
unselectedVisualBlock ^[:view :index | BoundedWrapper on: (self createItemOf: view at: index reversing: false)]
withSelectedFileDo: aBlock | file | file := self selectedFile. ^file isNil ifTrue: [nil] ifFalse: [aBlock value: file]
withSelectedFilenameDo: aBlock | file | file := self selectedFile. ^file isNil ifTrue: [nil] ifFalse: [aBlock value: file asFilename]
withSelectedFileOrDirectoryDo: aBlock | file | file := self selectedFile. ^file isNil ifTrue: [nil] ifFalse: [aBlock value: file]
</methods> <methods> Tools.FileTools.FileBrowser <category>aspects</category>
directoryTreeHolder "This method was generated by UIDefiner. Any edits made here may be lost whenever methods are automatically defined. The initialization provided below may have been preempted by an initialize method." ^directoryTreeHolder isNil ifTrue: [directoryTreeHolder := SelectionInTree new] ifFalse: [directoryTreeHolder]
fileListHolder "This method was generated by UIDefiner. Any edits made here may be lost whenever methods are automatically defined. The initialization provided below may have been preempted by an initialize method." ^fileListHolder isNil ifTrue: [fileListHolder := SelectionInList new] ifFalse: [fileListHolder]
patternChoices "This method was generated by UIDefiner. Any edits made here may be lost whenever methods are automatically defined. The initialization provided below may have been preempted by an initialize method." ^patternChoices isNil ifTrue: [patternChoices := List new asValue] ifFalse: [patternChoices]
patternHolder "This method was generated by UIDefiner. Any edits made here may be lost whenever methods are automatically defined. The initialization provided below may have been preempted by an initialize method." ^patternHolder isNil ifTrue: [patternHolder := String new asValue] ifFalse: [patternHolder]
statusTextLeftHolder "This method was generated by UIDefiner. Any edits made here may be lost whenever methods are automatically defined. The initialization provided below may have been preempted by an initialize method." ^statusTextLeftHolder isNil ifTrue: [statusTextLeftHolder := String new asValue] ifFalse: [statusTextLeftHolder]
statusTextRightHolder "This method was generated by UIDefiner. Any edits made here may be lost whenever methods are automatically defined. The initialization provided below may have been preempted by an initialize method." ^statusTextRightHolder isNil ifTrue: [statusTextRightHolder := String new asValue] ifFalse: [statusTextRightHolder]
viewerListHolder "This method was generated by UIDefiner. Any edits made here may be lost whenever methods are automatically defined. The initialization provided below may have been preempted by an initialize method." ^viewerListHolder isNil ifTrue: [viewerListHolder := SelectionInList new] ifFalse: [viewerListHolder]
</methods> <methods> Tools.FileTools.FileBrowser <category>pattern box</category>
addPatternBox [| components toolbar oldComposite cp | components := self builder window component components. components size = 3 ifFalse: [^self]. ((toolbar := (components at: 2) component) isKindOf: ToolBar) ifFalse: [^self]. oldComposite := builder composite. builder composite: (cp := CompositePart new). self class filePatternSpec decodeAsLiteralArray component collection do: [:each | self builder add: each]. cp := WidgetWrapper on: (BoundedWrapper on: cp in: ((LayoutFrame new) leftOffset: toolbar components last bounds right + 5; leftFraction: 0; rightOffset: -2; rightFraction: 1; topOffset: (components at: 2) bounds center y - 13; topFraction: 0; bottomOffset: (components at: 2) bounds center y + 13; bottomFraction: 0)). self builder window component addWrapper: cp. cp invalidate. builder composite: oldComposite] on: Error do: [:ex | ex return]
initializePatterns self patternChoices value add: '*'; add: '*.pcl'; add: '*.st, *.pst, *.cha'; add: '*.txt, *.ws'. self patternHolder value: '*'. self patternHolder onChangeSend: #patternSelected to: self
patternSelected self rearrangePatternChoices; reloadFiles; updateStatusBar
rearrangePatternChoices | currentChoice | currentChoice := self patternHolder value. currentChoice isEmpty ifTrue: [^self]. self patternChoices value remove: currentChoice ifAbsent: []; addFirst: currentChoice
</methods> <methods> Tools.FileTools.FileBrowser <category>viewers</category>
initializeViewerTabs self viewerListHolder selectionIndexHolder onChangeSend: #viewerSelected to: self
installViewer: aViewer currentViewer notNil ifTrue: [currentViewer release]. currentViewer := aViewer. self viewerNotebookWidget client: currentViewer spec: #windowSpec builder: builder newSubBuilder
setupViewerTabs self viewerNotebookWidget tabBar component displayStringSelector: #tabLabel. self updateViewerTabs
setViewersTo: classCollection self viewerListHolder list: classCollection asList; selectionIndex: (1 min: classCollection size)
setViewersTo: classCollection quietlySelecting: aClass self withoutViewerChangeUpdates: [self viewerListHolder list: classCollection asList; selection: aClass]
showNonViewerWidgets: aBoolean #(folders splitter1 files splitter2) do: [:each | (builder componentAt: each) isVisible: aBoolean]
toggleZoom | widget leftLayout topLayout | widget := builder componentAt: #viewers. leftLayout := (builder componentAt: #splitter1) component layout. topLayout := (builder componentAt: #splitter2) component layout. self isZoomed ifTrue: [self showNonViewerWidgets: true. widget component layout leftFraction: leftLayout rightFraction; leftOffset: leftLayout rightOffset; topFraction: topLayout bottomFraction; topOffset: topLayout bottomOffset] ifFalse: [widget component layout leftFraction: 0; leftOffset: 0; topFraction: 0; topOffset: 0. self showNonViewerWidgets: false. currentViewer takeKeyboardFocus]. builder window refresh
updateViewerTabs | selection viewerClasses currentViewerClass | builder isNil ifTrue: [^self]. selection := self selectedFile ifNil: [self selectedDirectory]. viewerClasses := selection isNil ifTrue: [List new] ifFalse: [self viewerClassesInterestedIn: selection]. currentViewerClass := self viewerListHolder selection. (self nonDefaultViewerSelected and: [viewerClasses includes: currentViewerClass]) ifTrue: [self setViewersTo: viewerClasses quietlySelecting: currentViewerClass] ifFalse: [self setViewersTo: viewerClasses]
viewerClassesInterestedIn: aFileItem | filename viewerClasses | filename := aFileItem asFilename. viewerClasses := FileViewer allSubclasses select: [:some | some isConcrete and: [some isInterestedInFile: filename]]. ^viewerClasses asSortedCollection: [:a :b | a tabPosition <= b tabPosition]
viewerNotebookWidget ^(builder componentAt: #viewers) widget
viewerSelected | viewerClass | viewerClass := self viewerListHolder selection. viewerClass isNil ifTrue: [^self]. self installViewer: (viewerClass new browser: self). currentViewer takeKeyboardFocus
withoutViewerChangeUpdates: aBlock self viewerListHolder selectionIndexHolder retractInterestsFor: self. aBlock ensure: [self viewerListHolder selectionIndexHolder onChangeSend: #viewerSelected to: self]
</methods> <methods> Tools.FileTools.FileBrowser <category>directory tree</category>
addAndSelectDirectory: aFilename | tree item | tree := self directoryTreeHolder list. item := SpecialDirectoryItem on: aFilename. item name: aFilename asString. tree root: (tree root add: item; yourself) displayIt: false. self directoryTreeHolder selection: item
copyDirectoryFilename | folder | folder := self selectedDirectory. folder isNil ifTrue: [^self]. ParagraphEditor currentSelection: folder asFilename asString
createSubdirectory self withSelectedDirectoryDo: [:directory | | newName newFilename | newName := (Dialog request: (#CreateSubdirectoryNamedColon << #dialogs >> 'Create a subdirectory of the selected directory named:') initialAnswer: String new) trimBlanks. newName isEmpty ifTrue: [^self]. newFilename := directory asFilename construct: newName. newFilename makeDirectory. directory refresh. self directoryTreeHolder list refresh: directory. self selectDirectory: newFilename]
directorySelected Cursor wait showWhile: [self reloadFiles. self updateStatusBar. self publishSelectedDirectory]
expandToDirectory: directoryFilename | target path treeModel lastExpanded | target := DirectoryItem on: directoryFilename. path := target parentDirectories. treeModel := self directoryTreeHolder list. lastExpanded := nil. Cursor wait showWhile: [path do: [:each | | index | index := treeModel indexOf: each. index = 0 ifTrue: [^lastExpanded]. treeModel expand: index. lastExpanded := each]]. ^target
goToDirectory | name destination | name := Dialog requestDirectoryName: (#GoToDirectoryNamedColon << #dialogs >> 'Go to directory named:') default: (self hasDirectoryInTreeSelected ifTrue: [self selectedDirectory asFilename asString] ifFalse: [String new]). name isEmpty ifTrue: [^self]. Cursor wait showWhile: [destination := name asFilename. (self isLocalDirectory: destination) ifTrue: [self selectDirectory: destination] ifFalse: [self addAndSelectDirectory: destination]]
initiallySelectDefault InitialSelectionPreference := #default
initiallySelectNone InitialSelectionPreference := #none
initiallySelectRootOfDefault InitialSelectionPreference := #root
inspectDirectoryFilename ^self selectedDirectory asFilename inspect
isLocalDirectory: aFilename | tree bases filenameBase | tree := self directoryTreeHolder list. bases := tree root children. filenameBase := aFilename class readBaseLocationFromStream: aFilename asString readStream. ^(bases collect: [:each | each baseLocation]) includes: filenameBase
maybeSelectDirectoryNamed: aStringOrNil aStringOrNil notNil ifTrue: [self selectDirectory: aStringOrNil asFilename]
parentOfDirectory: aDirectoryItem | stepParent | stepParent := aDirectoryItem parent. ^self directoryTreeHolder list detect: [:some | some = stepParent] ifNone: [nil]
publishSelectedDirectory self fileSelectionChannel value: (self selectedDirectory ifNotNil: [:selection | selection asFilename])
refreshDirectory self withSelectedDirectoryDo: [:directory | directory refresh. self directoryTreeHolder list refresh: directory. self refreshFiles]
reloadDirectories | model | model := TreeModel on: TopLevelItem current displayRoot: false childrenWith: [:item | item children] testHasChildrenWith: [:item | item hasChildren]. self directoryTreeHolder list: model
removeDirectory self withSelectedDirectoryDo: [:directory | | parent | directory hasAnyChildren ifTrue: [Dialog warn: (#CannotRremoveDirectoryIsNotEmpty << #dialogs >> 'Cannot remove: the selected directory is not empty.'). ^self]. (Dialog confirm: ((#RemoveDirectory1sQ << #dialogs >> 'Remove directory "<1s>"?') expandMacrosWith: directory asFilename tail)) ifFalse: [^self]. parent := self parentOfDirectory: directory. directory asFilename delete. parent refresh. self directoryTreeHolder list refresh: parent. self selectDirectory: parent asFilename]
renameDirectory self withSelectedDirectoryDo: [:directory | | newName parent newFilename | newName := Dialog request: (#RenameTheDirectoryAsColon << #dialogs >> 'Rename the directory as:') initialAnswer: directory asFilename tail. newName isEmpty ifTrue: [^self]. parent := self parentOfDirectory: directory. newFilename := parent asFilename construct: newName. directory asFilename renameTo: newFilename. parent refresh. self directoryTreeHolder list refresh: parent. self selectDirectory: newFilename]
selectDefaultDirectory self selectDirectory: Filename defaultDirectory
selectDirectory: directoryFilename | lastKnownDirectoryItem | lastKnownDirectoryItem := self expandToDirectory: directoryFilename. self directoryTreeHolder selection: lastKnownDirectoryItem
selectedDirectory ^self directoryTreeHolder selection
selectInitialDirectory InitialSelectionPreference = #none ifTrue: [^self]. InitialSelectionPreference = #root ifTrue: [^self selectRootOfDefaultDirectory]. ^self selectDefaultDirectory
selectLastOpenDirectory self maybeSelectDirectoryNamed: OpenFileDialog lastDirectory
selectLastSaveDirectory self maybeSelectDirectoryNamed: SaveFileDialog lastDirectory
selectRootOfDefaultDirectory | item root | item := DirectoryItem on: Filename defaultDirectory. root := item withParentDirectories first. self selectDirectory: root asFilename
setOpenFileDirectoryHere self withSelectedDirectoryFilenameDo: [:name | OpenFileDialog lastDirectory: name]
setSaveFileDirectoryHere self withSelectedDirectoryFilenameDo: [:name | SaveFileDialog lastDirectory: name]
setupDirectoryTreeWidget ^(builder componentAt: #folders) widget useImage: #folderTreeIcon selectedImage: #folderTreeSelectedIcon
withSelectedDirectoryDo: aBlock ^self selectedDirectory ifNotNil: [:directory | aBlock value: directory]
withSelectedDirectoryFilenameDo: aBlock ^self selectedDirectory ifNotNil: [:directory | aBlock value: directory asFilename]
</methods> <methods> Tools.FileTools.FileBrowser <category>menus</category>
addInitialSelectionMenuTo: aMenu (aMenu atNameKey: #initialSelection) submenu: self buildInitialSelectionMenu
augmentDirectoryTreeMenu: aMenu aMenu addPart: self class win32directoryExtras
augmentFileListMenuForCurrentFile: aMenu self withSelectedFilenameDo: [:name | (self isFileoutFilename: name) ifTrue: [aMenu addPart: self class fileoutExtras]. (self isParcelFilename: name) ifTrue: [aMenu addPart: self class parcelExtras]]
augmentMenuBarForCurrentFile: aMenu | fileMenu | self withSelectedFilenameDo: [:name | (self isFileoutFilename: name) ifTrue: [fileMenu := (aMenu atNameKey: #file) submenu. fileMenu addPart: self class fileoutExtras]. (self isParcelFilename: name) ifTrue: [fileMenu := (aMenu atNameKey: #file) submenu. fileMenu addPart: self class parcelExtras]]
augmentMenuBarForCurrentPlatform: aMenu | directoryMenu | directoryMenu := (aMenu atNameKey: #directory) submenu. directoryMenu addPart: self class win32directoryExtras
buildDirectoryTreeMenu | menu | menu := self class baseDirectoryTreeMenu. self augmentDirectoryTreeMenu: menu. menu augmentFrom: self class to: FileBrowser menuName: #directoryTree for: self. ^menu
buildFileListMenu | menu | menu := self class baseFileListMenu. self augmentFileListMenuForCurrentFile: menu. self addEncodingMenuTo: menu. menu augmentFrom: self class to: FileBrowser menuName: #fileList for: self. ^menu
buildInitialSelectionMenu | menu | menu := self class initialSelectionMenu. #(none root default) do: [:each | (menu atNameKey: each) indication: [InitialSelectionPreference = each]]. ^menu
directoryTreeMenu ^[self buildDirectoryTreeMenu]
fileListMenu ^[self buildFileListMenu]
menuBarHolder ^menuBarHolder
refreshMenuBar | menuBar | menuBar := self class menuBar. self augmentMenuBarForCurrentPlatform: menuBar. self augmentMenuBarForCurrentFile: menuBar. self addEncodingMenuTo: menuBar. self addInitialSelectionMenuTo: menuBar. menuBar augmentFrom: self class to: FileBrowser menuName: #menuBar for: self. menuBarHolder value: menuBar
</methods> <methods> Tools.FileTools.FileBrowser <category>state</category>
canSelectLastOpenDirectory ^OpenFileDialog lastDirectory notNil
canSelectLastSaveDirectory ^SaveFileDialog lastDirectory notNil
canSetOpenFileDirectory ^self selectedDirectory notNil
canSetSaveFileDirectory ^self selectedDirectory notNil
displayingItemViewers "True when the current collection of viewer tabs is for a file or directory item rather than a directory in the directory tree." ^self viewerListHolder list size > 1
hasDirectoryInTreeSelected "This means directory in the tree view." ^self selectedDirectory notNil
hasDirectorySelected ^self hasItemSelected and: [[self selectedFile asFilename isDirectory] on: OsError "must be a special file" do: [:ex | ex return: false]]
hasFileoutFileSelected ^self hasFileSelected and: [self isFileoutFilename: self selectedFile asFilename]
hasFileSelected ^self hasItemSelected and: [[self selectedFile asFilename isDirectory not] on: OsError "must be a special file" do: [:ex | ex return: true]]
hasItemSelected ^self selectedFile notNil
hasParcelFileSelected ^self hasFileSelected and: [self isParcelFilename: self selectedFile asFilename]
isZoomed ^(self builder componentAt: #folders) widget isVisible not
nonDefaultViewerSelected ^self viewerListHolder selectionIndex > 1
notDefaultDirectorySelected ^self selectedDirectory isNil or: [self selectedDirectory asFilename ~= Filename defaultDirectory]
</methods> <methods> Tools.FileTools.FileBrowser <category>miscellaneous</category>
aboutVisualWorks AboutVisualWorksDialog open
changeRequest ^[currentViewer changeRequest] on: Error do: [:ex | ex return: true]
fileSizeString: anInteger anInteger < 1024 ifTrue: [^((#x1sBytes << #dialogs >> '<1s> bytes') expandMacrosWith: anInteger printString)]. anInteger < 1048576 ifTrue: [^((#x1sKB << #dialogs >> '<1s> KB') expandMacrosWith: (anInteger // 1024) printString)]. ^((#x1sMB << #dialogs >> '<1s> MB') expandMacrosWith: (anInteger // 1048576) printString)
fullUpdate | selection | selection := self selectedDirectory. self directoryTreeHolder selection: nil. self reloadDirectories. selection notNil ifTrue: [self selectDirectory: selection asFilename]
helpFileBrowser SmalltalkWorkbench openHelpBook: 'VisualWorks Tools' topic: 'File Browser'
helpFiles SmalltalkWorkbench openHelpBook: 'Development with VisualWorks' topic: 'Files'
helpTopics | openBlock classReference | classReference := #{VWHelp.HelpBrowser}. openBlock := [:each | each openOnBook: 'VisualWorks Tools' topic: 'File Browser']. classReference ifDefinedDo: openBlock elseDo: [(self confirm: (#HelpNotLoaded << #dialogs >> 'Online help has not been loaded.<n>Do you wish to load it?') expandMacros) ifTrue: [Notice show: (#LoadingParcelN1S << #dialogs >> 'Loading Parcel<n><1s>' expandMacrosWith: 'VWHelp') while: [Parcel ensureLoadedParcel: 'VWHelp' withVersion: '']. classReference ifDefinedDo: openBlock]]
refreshToolbar | toolbar | builder isNil ifTrue: [^self]. toolbar := builder componentAt: #toolbarMenu. toolbar isNil ifTrue: [^self]. (toolbar componentAt: #fileEdit) isEnabled: self hasFileSelected. (toolbar componentAt: #openChanges) isEnabled: self hasFileoutFileSelected. (toolbar componentAt: #openConflicts) isEnabled: self hasFileoutFileSelected. (toolbar componentAt: #fileIn) isEnabled: self hasFileoutFileSelected. (toolbar componentAt: #loadParcel) isEnabled: self hasParcelFileSelected
updateStatusBar self selectedFile notNil ifTrue: [^self updateStatusBarForFileSelection]. self selectedDirectory notNil ifTrue: [^self updateStatusBarForFolderSelection]. self updateStatusBarForNoSelection
updateStatusBarForFileSelection | filename | filename := self selectedFile asFilename. self statusTextLeftHolder value: filename asString. self statusTextRightHolder value: (self fileSizeString: filename fileSize)
updateStatusBarForFolderSelection | filename | filename := self selectedDirectory asFilename. self statusTextLeftHolder value: filename asString. self statusTextRightHolder value: ((#x1sFiles << #dialogs >> '<1s> files') expandMacrosWith: self fileListHolder list size printString)
updateStatusBarForNoSelection self statusTextLeftHolder value: String new. self statusTextRightHolder value: String new
</methods> <methods> Tools.FileTools.FileBrowser <category>initialize-release</category>
initialize super initialize. menuBarHolder := nil asValue. encodingChannel := #default asValue. self directoryTreeHolder selectionIndexHolder onChangeSend: #directorySelected to: self. self initializePatterns. self initializeFiles. self initializeViewerTabs. self refreshMenuBar. self reloadDirectories
postBuildWith: aBuilder self setupDirectoryTreeWidget; setupFileListWidget
postOpenWith: aBuilder self addPatternBox. Cursor wait showWhile: [self setupViewerTabs; selectInitialDirectory].
</methods> <methods> Tools.FileTools.FileBrowser <category>menus-encoding</category>
addEncodingMenuTo: aMenu (aMenu atNameKey: #fileEncoding) submenu: [self buildEncodingMenu]
buildEncodingMenu ^WorkspacePage buildEncodingMenuFor: encodingChannel
encodingChannel ^encodingChannel
guessEncodingFor: aFilename ^self class encodingFor: aFilename
</methods> <methods> Tools.FileTools.FileBrowser class <category>generated resources</category>
changeListConflictsIcon ^ToolbarIconLibrary default enablementVisualFor: #changeListConflicts
changeListIcon ^ToolbarIconLibrary default enablementVisualFor: #changeList
editIcon ^ToolbarIconLibrary default enablementVisualFor: #edit
fileInIcon ^ToolbarIconLibrary default enablementVisualFor: #fileIn
loadParcelIcon ^ToolbarIconLibrary default enablementVisualFor: #loadParcel
</methods> <methods> Tools.FileTools.FileBrowser class <category>types/encodings-definitions</category>
patternsAndTypesDo: aBlock (Pragma allNamed: #patterns:priority: in: self class sortedByArgument: 2) reverseDo: [:each | aBlock value: (each argumentAt: 1) value: (self perform: each selector)]
typesAndEncodingsDo: aBlock (Pragma allNamed: #encodingFor: in: self class) do: [:each | aBlock value: (each argumentAt: 1) value: (self perform: each selector)]
</methods> <methods> Tools.FileTools.FileBrowser class <category>types/encodings-accessing</category>
encodingFor: aFilenameOrString ^self encodingForType: (self typeOf: aFilenameOrString) "self encodingFor: 'foobar.xml' " "self encodingFor: 'foobar.st' " "self encodingFor: 'foobar.baz' "
encodingForType: aSymbol self typesAndEncodingsDo: [:type :encoding | type = aSymbol ifTrue: [^encoding]]. ^#default
typeOf: aFilenameOrString | nameString | nameString := aFilenameOrString asString. self patternsAndTypesDo: [:patterns :type | (patterns anySatisfy: [:pattern | pattern match: nameString]) ifTrue: [^type]]. ^#unknown "self typeOf: 'foobar.st' " "self typeOf: 'foobar.txt' " "self typeOf: 'foo.bar' "
</methods> <methods> Tools.FileTools.FileBrowser class <category>system startup</category>
refreshOpenBrowsers Screen default allScheduledControllersDo: [:each | (each model isKindOf: self) ifTrue: [each model reloadDirectories; selectInitialDirectory]]
</methods> <methods> Tools.FileTools.FileBrowser class <category>notifications</category>
instanceMethodsChanged Screen default allScheduledControllersDo: [:each | (each model isKindOf: self) ifTrue: [each model refreshMenuBar]]
</methods> <methods> Tools.FileTools.FileTextViewer <category>initialize-release</category>
browser: aBrowser super browser: aBrowser. browser encodingChannel onChangeSend: #encodingChanged to: self
postBuildViewWith: aBuilder | textEditor | super postBuildViewWith: aBuilder. textEditor := (aBuilder componentAt: #text) widget controller. (textEditor localMenuItem: #doIt) ifTrue: [textEditor initializeMenuForCodeWithFileItIn]
release browser encodingChannel retractInterestsFor: self. super release
</methods> <methods> Tools.FileTools.FileTextViewer <category>private</category>
compareTextWithFile: aFilename "Open a Differator on the text currently on the page (on the left) and the text from the file on the right." | text fileText | self withTextViewControllerDo: [:textEditor | text := textEditor text copy. fileText := [aFilename contentsOfEntireFile] on: OsError do: [:ex | ex return: String new]. (Differator newOn: text and: fileText) open]
encoding ^browser encodingChannel value
fileChangedOnDisk: aFilename ^originalFileTimestamp notNil and: [originalFileTimestamp ~= aFilename modificationTimestamp]
hasUnsavedChanges | textEditor | lastSubBuilder isNil ifTrue: [^false]. textEditor := (lastSubBuilder componentAt: #text) widget controller. (textEditor respondsTo: #accepted) ifFalse: [^false]. ^textEditor accepted not
okToRereadFile ^Dialog confirm: (#okToRereadFile << #labels >> 'Reread the file using the new encoding?<n>(Unsaved changes will be lost).') expandMacros initialAnswer: false
okToSaveFile: aFilename | choice | (self fileChangedOnDisk: aFilename) ifFalse: [^true]. choice := Dialog choose: (#FileHasChanged << #dialogs >> 'The file on the disk has been changed. Saving may override other changes. Save anyway?') labels: (Array with: (#Yes << #dialogs >> 'Yes') with: (#No << #dialogs >> 'No') with: (#Compare << #dialogs >> 'Compare')) values: #(yes no compare) default: #no. choice = #compare ifTrue: [self compareTextWithFile: aFilename]. ^choice = #yes
okToSaveTextFor: aController | filename choice | filename := self selectedFilename. filename isNil ifTrue: [^true]. (self fileChangedOnDisk: filename) ifFalse: [^true]. choice := Dialog choose: (#FileHasChanged << #dialogs >> 'The file on the disk has been changed. Saving may override other changes. Save anyway?') labels: (Array with: (#Yes << #dialogs >> 'Yes') with: (#No << #dialogs >> 'No') with: (#Compare << #dialogs >> 'Compare')) values: #(yes no compare) default: #no. choice = #compare ifTrue: [self compareTextWithFile: filename]. ^choice = #yes
text: aString | newFile filenameToSave stream | newFile := false. filenameToSave := self selectedFilename ifNil: [newFile := true. self promptForNewFilename]. filenameToSave isNil ifTrue: [^false]. filenameToSave := filenameToSave withEncoding: self encoding. stream := filenameToSave writeStream. [stream nextPutAll: aString] ensure: [stream close]. newFile ifTrue: [browser refreshFilesAndSelect: filenameToSave]. ^true
textForEntireFile: aFilename | filename | filename := aFilename withEncoding: self encoding. originalFileTimestamp := aFilename modificationTimestamp. ^filename contentsOfEntireFile
textForFileBeginning: aFilename | fileStream textStream | fileStream := (aFilename withEncoding: self encoding) readStream. textStream := TextStream on: (String new: self largeFileThreshold + 20). [textStream nextPutAll: (fileStream nextAvailable: self largeFileThreshold). textStream cr; emphasis: #italic; nextPutAll: (#RestNotShown << #dialogs >> '--- rest not shown ---') asString] ensure: [fileStream close]. ^textStream contents
</methods> <methods> Tools.FileTools.FileTextViewer <category>updating</category>
changeRequest | textEditor choice | textEditor := (lastSubBuilder componentAt: #text) widget controller. ((textEditor respondsTo: #accepted) not or: [textEditor accepted]) ifTrue: [^true]. choice := Dialog choose: (#SaveChanges << #dialogs >> 'Save changes?') labels: (Array with: (#Yes << #dialogs >> 'Yes') with: (#No << #dialogs >> 'No') with: (#Cancel << #dialogs >> 'Cancel')) values: #(yes no cancel) default: #yes. choice = #cancel ifTrue: [^false]. choice = #yes ifTrue: [textEditor accept]. ^true
encodingChanged (self hasUnsavedChanges and: [self okToRereadFile not]) ifTrue: [^self]. self withTextViewControllerDo: [:editor | editor cancel]
updateForNoSelection super updateForNoSelection. originalFileTimestamp := nil
</methods> <methods> Tools.FileTools.FileTextViewer <category>testing</category>
promptForNewFilename | selectedDirectory initialName selection | selectedDirectory := browser selectedDirectory. initialName := selectedDirectory isNil ifTrue: ['new.txt'] ifFalse: [selectedDirectory asFilename constructString: 'new.txt']. selection := Dialog requestFileName: (#SaveIntoFileNamedColon << #dialogs >> 'Save into a file named:') default: initialName. ^(selection := selection trimBlanks) isEmpty ifTrue: [nil] ifFalse: [selection asFilename]
</methods> <methods> Tools.FileTools.FileTextViewer class <category>accessing</category>
tabLabel ^(#Text << #labels >> 'Text') asString
tabPosition ^10
</methods> <methods> Tools.FileTools.DirectoryContentsViewer <category>accessing</category>
printBlurbFor: aFilename on: stream aFilename directoryContents asSortedStrings do: [:filenameString | | filename | filename := aFilename construct: filenameString. self printFilename: filename on: stream. stream cr]
printDirectory: aFilename on: aStream aStream emphasis: #bold; nextPutAll: aFilename tail; emphasis: nil; tab; nextPutAll: (#directory << #dialogs >> '[directory]') asString; space; print: aFilename modificationTimestamp
printFile: aFilename on: aStream aStream emphasis: #bold; nextPutAll: aFilename tail; emphasis: nil; tab; nextPut: $[; print: aFilename fileSize; nextPutAll: '] '; print: aFilename modificationTimestamp
printFilename: aFilename on: aStream [aFilename isDirectory ifTrue: [self printDirectory: aFilename on: aStream] ifFalse: [self printFile: aFilename on: aStream]] on: OsError do: [:ex | aStream print: ex. ex return]
</methods> <methods> Tools.FileTools.DirectoryContentsViewer class <category>accessing</category>
isInterestedInFile: aFilename ^[aFilename isDirectory] on: OsError do: [:ex | ex return: false]
tabLabel ^(#DirectoryContents << #labels >> 'Directory Contents') asString
tabPosition ^5
</methods> <methods> Tools.FileTools.FileViewer class <category>resources</category>
readOnlyCodeMenu "Tools.MenuEditor new openOnClass: self andSelector: #readOnlyCodeMenu" <resource: #menu> ^#(#{UI.Menu} #( #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #_DoIt #defaultString: '&Do it' #catalogID: #menus ) #value: #doIt #labelImage: #(#{UI.ResourceRetriever} #{Tools.ToolbarIconLibrary} #doIt ) ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #_InspectIt #defaultString: '&Inspect it' #catalogID: #menus ) #value: #inspectIt #labelImage: #(#{UI.ResourceRetriever} #{Tools.ToolbarIconLibrary} #inspectIt ) ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #De_bugIt #defaultString: 'De&bug it' #catalogID: #menus ) #value: #debugIt #labelImage: #(#{UI.ResourceRetriever} #{Tools.ToolbarIconLibrary} #debugIt ) ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #_Copy #defaultString: '&Copy' #catalogID: #menus ) #value: #copySelection #labelImage: #(#{UI.ResourceRetriever} #{Tools.ToolbarIconLibrary} #copy ) ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #_FindDot #defaultString: '&Find...' #catalogID: #menus ) #value: #find ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #FindAgain #defaultString: 'Find Again' #catalogID: #menus ) #value: #findNext ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #Select_All #defaultString: 'Select &All' #catalogID: #menus ) #value: #selectEntireText ) ) #(3 1 2 1 ) nil ) decodeAsLiteralArray
</methods> <methods> Tools.FileTools.FileBlurbViewer class <category>interface specs</category>
windowSpec "UIPainter new openOnClass: self andSelector: #windowSpec" <resource: #canvas> ^#(#{UI.FullSpec} #window: #(#{UI.WindowSpec} #label: #(#{Kernel.UserMessage} #key: #UnlabeledCanvas #defaultString: 'Unlabeled Canvas' #catalogID: #labels) #bounds: #(#{Graphics.Rectangle} 512 384 992 688 ) ) #component: #(#{UI.SpecCollection} #collection: #( #(#{UI.TextEditorSpec} #layout: #(#{Graphics.LayoutFrame} 0 0 0 0 0 1 0 1 ) #name: #text #model: #textHolder #isReadOnly: true #tabRequiresControl: true ) ) ) )
</methods> <methods> Tools.FileTools.DirectorySelectionDialog class <category>interface specs</category>
windowSpec "Tools.UIPainter new openOnClass: self andSelector: #windowSpec" <resource: #canvas> ^#(#{UI.FullSpec} #window: #(#{UI.WindowSpec} #label: #(#{Kernel.UserMessage} #key: #DirectorySelection #defaultString: 'Directory Selection' #catalogID: #labels ) #min: #(#{Core.Point} 346 396 ) #max: #(#{Core.Point} 0 0 ) #bounds: #(#{Graphics.Rectangle} 700 525 1046 921 ) ) #component: #(#{UI.SpecCollection} #collection: #( #(#{UI.TreeViewSpec} #layout: #(#{Graphics.LayoutFrame} 10 0 10 0 -10 1 -45 1 ) #name: #directoryTree #flags: 15 #model: #directoryTreeHolder #callbacksSpec: #(#{UI.UIEventCallbackSubSpec} #doubleClickSelector: #directoryTreeDoubleClicked ) #menu: #directoryTreeMenu #useModifierKeys: true #selectionType: #highlight #useIcons: #other #iconSelectors: #(#folderTreeIcon ) #rootExpander: true ) #(#{UI.ActionButtonSpec} #layout: #(#{Graphics.LayoutFrame} -175 1 -35 1 -95 1 -10 1 ) #name: #okButton #model: #accept #label: #(#{Kernel.UserMessage} #key: #OK #defaultString: 'OK' #catalogID: #labels ) #isDefault: true #defaultable: true ) #(#{UI.ActionButtonSpec} #layout: #(#{Graphics.LayoutFrame} -90 1 -35 1 -10 1 -10 1 ) #name: #cancelButton #model: #cancel #label: #(#{Kernel.UserMessage} #key: #Cancel #defaultString: 'Cancel' #catalogID: #labels ) #defaultable: true ) ) ) )
</methods> <methods> Tools.FileTools.DirectorySelectionDialog class <category>resources</category>
directoryTreeMenu "Tools.MenuEditor new openOnClass: self andSelector: #directoryTreeMenu" <resource: #menu> ^#(#{UI.Menu} #( #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #CreateDirectoryDots #defaultString: 'Create Directory...' #catalogID: #menus ) #nameKey: #createSubdirectory #value: #createSubdirectory #enablementSelector: #directorySelected #helpText: #(#{Kernel.UserMessage} #key: #CreateANewSubDirectory #defaultString: 'Create a new sub directory' #catalogID: #menus ) ) ) #(1 ) nil ) decodeAsLiteralArray
</methods> <methods> Tools.FileTools.XMLTreeViewer class <category>resources</category>
nodeMenu "MenuEditor new openOnClass: self andSelector: #nodeMenu" <resource: #menu> ^#(#{UI.Menu} #( #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #InspectNode #defaultString: 'Inspect Node' #catalogID: #menus) #value: #inspectNode ) ) #(1 ) nil ) decodeAsLiteralArray
</methods> <methods> Tools.FileTools.XMLTreeViewer class <category>interface specs</category>
windowSpec "UIPainter new openOnClass: self andSelector: #windowSpec" <resource: #canvas> ^#(#{UI.FullSpec} #window: #(#{UI.WindowSpec} #label: #(#{Kernel.UserMessage} #key: #UnlabeledCanvas #defaultString: 'Unlabeled Canvas' #catalogID: #labels) #bounds: #(#{Graphics.Rectangle} 512 384 985 667 ) ) #component: #(#{UI.SpecCollection} #collection: #( #(#{UI.TreeViewSpec} #layout: #(#{Graphics.LayoutFrame} 0 0 0 0 0 0.4 0 1 ) #name: #nodeTree #model: #nodeTreeHolder #menu: #nodeMenu #useModifierKeys: true #selectionType: #highlight #displayStringSelector: #simpleDescription #rootExpander: true ) #(#{UI.ResizingSplitterSpec} #layout: #(#{Graphics.LayoutFrame} 0 0.4 0 0 3 0.4 0 1 ) #name: #splitter #horizontal: false #minAboveSize: 30 #minBelowSize: 30 #aboveWidgets: 'nodeTree' #belowWidgets: 'text' ) #(#{UI.TextEditorSpec} #layout: #(#{Graphics.LayoutFrame} 3 0.4 0 0 0 1 0 1 ) #name: #text #model: #textHolder #menu: #readOnlyCodeMenu #isReadOnly: true #tabRequiresControl: true ) ) ) )
</methods> <methods> Tools.FileTools.XMLSourceViewer class <category>interface specs</category>
windowSpec "UIPainter new openOnClass: self andSelector: #windowSpec" <resource: #canvas> ^#(#{UI.FullSpec} #window: #(#{UI.WindowSpec} #label: #(#{Kernel.UserMessage} #key: #UnlabeledCanvas #defaultString: 'Unlabeled Canvas' #catalogID: #labels) #bounds: #(#{Graphics.Rectangle} 512 384 712 584 ) ) #component: #(#{UI.SpecCollection} #collection: #( #(#{UI.TextEditorSpec} #layout: #(#{Graphics.LayoutFrame} 0 0 0 0 0 1 0 1 ) #name: #text #model: #textHolder #menu: #readOnlyCodeMenu #isReadOnly: true #tabRequiresControl: true ) ) ) )
</methods> <methods> Tools.FileTools.FileContentsViewer class <category>interface specs</category>
fullTextSpec "UIPainter new openOnClass: self andSelector: #fullTextSpec" <resource: #canvas> ^#(#{UI.FullSpec} #window: #(#{UI.WindowSpec} #label: #(#{Kernel.UserMessage} #key: #UnlabeledCanvas #defaultString: 'Unlabeled Canvas' #catalogID: #labels) #min: #(#{Core.Point} 20 20 ) #max: #(#{Core.Point} 1024 768 ) #bounds: #(#{Graphics.Rectangle} 512 384 912 584 ) ) #component: #(#{UI.SpecCollection} #collection: #( #(#{UI.TextEditorSpec} #layout: #(#{Graphics.LayoutFrame} 0 0 0 0 0 1 0 1 ) #name: #text #model: #fullTextHolder #callbacksSpec: #(#{UI.UIEventCallbackSubSpec} #requestValueChangeSelector: #okToSaveTextFor: ) #isReadOnly: false #tabRequiresControl: true ) ) ) )
previewSpec "UIPainter new openOnClass: self andSelector: #previewSpec" <resource: #canvas> ^#(#{UI.FullSpec} #window: #(#{UI.WindowSpec} #label: #(#{Kernel.UserMessage} #key: #UnlabeledCanvas #defaultString: 'Unlabeled Canvas' #catalogID: #labels) #min: #(#{Core.Point} 20 20 ) #max: #(#{Core.Point} 1024 768 ) #bounds: #(#{Graphics.Rectangle} 512 384 912 584 ) ) #component: #(#{UI.SpecCollection} #collection: #( #(#{UI.ActionButtonSpec} #layout: #(#{Graphics.Rectangle} 0 1 120 24 ) #name: #showAllButton #model: #loadEntireFile #helpText: #largeFileMessage #label: #(#{Kernel.UserMessage} #key: #ShowEntireFile #defaultString: 'Show Entire File' #catalogID: #labels) #defaultable: true ) #(#{UI.TextEditorSpec} #layout: #(#{Graphics.LayoutFrame} 0 0 25 0 0 1 0 1 ) #name: #text #model: #previewTextHolder #menu: #readOnlyCodeMenu #isReadOnly: true #tabRequiresControl: true ) ) ) )
windowSpec "UIPainter new openOnClass: self andSelector: #windowSpec" <resource: #canvas> ^#(#{UI.FullSpec} #window: #(#{UI.WindowSpec} #label: #(#{Kernel.UserMessage} #key: #UnlabeledCanvas #defaultString: 'Unlabeled Canvas' #catalogID: #labels) #min: #(#{Core.Point} 20 20 ) #max: #(#{Core.Point} 1024 768 ) #bounds: #(#{Graphics.Rectangle} 512 384 912 584 ) ) #component: #(#{UI.SpecCollection} #collection: #( #(#{UI.SubCanvasSpec} #layout: #(#{Graphics.LayoutFrame} 0 0 0 0 0 1 0 1 ) #name: #view #flags: 0 ) ) ) )
</methods> <methods> Tools.FileTools.FileHexViewer class <category>interface specs</category>
fullTextSpec "UIPainter new openOnClass: self andSelector: #fullTextSpec" <resource: #canvas> ^#(#{UI.FullSpec} #window: #(#{UI.WindowSpec} #label: #(#{Kernel.UserMessage} #key: #UnlabeledCanvas #defaultString: 'Unlabeled Canvas' #catalogID: #labels) #min: #(#{Core.Point} 20 20 ) #max: #(#{Core.Point} 1024 768 ) #bounds: #(#{Graphics.Rectangle} 512 384 912 584 ) ) #component: #(#{UI.SpecCollection} #collection: #( #(#{UI.TextEditorSpec} #layout: #(#{Graphics.LayoutFrame} 0 0 0 0 0 1 0 1 ) #name: #text #flags: 15 #model: #fullTextHolder #callbacksSpec: #(#{UI.UIEventCallbackSubSpec} #requestValueChangeSelector: #textAcceptAllowed: ) #style: #fixed #isReadOnly: true #tabRequiresControl: true #isWrapped: false ) ) ) )
previewSpec "UIPainter new openOnClass: self andSelector: #previewSpec" <resource: #canvas> ^#(#{UI.FullSpec} #window: #(#{UI.WindowSpec} #label: #(#{Kernel.UserMessage} #key: #UnlabeledCanvas #defaultString: 'Unlabeled Canvas' #catalogID: #labels) #min: #(#{Core.Point} 20 20 ) #max: #(#{Core.Point} 1024 768 ) #bounds: #(#{Graphics.Rectangle} 512 384 912 584 ) ) #component: #(#{UI.SpecCollection} #collection: #( #(#{UI.ActionButtonSpec} #layout: #(#{Graphics.Rectangle} 0 1 120 24 ) #name: #showAllButton #model: #loadEntireFile #helpText: #largeFileMessage #label: #(#{Kernel.UserMessage} #key: #ShowEntireFile #defaultString: 'Show Entire File' #catalogID: #labels) #defaultable: true ) #(#{UI.TextEditorSpec} #layout: #(#{Graphics.LayoutFrame} 0 0 25 0 0 1 0 1 ) #name: #text #flags: 15 #model: #previewTextHolder #style: #fixed #isReadOnly: true #tabRequiresControl: true #isWrapped: false ) ) ) )
</methods> <methods> Tools.FileTools.FileBrowser class <category>resources</category>
baseDirectoryTreeMenu "MenuEditor new openOnClass: self andSelector: #baseDirectoryTreeMenu" <resource: #menu> ^#(#{UI.Menu} #( #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #CreateDot #defaultString: '&Create...' #catalogID: #menus) #value: #createSubdirectory #enablementSelector: #hasDirectoryInTreeSelected ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #Re_nameDot #defaultString: 'Re&name...' #catalogID: #menus) #value: #renameDirectory #enablementSelector: #hasDirectoryInTreeSelected ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #_RemoveDot #defaultString: '&Remove...' #catalogID: #menus) #value: #removeDirectory #enablementSelector: #hasDirectoryInTreeSelected ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #Re_fresh #defaultString: 'Re&fresh' #catalogID: #menus) #value: #refreshDirectory #enablementSelector: #hasDirectoryInTreeSelected #shortcutKeyCharacter: #F5 #shortcutModifiers: 0 ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #_CopyName #defaultString: '&Copy Name' #catalogID: #menus) #value: #copyDirectoryFilename #enablementSelector: #hasDirectoryInTreeSelected ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #_Inspect #defaultString: '&Inspect' #catalogID: #menus) #value: #inspectDirectoryFilename #enablementSelector: #hasDirectoryInTreeSelected ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #GoToDot #defaultString: '&Go to...' #catalogID: #menus) #value: #goToDirectory #shortcutKeyCharacter: $G #shortcutModifiers: 8 ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #GoToDefault #defaultString: 'Go to &Default' #catalogID: #menus) #value: #selectDefaultDirectory #enablementSelector: #notDefaultDirectorySelected ) ) #(3 3 2 ) nil ) decodeAsLiteralArray
baseFileListMenu "MenuEditor new openOnClass: self andSelector: #baseFileListMenu" <resource: #menu> ^#(#{UI.Menu} #( #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #_NewDot #defaultString: '&New...' #catalogID: #menus) #nameKey: #create #value: #createFile ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #Re_nameDot #defaultString: 'Re&name...' #catalogID: #menus) #value: #renameFileOrDirectory #enablementSelector: #hasItemSelected ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #_RemoveDot #defaultString: '&Remove...' #catalogID: #menus) #value: #removeFileOrDirectory #enablementSelector: #hasItemSelected ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #CopyDot #defaultString: '&Copy...' #catalogID: #menus) #nameKey: #copy #value: #copyFile #enablementSelector: #hasFileSelected ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #_Encoding #defaultString: '&Encoding' #catalogID: #menus) #nameKey: #fileEncoding ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #C_opyName #defaultString: 'C&opy Name' #catalogID: #menus) #value: #copyFilename #enablementSelector: #hasItemSelected ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #InspectFilename #defaultString: '&Inspect Filename' #catalogID: #menus) #value: #inspectFilename #enablementSelector: #hasItemSelected ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #_Edit #defaultString: '&Edit' #catalogID: #menus) #value: #fileEdit #enablementSelector: #hasFileSelected #shortcutKeyCharacter: $E #shortcutModifiers: 8 #labelImage: #(#{UI.ResourceRetriever} #{Tools.FileTools.FileBrowser} #editIcon ) ) ) #(4 1 2 1 ) nil ) decodeAsLiteralArray
fileoutExtras "Tools.MenuEditor new openOnClass: self andSelector: #fileoutExtras" <resource: #menu> ^#(#{UI.Menu} #( #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #_OpenInChangeList #defaultString: '&Open in Change List' #catalogID: #menus ) #value: #openChanges #labelImage: #(#{UI.ResourceRetriever} #{Tools.FileTools.FileBrowser} #changeListIcon ) ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #_CompareWithSystem #defaultString: '&Compare with System' #catalogID: #menus ) #value: #openConflicts #labelImage: #(#{UI.ResourceRetriever} #{Tools.FileTools.FileBrowser} #changeListConflictsIcon ) ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #_FileIn #defaultString: '&File In' #catalogID: #menus ) #value: #fileIn #labelImage: #(#{UI.ResourceRetriever} #{Tools.FileTools.FileBrowser} #fileInIcon ) ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #FileIntoNewChangeSetDot #defaultString: 'File into &New Change Set...' #catalogID: #menus ) #value: #fileIntoNewChangeSet ) ) #(2 2 ) nil ) decodeAsLiteralArray
initialSelectionMenu "MenuEditor new openOnClass: self andSelector: #initialSelectionMenu" <resource: #menu> ^#(#{UI.Menu} #( #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #DefaultDirectory #defaultString: '&Default Directory' #catalogID: #menus) #nameKey: #default #value: #initiallySelectDefault ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #RootOfDefaultDirectory #defaultString: '&Root of Default Directory' #catalogID: #menus) #nameKey: #root #value: #initiallySelectRootOfDefault ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #None #defaultString: '&None' #catalogID: #menus) #nameKey: #none #value: #initiallySelectNone ) ) #(3 ) nil ) decodeAsLiteralArray
menuBar "MenuEditor new openOnClass: self andSelector: #menuBar" <resource: #menu> ^#(#{UI.Menu} #( #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #Directory #defaultString: '&Directory' #catalogID: #menus) #nameKey: #directory #submenu: #(#{UI.Menu} #( #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #_NewDot #defaultString: '&New...' #catalogID: #menus) #value: #createSubdirectory #enablementSelector: #hasDirectoryInTreeSelected ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #_RenameDot #defaultString: '&Rename...' #catalogID: #menus) #value: #renameDirectory #enablementSelector: #hasDirectoryInTreeSelected ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #Re_moveDot #defaultString: 'Re&move...' #catalogID: #menus) #value: #removeDirectory #enablementSelector: #hasDirectoryInTreeSelected ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #Re_fresh #defaultString: 'Re&fresh' #catalogID: #menus) #value: #refreshDirectory #enablementSelector: #hasDirectoryInTreeSelected #shortcutKeyCharacter: #F5 #shortcutModifiers: 0 #labelImage: #(#{UI.ResourceRetriever} #{ToolbarIconLibrary} #refreshFolder ) ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #_CopyName #defaultString: '&Copy Name' #catalogID: #menus) #value: #copyDirectoryFilename #enablementSelector: #hasDirectoryInTreeSelected ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #_Inspect #defaultString: '&Inspect' #catalogID: #menus) #value: #inspectDirectoryFilename #enablementSelector: #hasDirectoryInTreeSelected ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #GoTo_DefaultDirectory #defaultString: 'Go to &Default Directory' #catalogID: #menus) #value: #selectDefaultDirectory #enablementSelector: #notDefaultDirectorySelected #labelImage: #(#{UI.ResourceRetriever} #{ToolbarIconLibrary} #goToDefaultFolder ) ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #GoToDot #defaultString: '&Go to...' #catalogID: #menus) #value: #goToDirectory #shortcutKeyCharacter: $G #shortcutModifiers: 8 #labelImage: #(#{UI.ResourceRetriever} #{ToolbarIconLibrary} #goToFolder ) ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #InitialSelection #defaultString: '&Initial Selection' #catalogID: #menus) #nameKey: #initialSelection ) ) #(3 3 2 1 ) nil ) ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #_File #defaultString: '&File' #catalogID: #menus) #nameKey: #file #submenu: #(#{UI.Menu} #( #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #_NewDot #defaultString: '&New...' #catalogID: #menus) #nameKey: #create #value: #createFile ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #_RenameDot #defaultString: '&Rename...' #catalogID: #menus) #value: #renameFileOrDirectory #enablementSelector: #hasItemSelected ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #Re_moveDot #defaultString: 'Re&move...' #catalogID: #menus) #value: #removeFileOrDirectory #enablementSelector: #hasItemSelected ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #CopyDot #defaultString: '&Copy...' #catalogID: #menus) #nameKey: #copy #value: #copyFile #enablementSelector: #hasFileSelected ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #_Encoding #defaultString: '&Encoding' #catalogID: #menus) #nameKey: #fileEncoding ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #C_opyName #defaultString: 'C&opy Name' #catalogID: #menus) #value: #copyFilename #enablementSelector: #hasItemSelected ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #_Inspect #defaultString: '&Inspect' #catalogID: #menus) #value: #inspectFilename #enablementSelector: #hasItemSelected ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #_Edit #defaultString: '&Edit' #catalogID: #menus) #nameKey: #fileEdit #value: #fileEdit #enablementSelector: #hasFileSelected #shortcutKeyCharacter: $E #shortcutModifiers: 8 #labelImage: #(#{UI.ResourceRetriever} #{FileBrowser} #editIcon ) ) ) #(4 1 2 1 ) nil ) ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #_View #defaultString: '&View' #catalogID: #menus) #nameKey: #view #submenu: #(#{UI.Menu} #( #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #RefreshAll #defaultString: '&Refresh All' #catalogID: #menus) #value: #fullUpdate #shortcutKeyCharacter: #F5 #shortcutModifiers: 8 ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #_Zoom #defaultString: '&Zoom' #catalogID: #menus) #nameKey: #viewZoom #value: #toggleZoom #shortcutKeyCharacter: $Z #shortcutModifiers: 8 #labelImage: #(#{UI.ResourceRetriever} #{ToolbarIconLibrary} #zoom ) ) ) #(2 ) nil ) ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #_Help #defaultString: '&Help' #catalogID: #menus) #nameKey: #help #submenu: #(#{UI.Menu} #( #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #FileBrowser #defaultString: 'File &Browser' #catalogID: #menus) #value: #helpFileBrowser #shortcutKeyCharacter: #F1 #shortcutModifiers: 0 #labelImage: #(#{UI.ResourceRetriever} #{ToolbarIconLibrary} #help ) ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #AboutFiles #defaultString: '&Files' #catalogID: #menus) #value: #helpFiles ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #_AboutVisualWorksDot #defaultString: '&About VisualWorks...' #catalogID: #menus) #value: #aboutVisualWorks ) ) #(2 1 ) nil ) ) ) #(4 ) nil ) decodeAsLiteralArray
parcelExtras "MenuEditor new openOnClass: self andSelector: #parcelExtras" <resource: #menu> ^#(#{UI.Menu} #( #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #_Load #defaultString: '&Load' #catalogID: #menus) #value: #loadParcel #labelImage: #(#{UI.ResourceRetriever} #{ToolbarIconLibrary} #loadParcel ) ) ) #(1 ) nil ) decodeAsLiteralArray
toolbarMenu "MenuEditor new openOnClass: self andSelector: #toolbarMenu" <resource: #menu> ^#(#{UI.Menu} #( #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #GoToDefaultDirectory #defaultString: 'Go to Default Directory' #catalogID: #menus) #value: #selectDefaultDirectory #labelImage: #(#{UI.ResourceRetriever} #{ToolbarIconLibrary} #goToDefaultFolder ) #helpText: #(#{Kernel.UserMessage} #key: #GoToImageDefaultDirectory #defaultString: 'Go to image default directory' #catalogID: #menus) ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #GoToDirectory #defaultString: 'Go to Directory...' #catalogID: #menus) #value: #goToDirectory #labelImage: #(#{UI.ResourceRetriever} #{ToolbarIconLibrary} #goToFolder ) #helpText: #(#{Kernel.UserMessage} #key: #GoToDirectoryHelp #defaultString: 'Go to directory...' #catalogID: #menus) ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #Refresh #defaultString: 'Refresh' #catalogID: #menus) #value: #refreshDirectory #labelImage: #(#{UI.ResourceRetriever} #{ToolbarIconLibrary} #refreshFolder ) #helpText: #(#{Kernel.UserMessage} #key: #RefreshTheCurrentDirectory #defaultString: 'Refresh the current directory' #catalogID: #menus) ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #OpenFile #defaultString: 'Open File' #catalogID: #menus) #nameKey: #fileEdit #value: #fileEdit #labelImage: #(#{UI.ResourceRetriever} #{Tools.FileTools.FileBrowser} #editIcon ) #helpText: #(#{Kernel.UserMessage} #key: #OpenFileInAWorkspace #defaultString: 'Open file in a Workspace' #catalogID: #menus) ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #OpenChanges #defaultString: 'Open Changes' #catalogID: #menus) #nameKey: #openChanges #value: #openChanges #labelImage: #(#{UI.ResourceRetriever} #{Tools.FileTools.FileBrowser} #changeListIcon ) #helpText: #(#{Kernel.UserMessage} #key: #OpenFileInAChangeList #defaultString: 'Open file in a Change List' #catalogID: #menus) ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #OpenConflicts #defaultString: 'Open Conflicts' #catalogID: #menus) #nameKey: #openConflicts #value: #openConflicts #labelImage: #(#{UI.ResourceRetriever} #{Tools.FileTools.FileBrowser} #changeListConflictsIcon ) #helpText: #(#{Kernel.UserMessage} #key: #CompareFileUsingChangeList #defaultString: 'Compare file to the system in a Change List' #catalogID: #menus) ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #FileIn1 #defaultString: 'File In' #catalogID: #menus) #nameKey: #fileIn #value: #fileIn #labelImage: #(#{UI.ResourceRetriever} #{Tools.FileTools.FileBrowser} #fileInIcon ) #helpText: #(#{Kernel.UserMessage} #key: #FileIn #defaultString: 'File in' #catalogID: #menus) ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #ParcelIn #defaultString: 'Parcel In' #catalogID: #menus) #nameKey: #loadParcel #value: #loadParcel #enablementSelector: #hasParcelFileSelected #labelImage: #(#{UI.ResourceRetriever} #{Tools.FileTools.FileBrowser} #loadParcelIcon ) #helpText: #(#{Kernel.UserMessage} #key: #LoadParcel #defaultString: 'Load parcel' #catalogID: #menus) ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #Zoom #defaultString: 'Zoom' #catalogID: #menus) #value: #toggleZoom #labelImage: #(#{UI.ResourceRetriever} #{ToolbarIconLibrary} #zoom ) #helpText: #(#{Kernel.UserMessage} #key: #ZoomOrUnzoom #defaultString: 'Zoom or unzoom' #catalogID: #menus) ) ) #(3 3 2 1 ) nil ) decodeAsLiteralArray
win32directoryExtras "MenuEditor new openOnClass: self andSelector: #win32directoryExtras" <resource: #menu> ^#(#{UI.Menu} #( #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #FileDialogDirectories #defaultString: '&File Dialog Directories' #catalogID: #menus) #submenu: #(#{UI.Menu} #( #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #GoToDefaultOpenLocation #defaultString: 'Go to Default &Open Location' #catalogID: #menus) #value: #selectLastOpenDirectory #enablementSelector: #canSelectLastOpenDirectory ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #GoToDefaultSaveLocation #defaultString: 'Go to Default &Save Location' #catalogID: #menus) #value: #selectLastSaveDirectory #enablementSelector: #canSelectLastSaveDirectory ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #MakeThisDefaultOpenLocation #defaultString: '&Make this Default Open Location' #catalogID: #menus) #value: #setOpenFileDirectoryHere #enablementSelector: #canSetOpenFileDirectory ) #(#{UI.MenuItem} #rawLabel: #(#{Kernel.UserMessage} #key: #MakeThisDefaultSaveLocation #defaultString: 'Ma&ke this Default Save Location' #catalogID: #menus) #value: #setSaveFileDirectoryHere #enablementSelector: #canSetSaveFileDirectory ) ) #(2 2 ) nil ) ) ) #(1 ) nil ) decodeAsLiteralArray
</methods> <methods> Tools.FileTools.FileBrowser class <category>interface specs</category>
filePatternSpec "UIPainter new openOnClass: self andSelector: #filePatternSpec" <resource: #canvas> ^#(#{UI.FullSpec} #window: #(#{UI.WindowSpec} #label: #(#{Kernel.UserMessage} #key: #FileBrowserPattern #defaultString: '' #catalogID: #labels ) #min: #(#{Core.Point} 518 64 ) #max: #(#{Core.Point} 518 64 ) #bounds: #(#{Graphics.Rectangle} 506 384 1024 448 ) ) #component: #(#{UI.SpecCollection} #collection: #( #(#{UI.ComboBoxSpec} #layout: #(#{Graphics.LayoutFrame} 80 0 0 0 0 1 25 0 ) #name: #pattern #model: #patternHolder #isReadOnly: false #comboList: #patternChoices ) #(#{UI.LabelSpec} #layout: #(#{UI.AlignmentOrigin} 75 0 24 0 1 1 ) #name: #label #label: #(#{Kernel.UserMessage} #key: #ShowFilesColon #defaultString: 'Show Files:' #catalogID: #labels) ) ) ) )
windowSpec "Tools.UIPainter new openOnClass: self andSelector: #windowSpec" <resource: #canvas> ^#(#{UI.FullSpec} #window: #(#{UI.WindowSpec} #label: #(#{Kernel.UserMessage} #key: #FileBrowser #defaultString: 'File Browser' #catalogID: #labels ) #min: #(#{Core.Point} 300 200 ) #max: #(#{Core.Point} 0 0 ) #bounds: #(#{Graphics.Rectangle} 224 168 1024 768 ) #flags: 4 #menu: #menuBarHolder #toolBar: #toolbarMenu ) #component: #(#{UI.SpecCollection} #collection: #( #(#{UI.TreeViewSpec} #layout: #(#{Graphics.LayoutFrame} 0 0 0 0 -1 0.32 -23 1 ) #name: #folders #flags: 15 #model: #directoryTreeHolder #callbacksSpec: #(#{UI.UIEventCallbackSubSpec} #requestValueChangeSelector: #changeRequest ) #menu: #directoryTreeMenu #useModifierKeys: true #selectionType: #highlight #useIcons: #other #iconSelectors: #(#folderTreeIcon ) #rootExpander: true ) #(#{UI.ResizingSplitterSpec} #layout: #(#{Graphics.LayoutFrame} -1 0.32 0 0 2 0.32 -23 1 ) #name: #splitter1 #horizontal: false #minAboveSize: 30 #minBelowSize: 30 #aboveWidgets: 'folders' #belowWidgets: 'files splitter2 viewers' ) #(#{UI.SequenceViewSpec} #layout: #(#{Graphics.LayoutFrame} 2 0.32 0 0 0 1 -1 0.4 ) #name: #files #model: #fileListHolder #callbacksSpec: #(#{UI.UIEventCallbackSubSpec} #doubleClickSelector: #fileListDoubleClicked: #requestValueChangeSelector: #changeRequest ) #menu: #fileListMenu ) #(#{UI.ResizingSplitterSpec} #layout: #(#{Graphics.LayoutFrame} 0 0.32 0 0.4 0 1 3 0.4 ) #name: #splitter2 #horizontal: true #minAboveSize: 40 #minBelowSize: 25 #aboveWidgets: 'files' #belowWidgets: 'viewers' ) #(#{UI.TabControlSpec} #layout: #(#{Graphics.LayoutFrame} 2 0.32 3 0.4 0 1 -23 1 ) #name: #viewers #model: #viewerListHolder #labels: #() ) #(#{UI.InputFieldSpec} #layout: #(#{Graphics.LayoutFrame} 0 0 -23 1 -200 1 0 1 ) #name: #statusBarLeft #model: #statusTextLeftHolder #tabable: false #isReadOnly: true ) #(#{UI.InputFieldSpec} #layout: #(#{Graphics.LayoutFrame} -200 1 -23 1 0 1 0 1 ) #name: #statusBarRight #model: #statusTextRightHolder #tabable: false #isReadOnly: true ) ) ) )
</methods> <methods> Tools.FileTools.FileBrowser class <category>types/encodings-definitions</category>
sourceEncoding "See #typeAndEncodingPragmas method comment for the explanation of how file type patterns and encoding definitions work together." <encodingFor: #source> ^#Source
sourceFiles "See #typeAndEncodingPragmas method comment for the explanation of how file type patterns and encoding definitions work together." <patterns: #('*.sou' '*.st' '*.cha' '*.chb' '*.ste' '*.app' '*.ws' '*.pst') priority: 1> ^#source
textEncoding "See #typeAndEncodingPragmas method comment for the explanation of how file type patterns and encoding definitions work together." <encodingFor: #text> ^#default
textFiles "See #typeAndEncodingPragmas method comment for the explanation of how file type patterns and encoding definitions work together." <patterns: #('*.txt' '*.text') priority: 1> ^#text
typeAndEncodingPragmas "Most of the methods in this protocol define file types and encodings to be used for those types. This mechanism is similar to the one used in the old browser. Unlike the old browser, types and encodings are defined using pragma methods, so that new types and encodings can be defined by extending packages. A file type is a symbol such as #source. To find out the type of a file, send the message #typeOf: to this class, passing a Filename or a filename String as the argument. A type is determined from the file name using a set of patterns. Patterns are defined as methods on the class side of this class. Pattern definition methods have a #patterns:priority: pragma. The first argument of this pragma is an array of strings, each string being a pattern (typically with wildcards). A filename matches the type defined by a method if it matches any of the patterns listed in the pragma. The method returns a Symbol which is the identifier of the type. For example, see any of the *File methods in this protocol. For multiple file type definition methods, matching is performed in the descending order of their #priority: pragma argument. For example, patterns in a method with the pragma <patterns: #('*.xml') priority: 1> are tried before patterns in a method with the pragma <patterns: #('*') priority: 0> and therefore a file named 'foo.xml' is considered to be of the type defined by the first method even though it would match both patterns. Default file type definitions in this class use priority 1 for the patterns that select specific file types such as #source or #xml, and priority 0 for a catch-all rule that recognizes anything not matched by any specific rule as file type #unknown. To override any of these default file type definitions, mark your own patterns with a priority higher than 1. For example, a method with the body <patterns: #('*.ws') priority: 2> ^#workspace would assign type #workspace to *.ws files, even though they are already recognized as #source files by one of the default rules. Encoding to be used when displaying the contents of a file is determined from the file type according to type-to-encoding mappings defined as methods marked with an #encodingFor: pragma. The pragma names the file type, and the method answers the name of the default encoding to be used for files of that type. For example, see any of the *Encoding methods in this protocol. To find out the encoding to use for a specific type, send the message #encodingForType: to this class. To find out the encoding for a file name (in a Filename or a String form), use the message #encodingFor:." <pragmas: #class> ^#(patterns:priority: encodingFor:)
unknownEncoding "See #typeAndEncodingPragmas method comment for the explanation of how file type patterns and encoding definitions work together." <encodingFor: #unknown> ^#default
unknownFiles "See #typeAndEncodingPragmas method comment for the explanation of how file type patterns and encoding definitions work together." <patterns: #('*') priority: 0> ^#unknown
xmlEncoding "See #typeAndEncodingPragmas method comment for the explanation of how file type patterns and encoding definitions work together." <encodingFor: #xml> ^#UTF_8
xmlFiles "See #typeAndEncodingPragmas method comment for the explanation of how file type patterns and encoding definitions work together." <patterns: #('*.xml') priority: 1> ^#xml
</methods> <methods> Tools.VisualLauncher <category>actions</category>
openFileBrowser <menuItem: #(#fileBrowser #menus 'File Browser' ) icon: #fileBrowser nameKey: #openFileBrowser menu: #(#launcherToolBar) position: 30.01 helpText: #(#OpenAFileBrowser #menus 'Open a File Browser')> <menuItem: #(#FileBrowserLabel #menus '&File Browser') icon: #fileBrowser nameKey: nil shortcutKeyCharacter: #F2 shortcutModifiers: 0 menu: #(#menuBar file) position: 9.01> self openApplicationForClassNamed: #{Tools.FileTools.FileBrowser}
</methods> "Imported Classes:" self error: 'Attempting to file-in parcel imports. Choose terminate or close' <class> <name>Object</name> <environment>Core</environment> <super></super> <private>false</private> none <imports></imports> <category>Kernel-Objects</category> <attributes> <package>Kernel-Objects</package> </attributes> </class> <class> <name>ApplicationModel</name> <environment>UI</environment> <super>UI.Model</super> <private>false</private> none builder uiSession eventHandlers savedWindowInformation <imports></imports> <category>UIBuilder-Framework</category> <attributes> <package>UIBuilder-Framework</package> </attributes> </class> <class> <name>VisualLauncher</name> <environment>Tools</environment> <super>UI.ApplicationModel</super> <private>false</private> none menuBar toolBar textCollector toolDock <imports></imports> <category>Tools-Misc</category> <attributes> <package>Tools-Misc</package> </attributes> </class> <class> <name>SimpleDialog</name> <environment>UI</environment> <super>UI.ApplicationModel</super> <private>false</private> none close accept cancel preBuildBlock postBuildBlock postOpenBlock escapeIsCancel parentView <imports></imports> <category>Interface-Dialogs</category> <attributes> <package>Interface-Dialogs</package> </attributes> </class> <class> <name>Notification</name> <environment>Core</environment> <super>Core.Exception</super> <private>false</private> none <imports></imports> <category>Kernel-Exception Handling</category> <attributes> <package>Kernel-Exception Handling</package> </attributes> </class> <class> <name>SAXDriver</name> <environment>XML</environment> <super>Core.Object</super> <private>false</private> none locator <imports></imports> <category>XML-SAX</category> <attributes> <package>XML</package> </attributes> </class>