use of org.eclipse.ui.forms.events.ExpansionEvent in project titan.EclipsePlug-ins by eclipse.
the class LoggingBitsSubPage method createSubSectionConsoleMaskBits.
void createSubSectionConsoleMaskBits(final FormToolkit toolkit, final ScrolledForm form, final Composite parent) {
final 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);
}
});
final Composite client = toolkit.createComposite(section, SWT.WRAP);
final 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());
final 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) {
final 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());
}
}
use of org.eclipse.ui.forms.events.ExpansionEvent in project titan.EclipsePlug-ins by eclipse.
the class ModuleParameterSectionPage method createDetailsPart.
private void createDetailsPart(final Composite parent, final ScrolledForm form, final FormToolkit toolkit) {
final Section section = toolkit.createSection(parent, Section.DESCRIPTION | ExpandableComposite.TITLE_BAR);
section.setActiveToggleColor(toolkit.getHyperlinkGroup().getActiveForeground());
section.setToggleColor(toolkit.getColors().getColor(IFormColors.SEPARATOR));
final Composite client = toolkit.createComposite(section, SWT.WRAP);
final GridLayout layout = new GridLayout();
layout.numColumns = 1;
client.setLayout(layout);
parameterValueText = toolkit.createText(client, "", SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
parameterValueText.setLayoutData(new GridData(GridData.FILL_BOTH));
parameterValueText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
final StructuredSelection selection = (StructuredSelection) moduleParametersTableViewer.getSelection();
final Iterator<?> iterator = selection.iterator();
if (!iterator.hasNext()) {
return;
}
final ModuleParameter moduleParameter = (ModuleParameter) iterator.next();
ConfigTreeNodeUtilities.setText(moduleParameter.getValue(), parameterValueText.getText());
if (valueChanged) {
valueChanged = false;
return;
}
editor.setDirty();
}
});
parameterValueText.setEnabled(moduleParametersHandler != null);
section.setText("Module parameter value");
section.setDescription("Specify the concrete value for the actually selected module parameter.");
section.setClient(client);
section.setExpanded(true);
section.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(final ExpansionEvent e) {
form.reflow(false);
}
});
final GridData gd = new GridData(GridData.FILL_BOTH);
gd.grabExcessVerticalSpace = true;
section.setLayoutData(gd);
}
use of org.eclipse.ui.forms.events.ExpansionEvent in project titan.EclipsePlug-ins by eclipse.
the class ErrorsWarningsPreferencePage 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);
final 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) {
final 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.ExpansionEvent in project titan.EclipsePlug-ins by eclipse.
the class BaseNamingConventionPropertyPage 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);
final 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) {
final Point point = pagecomp.computeSize(SWT.DEFAULT, SWT.DEFAULT);
((ScrolledComposite) temp).setMinSize(point);
((ScrolledComposite) temp).layout(true, true);
}
}
});
return ex;
}
Aggregations