use of org.eclipse.ui.forms.events.ExpansionAdapter in project titan.EclipsePlug-ins by eclipse.
the class NamingConventionPreferencePage method createExtendableComposite.
/**
* Creates an expandable composite on the user interface.
*
* @param parent
* the parent composite where this one can be added to.
* @param title
* the title of the new composite.
*
* @return the created composite.
*/
private ExpandableComposite createExtendableComposite(final Composite parent, final String title) {
final ExpandableComposite ex = new ExpandableComposite(parent, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT | ExpandableComposite.COMPACT);
ex.setText(title);
ex.setExpanded(false);
GridData data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalSpan = 2;
ex.setLayoutData(data);
ex.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(final ExpansionEvent e) {
Composite temp = parent;
while (temp != null && !(temp instanceof ScrolledComposite)) {
temp = temp.getParent();
}
if (temp != null) {
Point point = pagecomp.computeSize(SWT.DEFAULT, SWT.DEFAULT);
((ScrolledComposite) temp).setMinSize(point);
((ScrolledComposite) temp).layout(true, true);
}
}
});
return ex;
}
use of org.eclipse.ui.forms.events.ExpansionAdapter in project eclipse-integration-commons by spring-projects.
the class DashboardMainPage method setUpExpandableSection.
private void setUpExpandableSection(final Section section, final String prefId, boolean defaultExpanded) {
section.setExpanded(getStoredExpandedState(prefId, defaultExpanded));
section.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(ExpansionEvent e) {
if (e.getState()) {
prefStore.setValue(prefId, IIdeUiConstants.SECTION_EXPANDED);
} else {
prefStore.setValue(prefId, IIdeUiConstants.SECTION_COLLAPSED);
}
if (isContributedSection(section)) {
// If we're expanding a contributed section, close the
// update section...
updateSection.setExpanded(false);
prefStore.setValue(IIdeUiConstants.PREF_UPDATE_SECTION_COLLAPSE, IIdeUiConstants.SECTION_COLLAPSED);
}
// interest
for (AbstractDashboardPart part : parts) {
if (!section.equals(part.getControl()) && part.getControl() instanceof Section) {
((Section) part.getControl()).setExpanded(false);
prefStore.setValue(getExpansionPropertyId(part), IIdeUiConstants.SECTION_COLLAPSED);
}
}
adjustCollapsableSections();
}
});
}
use of org.eclipse.ui.forms.events.ExpansionAdapter in project webtools.sourceediting by eclipse.
the class AbstractXSLPreferencePage method createTwistie.
protected Composite createTwistie(Composite parent, String label, int cols) {
ExpandableComposite excomposite = new ExpandableComposite(parent, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
excomposite.setText(label);
excomposite.setExpanded(false);
excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
excomposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, cols, 1));
excomposite.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(ExpansionEvent e) {
expandedStateChanged((ExpandableComposite) e.getSource());
}
});
fExpandables.add(excomposite);
makeScrollableCompositeAware(excomposite);
Composite twistieCient = new Composite(excomposite, SWT.NONE);
excomposite.setClient(twistieCient);
GridLayout layout = new GridLayout(2, false);
layout.marginRight = 5;
twistieCient.setLayout(layout);
GridData gd = new GridData(SWT.FILL, SWT.NONE, true, false);
twistieCient.setLayoutData(gd);
return twistieCient;
}
use of org.eclipse.ui.forms.events.ExpansionAdapter in project hale by halestudio.
the class MismatchDetailsPage method createMismatchSection.
@SuppressWarnings("unused")
private void createMismatchSection(Composite parent) {
// create "Mismatch" Section
Section sectionMismatch = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
ColumnLayoutData cd = new ColumnLayoutData();
sectionMismatch.setLayoutData(cd);
sectionMismatch.addExpansionListener(new ExpansionAdapter() {
public void expansionStateChanged(ExpansionEvent e) {
overviewForm.reflow(true);
}
});
sectionMismatch.setText("Mismatch");
sectionMismatch.setDescription("General information on this mismatch.");
Composite sectionMismatchClient = toolkit.createComposite(sectionMismatch);
sectionMismatchClient.setLayout(new GridLayout(2, false));
Label labelType = toolkit.createLabel(sectionMismatchClient, "Type:");
this.textType = toolkit.createText(sectionMismatchClient, "");
this.textType.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
this.textType.setEditable(false);
Label labelProvenance = toolkit.createLabel(sectionMismatchClient, "Provenance:");
this.textProvenance = toolkit.createText(sectionMismatchClient, "");
this.textProvenance.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
this.textProvenance.setEditable(false);
Label labelStatus = toolkit.createLabel(sectionMismatchClient, "Status:");
this.textStatus = toolkit.createText(sectionMismatchClient, "");
this.textStatus.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
Label labelComment = toolkit.createLabel(sectionMismatchClient, "Comments:");
GridData gd = new GridData();
gd.horizontalSpan = 2;
labelComment.setLayoutData(gd);
this.textComment = toolkit.createText(sectionMismatchClient, "", SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
gd = new GridData();
gd.horizontalSpan = 2;
gd.grabExcessVerticalSpace = true;
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
gd.verticalAlignment = SWT.FILL;
gd.heightHint = 40;
textComment.setLayoutData(gd);
toolkit.paintBordersFor(sectionMismatchClient);
sectionMismatch.setClient(sectionMismatchClient);
}
use of org.eclipse.ui.forms.events.ExpansionAdapter in project hale by halestudio.
the class MismatchDetailsPage method createReasonSection.
private void createReasonSection(Composite parent) {
// create "Reason" Section
Section sectionReason = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
ColumnLayoutData cd = new ColumnLayoutData();
sectionReason.setLayoutData(cd);
sectionReason.addExpansionListener(new ExpansionAdapter() {
public void expansionStateChanged(ExpansionEvent e) {
overviewForm.reflow(true);
}
});
sectionReason.setText("Reason");
sectionReason.setDescription("Why this mismatch occurs.");
Composite sectionReasonClient = toolkit.createComposite(sectionReason);
ColumnLayout reasonColumnLayout = new ColumnLayout();
reasonColumnLayout.maxNumColumns = 1;
sectionReasonClient.setLayout(reasonColumnLayout);
Tree treeReason = toolkit.createTree(sectionReasonClient, SWT.NULL);
treeReason.setLayout(new ColumnLayout());
ColumnLayoutData treeLayoutData = new ColumnLayoutData(50, 123);
treeReason.setLayoutData(treeLayoutData);
toolkit.paintBordersFor(sectionReasonClient);
sectionReason.setClient(sectionReasonClient);
this.reasonTreeViewer = new TreeViewer(treeReason);
this.reasonTreeViewer.setContentProvider(new ReasonContentProvider());
this.reasonTreeViewer.setLabelProvider(new ReasonLabelProvider());
}
Aggregations