use of org.eclipse.swt.events.SelectionAdapter in project tdi-studio-se by Talend.
the class ChooseJobletDialog method addListeners.
private void addListeners() {
jobletBut.addSelectionListener(new SelectionAdapter() {
/*
* (non-Javadoc)
*
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
*/
@Override
public void widgetSelected(SelectionEvent e) {
addJoblet = jobletBut.getSelection();
}
});
jobBut.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
addJoblet = !jobBut.getSelection();
}
});
}
use of org.eclipse.swt.events.SelectionAdapter in project tdi-studio-se by Talend.
the class HadoopJarSetupController method createControl.
/*
* (non-Javadoc)
*
* @see
* org.talend.designer.core.ui.editor.properties.controllers.AbstractElementPropertySectionController#createControl
* (org.eclipse.swt.widgets.Composite, org.talend.core.model.process.IElementParameter, int, int, int,
* org.eclipse.swt.widgets.Control)
*/
@Override
public Control createControl(Composite subComposite, final IElementParameter param, int numInRow, int nbInRow, int top, Control lastControl) {
final Composite container = subComposite;
//$NON-NLS-1$
Button subButton = getWidgetFactory().createButton(container, "", SWT.PUSH);
subButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
initHadoopVersionType();
boolean readonly = false;
String readOnlyIfString = param.getReadOnlyIf();
if (StringUtils.isNotEmpty(readOnlyIfString)) {
if (param.isReadOnly(elem.getElementParameters())) {
readonly = true;
}
}
// if readonly is true, then needn't to do this check, since it's aim is check readonly also
if (readonly == false) {
IElementParameter propertyParameter = elem.getElementParameter(EParameterName.PROPERTY_TYPE.getName());
if (propertyParameter != null) {
if (EmfComponent.REPOSITORY.equals(propertyParameter.getValue())) {
readonly = true;
}
}
}
HadoopCustomVersionDefineDialog customVersionDialog = new HadoopCustomVersionDefineDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), getCustomVersionMap()) {
@Override
protected ECustomVersionType[] getDisplayTypes() {
return new ECustomVersionType[] { versionType };
}
};
IElementParameter sparkLocalParam = elem.getElementParameter(HadoopConstants.SPARK_LOCAL_MODE);
IElementParameter sparkParam = elem.getElementParameter(HadoopConstants.SPARK_MODE);
boolean isSparkLocalMode = false;
if (sparkLocalParam != null) {
isSparkLocalMode = (Boolean) sparkLocalParam.getValue();
}
if (sparkParam != null) {
String sparkMode = null;
if (isSparkLocalMode) {
//$NON-NLS-1$
sparkMode = "LOCAL";
} else {
//$NON-NLS-1$
sparkMode = "" + sparkParam.getValue();
}
customVersionDialog.setSparkMode(sparkMode);
customVersionDialog.setSparkStreamingMode(sparkMode);
}
customVersionDialog.setReadonly(readonly);
Set<String> oldLibList = customVersionDialog.getLibList(versionType.getGroup());
if (customVersionDialog.open() == Window.OK) {
Set<String> newLibList = customVersionDialog.getLibList(versionType.getGroup());
if (oldLibList != null && newLibList != null && oldLibList.size() == newLibList.size() && oldLibList.containsAll(newLibList)) {
// means nothing changes, so nothing need to do
} else {
// changed
String customJars = customVersionDialog.getLibListStr(versionType.getGroup());
executeCommand(new PropertyChangeCommand(elem, EParameterName.HADOOP_CUSTOM_JARS.getName(), StringUtils.trimToEmpty(customJars)));
}
}
}
});
subButton.setImage(ImageProvider.getImage(CoreUIPlugin.getImageDescriptor(DOTS_BUTTON)));
FormData data = new FormData();
data.left = new FormAttachment(lastControl, 0);
data.right = new FormAttachment(lastControl, STANDARD_BUTTON_WIDTH, SWT.RIGHT);
data.top = new FormAttachment(0, top);
data.height = STANDARD_HEIGHT - 2;
subButton.setLayoutData(data);
return container;
}
use of org.eclipse.swt.events.SelectionAdapter in project tdi-studio-se by Talend.
the class DataMapTableView method addListeners.
/**
* DOC amaumont Comment method "addListeners".
*/
protected void addListeners() {
final UIManager uiManager = mapperManager.getUiManager();
MouseTrackListener mouseTracker = new MouseTrackListener() {
@Override
public void mouseEnter(MouseEvent e) {
}
@Override
public void mouseExit(MouseEvent e) {
setDefaultCursor();
resizeHelper.stopDrag();
}
@Override
public void mouseHover(MouseEvent e) {
}
};
this.addMouseTrackListener(mouseTracker);
SelectionListener scrollListener = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
uiManager.refreshBackground(true, false);
}
};
tableForEntries.getVerticalBar().addSelectionListener(scrollListener);
// /////////////////////////////////////////////////////////////////
addManualTableResizeListeners(uiManager);
// /////////////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////////
Listener onSelectDataMapTableViewListener = new Listener() {
@Override
public void handleEvent(Event event) {
switch(event.type) {
case SWT.MouseDown:
onSelectDataMapTableView();
break;
default:
}
}
};
this.addListener(SWT.MouseDown, onSelectDataMapTableViewListener);
headerComposite.addListener(SWT.MouseDown, onSelectDataMapTableViewListener);
nameLabel.addListener(SWT.MouseDown, onSelectDataMapTableViewListener);
// /////////////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////////
minimizeButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// TODO Auto-generated method stub
}
@Override
public void widgetSelected(SelectionEvent e) {
minimizeTable(!abstractDataMapTable.isMinimized());
}
});
// /////////////////////////////////////////////////////////////////
initShowMessageErrorListener(tableForEntries);
}
use of org.eclipse.swt.events.SelectionAdapter in project tdi-studio-se by Talend.
the class TabFolderEditors method createPreview.
/**
* qzhang Comment method "createPreview".
*
* @return
*/
private void createPreview(final Composite parent, final int width, int height) {
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 1;
// gridLayout.marginBottom = 0;
// gridLayout.marginLeft = 0;
// gridLayout.marginRight = 0;
// gridLayout.marginTop = 0;
// gridLayout.verticalSpacing = 0;
gridLayout.marginHeight = 2;
gridLayout.marginWidth = 2;
parent.setLayout(gridLayout);
GridData gridData = new GridData(GridData.FILL_BOTH);
Composite previewHeader = new Composite(parent, SWT.NONE);
height = height - HEIGHT_BUTTON_PIXEL - 15;
previewHeader.setLayout(gridLayout);
previewHeader.setLayoutData(gridData);
// row number text.
Composite header = new Composite(previewHeader, SWT.NONE);
GridLayout fill = new GridLayout();
fill.numColumns = 3;
fill.marginBottom = 0;
fill.marginHeight = 0;
fill.marginLeft = 0;
fill.marginRight = 0;
fill.marginTop = 0;
fill.marginWidth = 0;
header.setLayout(fill);
rowText = new Text(header, SWT.BORDER);
// String number = component.getNumber();
// if (number == null || "".equals(number)) {
// number = "10";
// }
//$NON-NLS-1$
rowText.setText("10");
GridDataFactory.swtDefaults().hint(50, SWT.DEFAULT).applyTo(rowText);
// rowText.getBounds().width = 100;
rowText.setRedraw(true);
Label rowNum = new Label(header, SWT.NONE);
rowNum.getBounds().height = HEIGHT_BUTTON_PIXEL;
//$NON-NLS-1$
rowNum.setText(Messages.getString("TabFolderEditors.RowNum.LabelText"));
rowNum.setAlignment(SWT.CENTER);
refreshButton = new Button(header, SWT.NONE);
//$NON-NLS-1$
refreshButton.setText(Messages.getString("TabFolderEditors.PreviewButton.Label"));
refreshButton.setSize(WIDTH_BUTTON_PIXEL, HEIGHT_BUTTON_PIXEL);
processPreview = new ShadowProcessPreview(previewHeader, width, height - 10);
processPreview.newTablePreview();
refreshButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
if (!refreshButton.getText().equals(Messages.getString("TabFolderEditors.WaitButton.Label"))) {
//$NON-NLS-1$
//$NON-NLS-1$
refreshButton.setText(Messages.getString("TabFolderEditors.WaitButton.Label"));
refreshPreview(rowText.getText());
} else {
//$NON-NLS-1$
refreshButton.setText(Messages.getString("TabFolderEditors.PreviewButton.Label"));
}
}
});
}
use of org.eclipse.swt.events.SelectionAdapter in project tdi-studio-se by Talend.
the class MetadataTableEditorViewExt method addHorizontalBarListener.
private void addHorizontalBarListener() {
final ScrollBar horizontalBar = getTable().getHorizontalBar();
horizontalBar.addSelectionListener(new SelectionAdapter() {
/*
* (non-Java)
*
* @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
*/
@Override
public void widgetSelected(SelectionEvent e) {
// if (e.detail == SWT.DRAG) {
int shift = horizontalBar.getSelection();
attachLabelPosition(shift);
// }
}
});
}
Aggregations