use of org.talend.designer.core.utils.ISampleCodeFactory in project tdi-studio-se by Talend.
the class AbstractLanguageMemoController method addCodeGenerateButton.
/**
*
* DOC YeXiaowei Comment method "addCodeGenerateButton".
*
* @param parent
*/
private void addCodeGenerateButton(final Composite parent) {
codeGenereateButton = new Button(parent, SWT.CENTER);
//$NON-NLS-1$
codeGenereateButton.setText(Messages.getString("AbstractLanguageMemoController.generateCode"));
//$NON-NLS-1$
codeGenereateButton.setToolTipText(Messages.getString("AbstractLanguageMemoController.generateSampleCode"));
codeGenereateButton.setEnabled(!elem.isReadOnly());
GridData layoutData = new GridData();
layoutData.horizontalAlignment = SWT.CENTER;
codeGenereateButton.setLayoutData(layoutData);
codeGenereateButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (elem instanceof Node) {
// generate code
ISampleCodeFactory factory = JavaSampleCodeFactory.getInstance();
executeCommand(factory.generateCodeForParameters((Node) elem));
refresh(curParameter, false);
}
}
});
}
Aggregations