use of org.eclipse.swt.events.SelectionAdapter in project tdi-studio-se by Talend.
the class SetupProcessDependenciesRoutinesDialog method createTabFolderField.
private void createTabFolderField(Composite parent) {
// tab
folder = new CTabFolder(parent, SWT.NONE);
folder.setLayoutData(new GridData(GridData.FILL_BOTH));
folder.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateButtons();
}
});
userTabItem = new CTabItem(folder, SWT.NONE);
//$NON-NLS-1$
userTabItem.setText(Messages.getString("SetupProcessDependenciesRoutinesDialog.userRoutineLabel"));
systemTabItem = new CTabItem(folder, SWT.NONE);
//$NON-NLS-1$
systemTabItem.setText(Messages.getString("SetupProcessDependenciesRoutinesDialog.systemRoutineLabel"));
folder.setSelection(userTabItem);
folder.setSimple(false);
ISelectionChangedListener listListener = new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
updateButtons();
}
};
// user
Composite userComposite = new Composite(folder, SWT.NONE);
userComposite.setLayout(new GridLayout());
userComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
userViewer = new ListViewer(userComposite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
userViewer.setLabelProvider(new RoutineRecordLabelProvider());
userViewer.setContentProvider(ArrayContentProvider.getInstance());
userViewer.setInput(userRoutines);
userViewer.getList().setLayoutData(new GridData(GridData.FILL_BOTH));
userViewer.addSelectionChangedListener(listListener);
userTabItem.setControl(userComposite);
// system
Composite systemComposite = new Composite(folder, SWT.NONE);
systemComposite.setLayout(new GridLayout());
systemComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
systemViewer = new ListViewer(systemComposite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
systemViewer.setLabelProvider(new RoutineRecordLabelProvider());
systemViewer.setContentProvider(ArrayContentProvider.getInstance());
systemViewer.setInput(systemRoutines);
systemViewer.getList().setLayoutData(new GridData(GridData.FILL_BOTH));
systemViewer.addSelectionChangedListener(listListener);
systemTabItem.setControl(systemComposite);
}
use of org.eclipse.swt.events.SelectionAdapter in project tdi-studio-se by Talend.
the class SetupProcessDependenciesRoutinesDialog method createButtonField.
private void createButtonField(Composite parent) {
Composite btnComposite = new Composite(parent, SWT.NONE);
btnComposite.setLayout(new GridLayout());
GridData layoutData = new GridData(GridData.FILL_VERTICAL);
layoutData.verticalAlignment = SWT.CENTER;
btnComposite.setLayoutData(layoutData);
addBtn = new Button(btnComposite, SWT.PUSH);
addBtn.setImage(ImageProvider.getImage(EImage.ADD_ICON));
addBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
ListViewer currentViewer = getCurrentViewer();
if (currentViewer == null) {
return;
}
boolean system = (currentViewer == systemViewer);
List<RoutineItemRecord> currentRecords = getCurrentRecords();
ShowRoutineItemsDialog dialog = new ShowRoutineItemsDialog(getShell(), allRoutineItems, currentRecords, system);
if (dialog.open() == Window.OK) {
Property[] selectedItems = dialog.getSelectedItems();
List<Property> needAddedItems = new ArrayList<Property>();
// filter
for (Property p : selectedItems) {
boolean found = false;
for (RoutineItemRecord record : currentRecords) {
if (system) {
found = p.getLabel().equals(record.getLabel());
} else {
found = p.getId().equals(record.getId());
}
}
if (!found) {
needAddedItems.add(p);
}
}
// create
for (Property p : needAddedItems) {
RoutineItemRecord newOne = new RoutineItemRecord();
newOne.setId(p.getId());
newOne.setLabel(p.getLabel());
newOne.setName(p.getLabel());
newOne.setVersion(p.getVersion());
currentRecords.add(newOne);
}
//
currentViewer.setInput(currentRecords);
currentViewer.refresh();
updateButtons();
}
}
});
delBtn = new Button(btnComposite, SWT.PUSH);
delBtn.setImage(ImageProvider.getImage(EImage.DELETE_ICON));
delBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
ListViewer currentViewer = getCurrentViewer();
List<RoutineItemRecord> currentRecords = getCurrentRecords();
if (currentViewer != null && !((IStructuredSelection) currentViewer.getSelection()).isEmpty()) {
Iterator iterator = ((IStructuredSelection) currentViewer.getSelection()).iterator();
int index = 0;
while (iterator.hasNext()) {
Object selectedRecord = iterator.next();
if (currentRecords != null && selectedRecord != null) {
index = currentRecords.indexOf(selectedRecord);
currentRecords.remove(selectedRecord);
if (index > currentRecords.size() - 1) {
index = currentRecords.size() - 1;
} else if (index < 0) {
index = 0;
}
}
}
currentViewer.setInput(currentRecords);
currentViewer.getList().select(index);
currentViewer.refresh();
}
updateButtons();
}
});
upBtn = new Button(btnComposite, SWT.PUSH);
upBtn.setImage(ImageProvider.getImage(EImage.UP_ICON));
upBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
moveDatas(true);
}
});
downBtn = new Button(btnComposite, SWT.PUSH);
downBtn.setImage(ImageProvider.getImage(EImage.DOWN_ICON));
downBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
moveDatas(false);
}
});
}
use of org.eclipse.swt.events.SelectionAdapter in project tdi-studio-se by Talend.
the class MapperUI method configureZoneScrollBars.
private void configureZoneScrollBars(final Display display) {
vBar1 = sc1.getVerticalBar();
vBar2 = sc2.getVerticalBar();
vBar3 = sc3.getVerticalBar();
vBar1.setIncrement(INCREMENT_VERTICAL_SCROLLBAR_ZONE);
vBar2.setIncrement(INCREMENT_VERTICAL_SCROLLBAR_ZONE);
vBar3.setIncrement(INCREMENT_VERTICAL_SCROLLBAR_ZONE);
vBar1.setPageIncrement(INCREMENT_VERTICAL_SCROLLBAR_ZONE);
vBar2.setPageIncrement(INCREMENT_VERTICAL_SCROLLBAR_ZONE);
vBar3.setPageIncrement(INCREMENT_VERTICAL_SCROLLBAR_ZONE);
SelectionListener scrollListener = new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (event.detail == SWT.NONE) {
mouseMoveScrollZoneHelper.mouseDownOnScroll = false;
mouseMoveScrollZoneHelper.scrolling = false;
updateBackground(false, true);
} else {
mouseMoveScrollZoneHelper.mouseDownOnScroll = true;
mouseMoveScrollZoneHelper.scrolling = true;
backgroundRefreshLimiter.setTimeBeforeNewExecution(backgroundRefreshTimeForScrolling);
display.asyncExec(new Runnable() {
public void run() {
backgroundRefreshLimiter.startIfExecutable();
}
});
}
}
};
vBar1.addSelectionListener(scrollListener);
vBar2.addSelectionListener(scrollListener);
vBar3.addSelectionListener(scrollListener);
}
use of org.eclipse.swt.events.SelectionAdapter in project tdi-studio-se by Talend.
the class HL7MultiSchemaUI method createCombo.
@Override
protected void createCombo(Composite parent) {
createLabel(parent);
metaTableViewer = new ComboViewer(parent, SWT.NONE);
metaTableViewer.setContentProvider(new ArrayContentProvider());
metaTableViewer.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
if (element instanceof SegmentModel) {
return ((SegmentModel) element).getSeg().getName();
}
return super.getText(element);
}
});
final Combo combo = metaTableViewer.getCombo();
GridData data = new GridData();
data.widthHint = 60;
combo.setLayoutData(data);
combo.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
updateCurrentMetadataTable();
linker.removeAllLinks();
linker.getMainui().redrawLinkers();
linker.getBackgroundRefresher().refreshBackground();
}
});
}
use of org.eclipse.swt.events.SelectionAdapter in project tdi-studio-se by Talend.
the class ConfigurationDialog method createProfilerTypeSelection.
/**
* Creates the profiler type selection.
*
* @param parent The parent composite
*/
private void createProfilerTypeSelection(Composite parent) {
Group group = new Group(parent, SWT.NONE);
group.setText(Messages.profilerTypeGroupLabel);
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
group.setLayout(new GridLayout(1, false));
Button samplingButton = new Button(group, SWT.RADIO);
samplingButton.setText(Messages.samplingButtonLabel);
samplingButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
profilerType = ProfilerType.SAMPLING;
samplingPeriodLabel.setEnabled(true);
samplingPeriodText.setEnabled(true);
}
});
createSamplingPeriodText(group);
bciButton = new Button(group, SWT.RADIO);
bciButton.setText(Messages.bciButtonLabel);
bciButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
profilerType = ProfilerType.BCI;
samplingPeriodLabel.setEnabled(false);
samplingPeriodText.setEnabled(false);
}
});
boolean isBCI = profilerType == ProfilerType.BCI;
samplingButton.setSelection(!isBCI);
bciButton.setSelection(isBCI);
bciButton.setEnabled(profilerState != ProfilerState.AGENT_NOT_LOADED);
samplingPeriodLabel.setEnabled(!isBCI);
samplingPeriodText.setEnabled(!isBCI);
}
Aggregations