use of org.eclipse.ui.forms.events.ExpansionEvent 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.ExpansionEvent 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.ExpansionEvent 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.ExpansionEvent in project linuxtools by eclipse.
the class OSIOWorkitemLinkAttributeEditor method createControl.
@Override
public void createControl(Composite parent, FormToolkit toolkit) {
initialize();
selectionProvider = new SelectionProviderAdapter();
actionGroup = new CommentActionGroup();
MenuManager menuManager = new MenuManager();
menuManager.setRemoveAllWhenShown(true);
menuManager.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
// get comment and add reply action as first item in the menu
ISelection selection = selectionProvider.getSelection();
if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
ReplyToCommentAction replyAction = new ReplyToCommentAction(currentViewer);
manager.add(replyAction);
}
actionGroup.setContext(new ActionContext(selectionProvider.getSelection()));
actionGroup.fillContextMenu(manager);
if (currentViewer != null && currentViewer.getEditor() instanceof RichTextAttributeEditor) {
RichTextAttributeEditor editor = (RichTextAttributeEditor) currentViewer.getEditor();
if (editor.getViewSourceAction().isEnabled()) {
// $NON-NLS-1$
manager.add(new Separator("planning"));
manager.add(editor.getViewSourceAction());
}
}
}
});
getTaskEditorPage().getEditorSite().registerContextMenu(ID_POPUP_MENU, menuManager, selectionProvider, false);
commentMenu = menuManager.createContextMenu(parent);
section = createSection(parent, toolkit, hasIncoming);
// $NON-NLS-1$ //$NON-NLS-2$
section.setText(section.getText() + " (" + commentAttributes.size() + ")");
if (commentAttributes.isEmpty()) {
section.setEnabled(false);
} else {
if (hasIncoming) {
expandSection(toolkit, section);
} else {
section.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(ExpansionEvent event) {
if (section.getClient() == null) {
try {
expandAllInProgress = true;
getTaskEditorPage().setReflow(false);
expandSection(toolkit, section);
} finally {
expandAllInProgress = false;
getTaskEditorPage().setReflow(true);
}
reflow();
}
}
});
}
}
setSection(toolkit, section);
}
use of org.eclipse.ui.forms.events.ExpansionEvent in project yamcs-studio by yamcs.
the class AddToStackWizardPage2 method createControl.
@Override
public void createControl(Composite parent) {
controlComposite = new Composite(parent, SWT.NONE);
setControl(controlComposite);
controlComposite.setLayout(new GridLayout());
// command namespace selection
Composite namespaceComposite = new Composite(controlComposite, SWT.NONE);
namespaceComposite.setLayout(new GridLayout(2, false));
Label chooseNamespace = new Label(namespaceComposite, SWT.NONE);
chooseNamespace.setText("Choose Command Namespace: ");
namespaceCombo = new Combo(namespaceComposite, SWT.READ_ONLY);
namespaceCombo.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
command.setSelectedAliase(aliases.get(namespaceCombo.getSelectionIndex()));
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
// expandable command options
ExpandableComposite ec = new ExpandableComposite(controlComposite, ExpandableComposite.TREE_NODE | ExpandableComposite.CLIENT_INDENT);
ec.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
ec.setLayout(new GridLayout(1, false));
ec.setExpanded(false);
ec.setText("Command Options");
Composite optionsComposite = new Composite(ec, SWT.NONE);
optionsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
optionsComposite.setLayout(new GridLayout(2, false));
Label l1 = new Label(optionsComposite, SWT.NONE);
l1.setText("Comment");
GridData gridData = new GridData(SWT.NONE, SWT.TOP, false, false);
l1.setLayoutData(gridData);
Text comment = new Text(optionsComposite, SWT.WRAP | SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);
comment.setText(command.getComment() != null ? command.getComment() : "");
gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
gridData.heightHint = 2 * comment.getLineHeight();
comment.setLayoutData(gridData);
ec.setClient(optionsComposite);
ec.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(ExpansionEvent e) {
parent.layout(true);
controlComposite.layout(true);
}
});
comment.addModifyListener(evt -> {
if (comment.getText().trim().isEmpty()) {
command.setComment(null);
} else {
command.setComment(comment.getText());
}
});
// argument table
atb = new ArgumentTableBuilder(command);
atb.createArgumentTable(controlComposite);
}
Aggregations