diff --git a/CIMToolPlugin/plugin.xml b/CIMToolPlugin/plugin.xml index eae2ba33..5b0fd957 100644 --- a/CIMToolPlugin/plugin.xml +++ b/CIMToolPlugin/plugin.xml @@ -119,7 +119,7 @@ id="au.com.langdale.cimtoole.wizards.ImportCopyrightTemplates" name="Import Copyright Templates"> - A wizard for importing copyright templates to be used in relevant profiles for a given project. + Import and/or configure copyright templates to be used in the artifacts generated by a project. http://wiki.cimtool.org - This software is Copyright 2005-2013 Langdale Consultants + This software is Copyright 2005-2023 Langdale Consultants except where otherwise stated. Langdale Consultants can be contacted at: http://www.langdale.com.au diff --git a/RCPUtil/src/au/com/langdale/ui/builder/Templates.java b/RCPUtil/src/au/com/langdale/ui/builder/Templates.java index 612d67ac..3dc2255c 100644 --- a/RCPUtil/src/au/com/langdale/ui/builder/Templates.java +++ b/RCPUtil/src/au/com/langdale/ui/builder/Templates.java @@ -418,6 +418,24 @@ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } } + private static class MyFileFieldEditor extends FileFieldEditor { + private Button button; + + public MyFileFieldEditor(String name, String text, Composite area) { + super(name, text, area); + } + + protected Button getChangeControl(Composite parent) { + if (button == null) + button = super.getChangeControl(parent); + return button; + } + + public Button getButton() { + return button; + } + } + private static class FileFieldTemplate extends SubjectTemplate { private String[] extensions; @@ -427,18 +445,28 @@ private static class FileFieldTemplate extends SubjectTemplate { } protected void register(Control widget, Assembly assembly) { - if (name != null) - assembly.putControl(name, widget); + if (name != null) { + if (widget instanceof Button) { + assembly.putControl(name + "-button", widget); + } else { + assembly.putControl(name, widget); + } + } } public Control realise(Composite parent, Assembly assembly) { Composite area = new Composite(parent, SWT.NONE); - FileFieldEditor editor = new FileFieldEditor(name, text, area); + + MyFileFieldEditor editor = new MyFileFieldEditor(name, text, area); + editor.setFileExtensions(extensions); Text field = editor.getTextControl(area); field.addModifyListener(assembly.modifyListener); register(field, assembly); + + Button button = editor.getButton(); + register(button, assembly); return area; } @@ -817,6 +845,10 @@ public static Template DisplayArea(String name, boolean scroll) { public static Template DisplayArea(String name, int lines) { return new TextTemplate(SWT.MULTI | SWT.WRAP | SWT.READ_ONLY, name, "", lines); } + + public static Template DisplayArea(String name, int lines, boolean scroll) { + return new TextTemplate(SWT.MULTI | SWT.WRAP | SWT.READ_ONLY | (scroll ? SWT.V_SCROLL : 0) | (scroll ? SWT.H_SCROLL : 0), name, "", lines); + } public static Template Label(String text) { return new LabelTemplate(SWT.NONE, null, text);