Mercurial > hg > thermostat-tools-eclipse
changeset 99:7484f4e4f587
Fix dirty states in master blocks
Use a SectionPart to manage dirty states. Notify it when
dirty and let it fix up dirty flag on save automatically.
author | Omair Majid <omajid@redhat.com> |
---|---|
date | Fri, 07 Feb 2014 13:24:10 -0500 |
parents | c3002fd38e27 |
children | c7b7fb3f5c58 |
files | com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/editor/BaseMasterDetailsBlock.java com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/editor/CommandsMasterDetailsBlock.java com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/editor/ExtensionsMasterDetailsBlock.java |
diffstat | 3 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/editor/BaseMasterDetailsBlock.java Fri Feb 07 12:57:54 2014 -0500 +++ b/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/editor/BaseMasterDetailsBlock.java Fri Feb 07 13:24:10 2014 -0500 @@ -32,6 +32,8 @@ protected Plugin model; + protected SectionPart sectionPart; + public void setModel(Plugin model) { this.model = model; } @@ -48,7 +50,8 @@ section.setText(getSectionTitle()); section.setDescription(getSectionDescription()); - final SectionPart sectionPart = new SectionPart(section); + sectionPart = new SectionPart(section); + managedForm.addPart(sectionPart); Composite sectionContents = toolkit.createComposite(section); GridLayout layout = new GridLayout(2, false);
--- a/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/editor/CommandsMasterDetailsBlock.java Fri Feb 07 12:57:54 2014 -0500 +++ b/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/editor/CommandsMasterDetailsBlock.java Fri Feb 07 13:24:10 2014 -0500 @@ -54,12 +54,13 @@ Command command = new Command(); command.setName(dialog.getName()); model.addCommand(command); + sectionPart.markDirty(); } } @Override void removeButtonSelected(Object selectedItem) { model.removeCommand((String) selectedItem); - + sectionPart.markDirty(); }; }
--- a/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/editor/ExtensionsMasterDetailsBlock.java Fri Feb 07 12:57:54 2014 -0500 +++ b/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/editor/ExtensionsMasterDetailsBlock.java Fri Feb 07 13:24:10 2014 -0500 @@ -54,6 +54,7 @@ Extension newExtension = new Extension(); newExtension.setName(dialog.getName()); model.addExtension(newExtension); + sectionPart.markDirty(); } } @@ -64,6 +65,7 @@ } model.removeExtension((String) selectedItem); + sectionPart.markDirty(); }; }