use of org.eclipse.jface.viewers.ISelectionChangedListener in project tdi-studio-se by Talend.
the class ConfigureChartDialog method createAttributesViewer.
/**
* Creates the attributes viewer.
*
* @param parent The parent composite
* @return The attribute viewer
*/
private TreeViewer createAttributesViewer(Composite parent) {
TreeViewer viewer = new TreeViewer(parent, SWT.BORDER | SWT.FULL_SELECTION);
viewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
viewer.setContentProvider(new MBeanAttributeContentProvider());
viewer.setLabelProvider(new MBeanAttributeLabelProvider(viewer));
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
viewerSlectionChanged((IStructuredSelection) event.getSelection());
}
});
configureTree(viewer.getTree());
viewer.setInput(attributes.toArray(new MBeanAttribute[attributes.size()]));
return viewer;
}
use of org.eclipse.jface.viewers.ISelectionChangedListener in project tdi-studio-se by Talend.
the class LoadChartSetDialog method createChartSetViewer.
/**
* Creates the chart set viewer.
*
* @param parent The parent composite
* @return The chart set viewer
*/
private TableViewer createChartSetViewer(Composite parent) {
final TableViewer viewer = new TableViewer(parent, SWT.BORDER | SWT.FULL_SELECTION);
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.heightHint = 300;
viewer.getTable().setLayoutData(gridData);
viewer.setContentProvider(new ArrayContentProvider());
viewer.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
if (element.equals(defaultChartSet)) {
return NLS.bind(Messages.defaultChartSet, defaultChartSet);
}
return super.getText(element);
}
});
viewer.setInput(chartSets.toArray(new String[chartSets.size()]));
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
ISelection selection = event.getSelection();
Object element = ((StructuredSelection) selection).getFirstElement();
if (deleteButton != null) {
deleteButton.setEnabled(!selection.isEmpty() && !predefinedChartSets.contains(element));
}
if (element != null) {
chartSet = element.toString();
} else {
viewer.setSelection(new StructuredSelection(chartSet));
}
}
});
viewer.setSelection(new StructuredSelection(defaultChartSet));
return viewer;
}
use of org.eclipse.jface.viewers.ISelectionChangedListener in project tdi-studio-se by Talend.
the class SWTResourcesPage method createSashFormControls.
/*
* @see AbstractSashForm#createSashFormControls(SashForm, IActionBars)
*/
@Override
protected void createSashFormControls(SashForm sashForm, IActionBars actionBars) {
resourceFilteredTree = new SWTResourceFilteredTree(sashForm, actionBars);
TreeViewer resourceViewer = resourceFilteredTree.getViewer();
resourceViewer.setContentProvider(new SWTResourceContentProvider(resourceViewer));
resourceViewer.setLabelProvider(new SWTResourceLabelProvider());
resourceViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
ISelection selection = event.getSelection();
if (selection.isEmpty()) {
selection = null;
}
stackTraceViewer.setInput(selection);
}
});
stackTraceViewer = new StackTraceViewer(sashForm, actionBars);
}
use of org.eclipse.jface.viewers.ISelectionChangedListener in project tdi-studio-se by Talend.
the class ComponentSettingsView method createPartControl.
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createPartControl(Composite parent) {
this.parent = parent;
tabFactory.initComposite(parent, true);
tabFactory.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
TalendPropertyTabDescriptor descriptor = (TalendPropertyTabDescriptor) selection.getFirstElement();
if (descriptor == null) {
return;
}
if (currentSelectedTab != null && (!currentSelectedTab.getData().equals(descriptor.getData()) || currentSelectedTab.getCategory() != descriptor.getCategory())) {
for (Control curControl : tabFactory.getTabComposite().getChildren()) {
curControl.dispose();
}
}
if (element == null || !element.equals(descriptor.getData()) || currentSelectedTab == null || currentSelectedTab.getCategory() != descriptor.getCategory() || selectedPrimary) {
element = (Element) descriptor.getData();
currentSelectedTab = descriptor;
if (descriptor.getData() instanceof ConnectionLabel) {
createDynamicComposite(tabFactory.getTabComposite(), ((ConnectionLabel) descriptor.getData()).getConnection(), descriptor.getCategory());
} else {
createDynamicComposite(tabFactory.getTabComposite(), (Element) descriptor.getData(), descriptor.getCategory());
}
selectedPrimary = false;
}
}
});
}
use of org.eclipse.jface.viewers.ISelectionChangedListener in project tdi-studio-se by Talend.
the class MemoryRuntimeComposite method initContextInput.
@SuppressWarnings("unchecked")
private void initContextInput() {
List<IContext> contextList = (List<IContext>) viewPart.getContextComposite().getContextComboInput();
if (contextList != null) {
contextCombo.setSelection(new StructuredSelection(contextList.get(0)));
contextCombo.setInput(contextList);
ComboViewer processContextComboViewer = viewPart.getContextComposite().getContextComboViewer();
IContext selectedContext = (IContext) ((IStructuredSelection) processContextComboViewer.getSelection()).getFirstElement();
for (int i = 0; i < contextList.size(); i++) {
if (contextList.get(i).getName().equals(selectedContext.getName())) {
contextCombo.getCombo().select(i);
}
}
contextCombo.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
viewPart.getContextComposite().runSelectionChange(event);
}
});
} else {
contextCombo.getCombo().setEnabled(false);
}
}
Aggregations