use of org.eclipse.jface.viewers.IStructuredSelection in project tesb-studio-se by Talend.
the class CamelDependenciesPanel method moveUp.
private void moveUp() {
ManifestItem selected = (ManifestItem) ((IStructuredSelection) tableViewer.getSelection()).getFirstElement();
List input = (List) tableViewer.getInput();
int index = input.indexOf(selected);
int size = input.size();
int targetIndex = index - 1;
if (targetIndex < 0 || ((ManifestItem) input.get(targetIndex)).isBuiltIn()) {
targetIndex = size - 1;
}
input.remove(selected);
input.add(targetIndex, selected);
tableViewer.refresh();
tableViewer.setSelection(new StructuredSelection(selected));
tableViewer.getTable().showSelection();
fireDependenciesChangedListener();
}
use of org.eclipse.jface.viewers.IStructuredSelection 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.IStructuredSelection 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);
}
}
use of org.eclipse.jface.viewers.IStructuredSelection in project tdi-studio-se by Talend.
the class JobVMArgumentsComposite method removePressed.
private void removePressed() {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
if (selection.isEmpty()) {
return;
}
for (Object obj : selection.toArray()) {
list.remove(obj);
}
viewer.refresh();
doSave();
selectionChanged();
}
use of org.eclipse.jface.viewers.IStructuredSelection in project tdi-studio-se by Talend.
the class JobVMArgumentsComposite method editItem.
protected void editItem(ISelection sel) {
IStructuredSelection selection = (IStructuredSelection) sel;
String existing = (String) selection.getFirstElement();
String value = getExistingInputObject(existing.trim());
if (value != null) {
int indexOf = list.indexOf(existing);
list.remove(existing);
list.add(indexOf, value);
viewer.refresh();
doSave();
}
}
Aggregations