use of org.eclipse.ui.forms.events.ExpansionAdapter in project hale by halestudio.
the class MismatchDetailsPage method createConsequenceSection.
private void createConsequenceSection(Composite parent) {
// create "Consequence" Section
Section sectionConsequence = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
ColumnLayoutData cd = new ColumnLayoutData();
sectionConsequence.setLayoutData(cd);
sectionConsequence.addExpansionListener(new ExpansionAdapter() {
public void expansionStateChanged(ExpansionEvent e) {
overviewForm.reflow(true);
}
});
sectionConsequence.setText("Consequence(s)");
sectionConsequence.setDescription("What impacts this mismatch has.");
Composite sectionConsequenceClient = toolkit.createComposite(sectionConsequence);
ColumnLayout consequenceColumnLayout = new ColumnLayout();
consequenceColumnLayout.maxNumColumns = 1;
sectionConsequenceClient.setLayout(consequenceColumnLayout);
Tree treeConsequence = toolkit.createTree(sectionConsequenceClient, SWT.NULL);
treeConsequence.setLayout(new ColumnLayout());
ColumnLayoutData treeLayoutData = new ColumnLayoutData(50, 123);
treeConsequence.setLayoutData(treeLayoutData);
toolkit.paintBordersFor(sectionConsequenceClient);
sectionConsequence.setClient(sectionConsequenceClient);
this.consequenceTreeViewer = new TreeViewer(treeConsequence);
this.consequenceTreeViewer.setContentProvider(new ConsequenceContentProvider());
this.consequenceTreeViewer.setLabelProvider(new ConsequenceLabelProvider());
}
use of org.eclipse.ui.forms.events.ExpansionAdapter in project xtext-eclipse by eclipse.
the class OptionsConfigurationBlock 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() {
@Override
public void expansionStateChanged(ExpansionEvent e) {
expandedStateChanged((ExpandableComposite) e.getSource());
}
});
expandedComposites.add(excomposite);
makeScrollableCompositeAware(excomposite);
return excomposite;
}
use of org.eclipse.ui.forms.events.ExpansionAdapter 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.ExpansionAdapter in project titan.EclipsePlug-ins by eclipse.
the class LoggingBitsSubPage method createSubSectionFileMaskBits.
void createSubSectionFileMaskBits(final FormToolkit toolkit, final ScrolledForm form, final Composite parent) {
Section section = toolkit.createSection(parent, Section.DESCRIPTION | ExpandableComposite.TITLE_BAR);
section.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
section.setText("File Log bitmask");
section.setExpanded(true);
section.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(final ExpansionEvent e) {
form.reflow(false);
}
});
Composite client = toolkit.createComposite(section, SWT.WRAP);
GridLayout layout = new GridLayout();
layout.numColumns = 1;
client.setLayout(layout);
section.setClient(client);
toolkit.paintBordersFor(client);
fileMaskViewer = new CheckboxTreeViewer(client, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
fileMaskViewer.setContentProvider(new LoggingBitsContentProvider());
fileMaskViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
fileMaskViewer.setLabelProvider(new LoggingBitsLabelProvider());
fileMaskViewer.addCheckStateListener(new ICheckStateListener() {
@Override
public void checkStateChanged(final CheckStateChangedEvent event) {
if (event.getChecked() && selectedLogEntry.getFileMaskRoot() == null) {
createFileMaskRootNode(loggingPage.getSelectedTreeElement(), selectedLogEntry);
}
checkStateChangeHandler(selectedLogEntry.getFileMaskBits(), selectedLogEntry.getFileMask(), event);
bitCompression(selectedLogEntry.getFileMaskBits(), selectedLogEntry.getFileMask());
evaluateSelection(fileMaskViewer, selectedLogEntry.getFileMaskBits());
if (!event.getChecked()) {
if (selectedLogEntry.getFileMaskBits().keySet().isEmpty()) {
ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), selectedLogEntry.getFileMaskRoot());
selectedLogEntry.setFileMaskRoot(null);
}
}
}
});
fileMaskViewer.getTree().addListener(SWT.MouseHover, new Listener() {
@Override
public void handleEvent(final Event event) {
TreeItem item = fileMaskViewer.getTree().getItem(new Point(event.x, event.y));
if (item != null) {
if (item.getData() instanceof LoggingBit) {
fileMaskViewer.getTree().setToolTipText(((LoggingBit) item.getData()).getToolTip());
return;
}
}
fileMaskViewer.getTree().setToolTipText("");
}
});
fileMaskViewer.addTreeListener(new ITreeViewerListener() {
@Override
public void treeCollapsed(final TreeExpansionEvent event) {
// Do nothing
}
@Override
public void treeExpanded(final TreeExpansionEvent event) {
evaluateSelection(fileMaskViewer, selectedLogEntry.getFileMaskBits());
}
});
if (selectedLogEntry == null) {
fileMaskViewer.getControl().setEnabled(false);
fileMaskViewer.setInput(new EnumMap<LoggingBit, ParseTree>(LoggingBit.class));
} else {
fileMaskViewer.getControl().setEnabled(true);
fileMaskViewer.setInput(selectedLogEntry.getFileMaskBits());
bitCompression(selectedLogEntry.getFileMaskBits(), selectedLogEntry.getFileMask());
evaluateSelection(fileMaskViewer, selectedLogEntry.getFileMaskBits());
}
}
use of org.eclipse.ui.forms.events.ExpansionAdapter in project titan.EclipsePlug-ins by eclipse.
the class LoggingBitsSubPage method createSubSectionConsoleMaskBits.
void createSubSectionConsoleMaskBits(final FormToolkit toolkit, final ScrolledForm form, final Composite parent) {
Section section = toolkit.createSection(parent, Section.DESCRIPTION | ExpandableComposite.TITLE_BAR);
section.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
section.setText("Console Log bitmask");
section.setExpanded(true);
section.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(final ExpansionEvent e) {
form.reflow(false);
}
});
Composite client = toolkit.createComposite(section, SWT.WRAP);
GridLayout layout = new GridLayout();
layout.numColumns = 1;
client.setLayout(layout);
section.setClient(client);
toolkit.paintBordersFor(client);
consoleMaskViewer = new CheckboxTreeViewer(client, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
consoleMaskViewer.setContentProvider(new LoggingBitsContentProvider());
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.heightHint = 230;
consoleMaskViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
consoleMaskViewer.setLabelProvider(new LoggingBitsLabelProvider());
consoleMaskViewer.addCheckStateListener(new ICheckStateListener() {
@Override
public void checkStateChanged(final CheckStateChangedEvent event) {
if (event.getChecked() && selectedLogEntry.getConsoleMaskRoot() == null) {
createConsoleMaskRootNode(loggingPage.getSelectedTreeElement(), selectedLogEntry);
}
checkStateChangeHandler(selectedLogEntry.getConsoleMaskBits(), selectedLogEntry.getConsoleMask(), event);
bitCompression(selectedLogEntry.getConsoleMaskBits(), selectedLogEntry.getConsoleMask());
evaluateSelection(consoleMaskViewer, selectedLogEntry.getConsoleMaskBits());
if (!event.getChecked()) {
if (selectedLogEntry.getConsoleMaskBits().keySet().isEmpty()) {
ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), selectedLogEntry.getConsoleMaskRoot());
selectedLogEntry.setConsoleMaskRoot(null);
}
}
}
});
consoleMaskViewer.getTree().addListener(SWT.MouseHover, new Listener() {
@Override
public void handleEvent(final Event event) {
TreeItem item = consoleMaskViewer.getTree().getItem(new Point(event.x, event.y));
if (item != null) {
if (item.getData() instanceof LoggingBit) {
consoleMaskViewer.getTree().setToolTipText(((LoggingBit) item.getData()).getToolTip());
return;
}
}
consoleMaskViewer.getTree().setToolTipText("");
}
});
consoleMaskViewer.addTreeListener(new ITreeViewerListener() {
@Override
public void treeCollapsed(final TreeExpansionEvent event) {
// Do nothing
}
@Override
public void treeExpanded(final TreeExpansionEvent event) {
evaluateSelection(consoleMaskViewer, selectedLogEntry.getConsoleMaskBits());
}
});
if (selectedLogEntry == null) {
consoleMaskViewer.getControl().setEnabled(false);
consoleMaskViewer.setInput(new EnumMap<LoggingBit, ParseTree>(LoggingBit.class));
} else {
consoleMaskViewer.getControl().setEnabled(true);
consoleMaskViewer.setInput(selectedLogEntry.getConsoleMaskBits());
bitCompression(selectedLogEntry.getConsoleMaskBits(), selectedLogEntry.getConsoleMask());
evaluateSelection(consoleMaskViewer, selectedLogEntry.getConsoleMaskBits());
}
}
Aggregations