use of org.eclipse.ui.forms.events.ExpansionEvent in project bndtools by bndtools.
the class JAREntryPart method createContent.
private void createContent(Composite parent, FormToolkit toolkit) {
Section textSection = toolkit.createSection(parent, ExpandableComposite.TITLE_BAR | ExpandableComposite.EXPANDED);
textSection.setText("Entry Content");
Composite textComposite = toolkit.createComposite(textSection);
text = toolkit.createText(textComposite, "", SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.READ_ONLY);
text.setFont(JFaceResources.getTextFont());
textSection.setClient(textComposite);
Section encodingSection = toolkit.createSection(parent, ExpandableComposite.TITLE_BAR | ExpandableComposite.EXPANDED);
encodingSection.setText("Display Options");
Composite encodingPanel = toolkit.createComposite(encodingSection);
encodingSection.setClient(encodingPanel);
toolkit.createLabel(encodingPanel, "Show As:");
final Button btnText = toolkit.createButton(encodingPanel, "Text", SWT.RADIO);
btnText.setSelection(showAsText);
Button btnBinary = toolkit.createButton(encodingPanel, "Binary (hex)", SWT.RADIO);
btnBinary.setSelection(!showAsText);
toolkit.createLabel(encodingPanel, "Text Encoding:");
final Combo encodingCombo = new Combo(encodingPanel, SWT.READ_ONLY);
encodingCombo.setEnabled(showAsText);
// INITIALISE
encodingCombo.setItems(charsets);
encodingCombo.select(selectedCharset);
// LISTENERS
encodingSection.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(ExpansionEvent e) {
getManagedForm().reflow(true);
}
});
SelectionListener radioListener = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
showAsText = btnText.getSelection();
encodingCombo.setEnabled(showAsText);
loadContent();
}
};
btnText.addSelectionListener(radioListener);
btnBinary.addSelectionListener(radioListener);
encodingCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
selectedCharset = encodingCombo.getSelectionIndex();
loadContent();
}
});
// LAYOUT
GridLayout layout;
GridData gd;
layout = new GridLayout(1, false);
parent.setLayout(layout);
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
textSection.setLayoutData(gd);
layout = new GridLayout(1, false);
textComposite.setLayout(layout);
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
text.setLayoutData(gd);
gd = new GridData(SWT.FILL, SWT.FILL, true, false);
encodingSection.setLayoutData(gd);
encodingSection.setLayout(new FillLayout());
encodingPanel.setLayout(new GridLayout(3, false));
encodingCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
}
use of org.eclipse.ui.forms.events.ExpansionEvent in project eclipse-integration-commons by spring-projects.
the class ExpandableSection method createContents.
@Override
public void createContents(final Composite page) {
final ExpandableComposite comp = new ExpandableComposite(page, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, false).applyTo(comp);
comp.setText(title);
comp.setLayout(new FillLayout());
comp.addExpansionListener(new IExpansionListener() {
public void expansionStateChanging(ExpansionEvent e) {
}
@Override
public void expansionStateChanged(ExpansionEvent e) {
expansionState.setValue(comp.isExpanded());
reflow(owner, comp);
}
});
expansionState.addListener(new ValueListener<Boolean>() {
public void gotValue(LiveExpression<Boolean> exp, Boolean value) {
if (value != null && comp != null && !comp.isDisposed()) {
boolean newState = value;
boolean currentState = comp.isExpanded();
if (currentState != newState) {
comp.setExpanded(newState);
reflow(owner, comp);
}
}
}
});
visibleState.addListener(new ValueListener<Boolean>() {
@Override
public void gotValue(LiveExpression<Boolean> exp, Boolean value) {
if (value != null && comp != null && !comp.isDisposed()) {
boolean newState = value;
comp.setVisible(newState);
GridData data = (GridData) comp.getLayoutData();
data.exclude = !newState;
reflow(owner, comp);
}
}
});
Composite client = new Composite(comp, SWT.NONE);
client.setLayout(new GridLayout());
child.createContents(client);
comp.setClient(client);
}
use of org.eclipse.ui.forms.events.ExpansionEvent in project webtools.sourceediting by eclipse.
the class AbstractValidationSettingsPage method createStyleSectionWithContentComposite.
protected Composite createStyleSectionWithContentComposite(Composite parent, String label, int nColumns) {
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, nColumns, 1));
excomposite.addExpansionListener(new ExpansionAdapter() {
public void expansionStateChanged(ExpansionEvent e) {
expandedStateChanged((ExpandableComposite) e.getSource());
}
});
fExpandables.add(excomposite);
makeScrollableCompositeAware(excomposite);
Composite inner = new Composite(excomposite, SWT.NONE);
inner.setFont(excomposite.getFont());
inner.setLayout(new GridLayout(nColumns, false));
excomposite.setClient(inner);
return inner;
}
use of org.eclipse.ui.forms.events.ExpansionEvent in project webtools.sourceediting by eclipse.
the class AbstractValidationSettingsPage method createStyleSection.
protected ExpandableComposite createStyleSection(Composite parent, String label, int nColumns) {
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, nColumns, 1));
excomposite.addExpansionListener(new ExpansionAdapter() {
public void expansionStateChanged(ExpansionEvent e) {
expandedStateChanged((ExpandableComposite) e.getSource());
}
});
fExpandables.add(excomposite);
makeScrollableCompositeAware(excomposite);
return excomposite;
}
use of org.eclipse.ui.forms.events.ExpansionEvent in project webtools.sourceediting by eclipse.
the class XSLValidationPreferencePage method createTwistie.
protected ExpandableComposite createTwistie(Composite parent, String label, int nColumns) {
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, nColumns, 1));
excomposite.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(ExpansionEvent e) {
expandedStateChanged((ExpandableComposite) e.getSource());
}
});
Expandables.add(excomposite);
makeScrollableCompositeAware(excomposite);
return excomposite;
}
Aggregations