From 6c8a043066a75540682b4bb3e737b0a22415c428 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phaneDucasse?= Date: Mon, 30 Sep 2024 12:47:41 +0200 Subject: [PATCH] Add a simple code file editor so that we can use it for the preferences. It replaces the UIManager default edit: So we can remove this edit: method too. --- .../SpSimpleFileEditPresenter.class.st | 142 ++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 src/Spec2-CommonWidgets/SpSimpleFileEditPresenter.class.st diff --git a/src/Spec2-CommonWidgets/SpSimpleFileEditPresenter.class.st b/src/Spec2-CommonWidgets/SpSimpleFileEditPresenter.class.st new file mode 100644 index 00000000..5f5cdc2e --- /dev/null +++ b/src/Spec2-CommonWidgets/SpSimpleFileEditPresenter.class.st @@ -0,0 +1,142 @@ +" +I define a simple code editor. +Before saving I create a backup of the edited file. + + +Here is a typical use: + +``` +SpSimpleFileEditPresenter new + onFileReference: '/Library/Preferences/pharo/6.0/settings.st' asFileReference; + openDialog +``` +" +Class { + #name : 'SpSimpleFileEditPresenter', + #superclass : 'SpPresenter', + #instVars : [ + 'label', + 'fileReference', + 'codeText' + ], + #category : 'Spec2-CommonWidgets', + #package : 'Spec2-CommonWidgets' +} + +{ #category : 'examples' } +SpSimpleFileEditPresenter class >> example [ +