Skip to content

Commit 80ac0d6

Browse files
(v2) Scene editor: do not dispose property rows, just hide/show them.
1 parent 895a766 commit 80ac0d6

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

source/v2/phasereditor/phasereditor.ui/src/phasereditor/ui/properties/FormPropertyPage.java

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,25 @@ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
120120

121121
// dispose all rows with irrelevant sections
122122

123+
// for (var control : _sectionsContainer.getChildren()) {
124+
// var row = (RowComp) control;
125+
//
126+
// var newSection = sectionMap.get(row.getSection().getClass());
127+
//
128+
// if (newSection == null) {
129+
// row.dispose();
130+
// }
131+
// }
132+
123133
for (var control : _sectionsContainer.getChildren()) {
124134
var row = (RowComp) control;
125135

126136
var newSection = sectionMap.get(row.getSection().getClass());
127137

128138
if (newSection == null) {
129-
row.dispose();
139+
row.setVisible(false);
140+
var gd = (GridData) row.getLayoutData();
141+
gd.heightHint = 0;
130142
}
131143
}
132144

@@ -141,6 +153,9 @@ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
141153
var oldSection = row.getSection();
142154

143155
if (oldSection.getClass() == section.getClass()) {
156+
row.setVisible(true);
157+
var gd = (GridData) row.getLayoutData();
158+
gd.heightHint = -1;
144159
oldSection.setModels(models);
145160
oldSection.update_UI_from_Model();
146161
createNew = false;
@@ -209,12 +224,12 @@ public RowComp(Composite parent, FormPropertySection section) {
209224

210225
var control = section.createContent(this);
211226
control.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
212-
227+
213228
var toolbarManager = new ToolBarManager();
214229
section.fillToolbar(toolbarManager);
215230
var toolbar = toolbarManager.createControl(header);
216231
toolbar.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false));
217-
232+
218233
section.update_UI_from_Model();
219234

220235
if (collapsed) {
@@ -277,7 +292,9 @@ public void createControl(Composite parent) {
277292
_scrolledCompo = new ScrolledComposite(parent, SWT.V_SCROLL);
278293
_sectionsContainer = new Composite(_scrolledCompo, SWT.NONE);
279294
_sectionsContainer.setBackgroundMode(SWT.INHERIT_FORCE);
280-
_sectionsContainer.setLayout(new GridLayout(1, false));
295+
var layout = new GridLayout(1, false);
296+
layout.verticalSpacing = 0;
297+
_sectionsContainer.setLayout(layout);
281298

282299
_scrolledCompo.setContent(_sectionsContainer);
283300
_scrolledCompo.setExpandVertical(true);

0 commit comments

Comments
 (0)