use of org.eclipse.ui.forms.events.ExpansionAdapter in project jbosstools-openshift by jbosstools.
the class ServerSettingsWizardPage method createResourceDetails.
private void createResourceDetails(IViewerObservableValue selectedResourceTreeItem, Composite parent, DataBindingContext dbc) {
ScrolledComposite scrolledComposite = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
scrolledComposite.setExpandHorizontal(true);
scrolledComposite.setExpandVertical(true);
ExpandableComposite expandable = new ExpandableComposite(scrolledComposite, SWT.None);
scrolledComposite.setContent(expandable);
expandable.setText("Resource Details");
expandable.setExpanded(true);
expandable.setLayout(new FillLayout());
Composite detailsContainer = new Composite(expandable, SWT.NONE);
expandable.setClient(detailsContainer);
expandable.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(ExpansionEvent e) {
getControl().update();
((Composite) getControl()).layout(true);
}
});
IObservableValue<IResource> selectedResource = new WritableValue<>();
ValueBindingBuilder.bind(selectedResourceTreeItem).converting(new ObservableTreeItem2ModelConverter()).to(selectedResource).notUpdatingParticipant().in(dbc);
new ResourceDetailViews(selectedResource, detailsContainer, dbc).createControls();
}
use of org.eclipse.ui.forms.events.ExpansionAdapter in project jbosstools-openshift by jbosstools.
the class ResourceSummaryDialog method createResourceDetails.
private void createResourceDetails(StructuredViewer viewer, Composite parent) {
ScrolledComposite scrolledComposite = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
scrolledComposite.setExpandHorizontal(true);
scrolledComposite.setExpandVertical(true);
ExpandableComposite expandable = new ExpandableComposite(scrolledComposite, SWT.None);
scrolledComposite.setContent(expandable);
expandable.setText("Resource Details");
expandable.setExpanded(true);
expandable.setLayout(new FillLayout());
Composite detailsContainer = new Composite(expandable, SWT.NONE);
expandable.setClient(detailsContainer);
expandable.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(ExpansionEvent e) {
parent.update();
parent.layout(true);
}
});
DataBindingContext dbc = new DataBindingContext();
IViewerObservableValue<Object> selectedResource = ViewerProperties.singlePostSelection().observe(viewer);
new ResourceDetailViews(selectedResource, detailsContainer, dbc).createControls();
}
use of org.eclipse.ui.forms.events.ExpansionAdapter 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.ExpansionAdapter 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.ExpansionAdapter 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;
}
Aggregations