Feature #478
RCP: x.x, Macro parameters remanence
Status: | New | Start date: | 12/06/2013 | ||
---|---|---|---|---|---|
Priority: | Urgent | Due date: | |||
Assignee: | - | % Done: | 80% |
||
Category: | Macros | Spent time: | - | ||
Target version: | TXM 0.7.8 |
Description
It is cumbersome for the user to have to set all the parameters again from scratch (from the macro default values) in case of repetitive calls, which is the most frequent use case of macros.
Solution¶
Use a file named '<MacroName>.properties' (in the 'parameter_name=value' .properties format), stored in the same directory as the macro, to store previous values given to the parameters in the parameters dialog box; And use those values to initialize the parameters in the parameters dialog box for the next call.
When opening the parameters dialog box of a macro:- if a file named <MacroName>.properties is present, use its content to initialize the parameters values
- otherwise set the parameters to the default values of the macro
- store the macro parameters values before execution:
- in a file named <MacroName>.properties (hidden in the macro view)
- in the same directory as the macro file
- with a .properties structure and semantics
- each parameter value is defined by a line pattern "parameterName=value"
Parameter value binding strategy
The macro parameters take their value from 4 different environments:- def: macro script default value, the @Field 'def' attribute (set by the Macro source code)
- properties: .properties parameter file, the <MacroName>.properties file (set by previous call)
- field: parameter field value in dialog box, the parameters dialog box (typed by the user)
- args: value given by the calling macro, the "args" global variable
- if the parameter is defined in args then use that value
- the properties value is not updated
- else:
- if all parameters are set by args don"t show the dialog box
- open the parameters dialog box with all the parameters not defined in args (their default value comes from properties if available otherwise from def)
- use the value given by field
- if all parameters are set by args don"t show the dialog box
History
#1 Updated by Serge Heiden over 8 years ago
- Description updated (diff)
#2 Updated by Serge Heiden about 8 years ago
- Subject changed from RCP: x.x, Macros parameters remanence to RCP: x.x, Macro parameters remanence
- Description updated (diff)
- Category set to Toolbox
- Priority changed from Normal to Urgent
- Target version set to TXM 0.7.8
#3 Updated by Serge Heiden about 8 years ago
- Description updated (diff)
#4 Updated by Matthieu Decorde about 8 years ago
- Category changed from Toolbox to Macros
#5 Updated by Matthieu Decorde about 8 years ago
- Description updated (diff)
#6 Updated by Serge Heiden about 8 years ago
- Description updated (diff)
#7 Updated by Serge Heiden about 8 years ago
- Description updated (diff)
#8 Updated by Matthieu Decorde about 8 years ago
- Description updated (diff)
#9 Updated by Matthieu Decorde about 8 years ago
- Description updated (diff)
#10 Updated by Matthieu Decorde about 8 years ago
- % Done changed from 0 to 80