Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Bricon2018-06-05 20:24:03 +0000
committerFred Bricon2018-06-05 20:24:03 +0000
commite4743f6e7b3e092ffbbeeab22189d86aef3c7912 (patch)
treeae11e531a7c231234ea370289e1aa846223d5cea /org.eclipse.m2e.editor
parentf2d82eac94243c1fcff9e6c001a42e99347fd65c (diff)
downloadm2e-core-e4743f6e7b3e092ffbbeeab22189d86aef3c7912.tar.gz
m2e-core-e4743f6e7b3e092ffbbeeab22189d86aef3c7912.tar.xz
m2e-core-e4743f6e7b3e092ffbbeeab22189d86aef3c7912.zip
Bug 394695 : slightly better Properties section layout in POM editor
Change-Id: I0fb7ec0309fc08dffca9883b67e0039ed7298831 Signed-off-by: Fred Bricon <fbricon@gmail.com>
Diffstat (limited to 'org.eclipse.m2e.editor')
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/OverviewPage.java12
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/PropertiesSection.java21
2 files changed, 30 insertions, 3 deletions
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/OverviewPage.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/OverviewPage.java
index 3325f405..da307ff9 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/OverviewPage.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/OverviewPage.java
@@ -556,9 +556,17 @@ public class OverviewPage extends MavenPomEditorPage {
modulesSection = toolkit.createSection(composite, //
ExpandableComposite.TITLE_BAR | ExpandableComposite.EXPANDED | ExpandableComposite.TWISTIE);
- modulesSection.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ GridData moduleSectionData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ modulesSection.setLayoutData(moduleSectionData);
modulesSection.setText(Messages.OverviewPage_section_modules);
modulesSection.setData("name", "modulesSection"); //$NON-NLS-1$ //$NON-NLS-2$
+ modulesSection.addExpansionListener(new ExpansionAdapter() {
+ public void expansionStateChanged(ExpansionEvent e) {
+ moduleSectionData.grabExcessVerticalSpace = e.getState();
+ modulesSection.getParent().layout();
+ }
+ });
modulesSectionComposite = toolkit.createComposite(modulesSection);
modulesStack = new StackLayout();
@@ -1219,7 +1227,7 @@ public class OverviewPage extends MavenPomEditorPage {
if((mask & RELOAD_PROPERTIES) != 0) {
propertiesSection.refresh();
Element props = findChild(root, PROPERTIES);
- propertiesSection.getSection().setExpanded(props != null);
+ propertiesSection.setExpanded(props != null);
//TODO used to check teh model's empty state as well, not done now..
}
}
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/PropertiesSection.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/PropertiesSection.java
index 25237339..205ce7b0 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/PropertiesSection.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/PropertiesSection.java
@@ -45,6 +45,8 @@ import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.events.ExpansionAdapter;
+import org.eclipse.ui.forms.events.ExpansionEvent;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;
@@ -83,6 +85,8 @@ public class PropertiesSection {
}
};
+ private GridData propertiesSectionData;
+
public PropertiesSection(FormToolkit toolkit, Composite composite, MavenPomEditorPage page) {
this.toolkit = toolkit;
this.composite = composite;
@@ -117,9 +121,16 @@ public class PropertiesSection {
private Section createSection() {
propertiesSection = toolkit.createSection(composite, //
ExpandableComposite.TITLE_BAR | ExpandableComposite.EXPANDED | ExpandableComposite.TWISTIE);
- propertiesSection.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+ propertiesSectionData = new GridData(SWT.FILL, SWT.FILL, true, false);
+ propertiesSection.setLayoutData(propertiesSectionData);
propertiesSection.setText(Messages.PropertiesSection_section_properties);
propertiesSection.setData("name", "propertiesSection"); //$NON-NLS-1$ //$NON-NLS-2$
+ propertiesSection.addExpansionListener(new ExpansionAdapter() {
+ public void expansionStateChanged(ExpansionEvent e) {
+ setExpanded(e.getState());
+ }
+ });
+
toolkit.paintBordersFor(propertiesSection);
propertiesEditor = new ListEditorComposite<PropertyElement>(propertiesSection, SWT.NONE);
@@ -270,4 +281,12 @@ public class PropertiesSection {
return name;
}
}
+
+ public void setExpanded(boolean expanded) {
+ propertiesSection.setExpanded(expanded);
+ if(propertiesSectionData != null) {
+ propertiesSectionData.grabExcessVerticalSpace = expanded;
+ propertiesSection.getParent().layout();
+ }
+ }
}

Back to the top