use of org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand in project tdi-studio-se by Talend.
the class ImportRulesFromRepository method updateParameters.
public void updateParameters(Object propValue) {
PropertyChangeCommand cmd = new PropertyChangeCommand(node, RULE_TABLE, propValue);
cmd.setUpdate(true);
controller.executeCommand(cmd);
}
use of org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand in project tdi-studio-se by Talend.
the class ModuleListController method createCommand.
public Command createCommand(SelectionEvent selectionEvent) {
Set<String> elementsName;
Control ctrl;
elementsName = hashCurControls.keySet();
for (String name : elementsName) {
Object o = hashCurControls.get(name);
if (o instanceof Control) {
ctrl = (Control) o;
if (ctrl == null) {
hashCurControls.remove(name);
return null;
}
if (ctrl.equals(selectionEvent.getSource()) && ctrl instanceof CCombo) {
boolean isDisposed = ((CCombo) ctrl).isDisposed();
if (!isDisposed && (!elem.getPropertyValue(name).equals(((CCombo) ctrl).getText()))) {
//$NON-NLS-1$
String value = new String("");
for (int i = 0; i < elem.getElementParameters().size(); i++) {
IElementParameter param = elem.getElementParameters().get(i);
if (param.getName().equals(name)) {
for (int j = 0; j < param.getListItemsValue().length; j++) {
if (((CCombo) ctrl).getText().equals(param.getListItemsDisplayName()[j])) {
value = (String) param.getListItemsValue()[j];
}
}
}
}
if (value.equals(elem.getPropertyValue(name))) {
// anything
return null;
}
CorePlugin.getDefault().getLibrariesService().resetModulesNeeded();
return new PropertyChangeCommand(elem, name, value);
}
}
}
}
return null;
}
use of org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand in project tdi-studio-se by Talend.
the class OpenedListController method modifyCommand.
/**
* DOC zli Comment method "modifyCommand".
*
* @param event
* @return
*/
private Command modifyCommand(ModifyEvent event) {
Set<String> elementsName;
Control ctrl;
elementsName = hashCurControls.keySet();
for (String name : elementsName) {
Object o = hashCurControls.get(name);
if (o instanceof Control) {
ctrl = (Control) o;
if (ctrl == null) {
hashCurControls.remove(name);
return null;
}
CCombo combo = (CCombo) event.getSource();
Object data = ctrl.getData(PARAMETER_NAME);
if (!(ctrl instanceof CCombo)) {
continue;
}
boolean isDisposed = ((CCombo) ctrl).isDisposed() || combo.isDisposed();
if (isDisposed) {
continue;
}
String paramName = "";
if (data != null) {
paramName = data.toString();
}
String value = "";
if (data != null && data.equals(combo.getData(PARAMETER_NAME))) {
for (int i = 0; i < elem.getElementParameters().size(); i++) {
IElementParameter param = elem.getElementParameters().get(i);
if (param.getFieldType().equals(EParameterFieldType.OPENED_LIST) && paramName.equals(param.getName())) {
String text = ((CCombo) ctrl).getText();
String[] listItemsDisplayName = param.getListItemsDisplayName();
boolean valueSet = false;
Object[] listItemsValue = param.getListItemsValue();
for (int j = 0; j < listItemsValue.length; j++) {
if (j < listItemsDisplayName.length && text.equals(listItemsDisplayName[j])) {
value = (String) listItemsValue[j];
valueSet = true;
break;
}
}
if (!valueSet) {
value = text;
}
// TDI-21313
if (value != null && value.equals(param.getValue())) {
return null;
}
param.setValue(value);
}
}
return new PropertyChangeCommand(elem, paramName, value);
}
}
}
return null;
}
use of org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand in project tesb-studio-se by Talend.
the class RouteResourceController method createComboCommand.
/**
* DOC nrousseau Comment method "createComboCommand".
*
* @param source
* @return
*/
private PropertyChangeCommand createComboCommand(CCombo combo) {
String paramName = (String) combo.getData(PARAMETER_NAME);
IElementParameter param = elem.getElementParameter(paramName);
String value = combo.getText();
// }
if (value.equals(param.getValue())) {
return null;
}
return new PropertyChangeCommand(elem, paramName, value);
}
use of org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand in project tbd-studio-se by Talend.
the class AbstractHDFSBrowseController method createCommand.
protected Command createCommand(SelectionEvent event, HDFSConnectionBean connection) {
HDFSBrowseDialog dial = new HDFSBrowseDialog(composite.getShell(), getHDFSType(), connection);
Button btn = (Button) event.getSource();
String propertyName = (String) btn.getData(PARAMETER_NAME);
Text filePathText = (Text) hashCurControls.get(propertyName);
if (dial.open() == Window.OK) {
IHDFSNode result = dial.getResult();
String path = result.getPath();
path = TalendQuoteUtils.addQuotesIfNotExist(path);
if (!elem.getPropertyValue(propertyName).equals(path)) {
filePathText.setText(path);
return new PropertyChangeCommand(elem, propertyName, path);
}
}
return null;
}
Aggregations