use of org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand in project tesb-studio-se by Talend.
the class RouteResourceController method createButtonCommand.
/**
*
* @param source
* @return
*/
private PropertyChangeCommand createButtonCommand(Button button) {
RouteResourceSelectionDialog dialog = new RouteResourceSelectionDialog(button.getShell());
selectNodeIfExists(button, dialog);
if (dialog.open() == Window.OK) {
IRepositoryViewObject repositoryObject = dialog.getResult().getObject();
// refreshItemeProperty(repositoryObject);
final Item item = repositoryObject.getProperty().getItem();
String id = item.getProperty().getId();
String paramName = (String) button.getData(PARAMETER_NAME);
return new PropertyChangeCommand(elem, paramName, id);
}
return null;
}
use of org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand in project tesb-studio-se by Talend.
the class RestResponseSchemaController method createComboCommand.
@Override
public Command createComboCommand(SelectionEvent event) {
//Change the body type according to selected return body type
Command changePropertyCommand = super.createComboCommand(event);
Object newReturnType = null;
if (changePropertyCommand != null) {
newReturnType = ((PropertyChangeCommand) changePropertyCommand).getNewValue();
}
if (newReturnType == null) {
return null;
}
//get old metadata column
List<IMetadataTable> metadataList = ((INode) elem).getMetadataList();
IMetadataTable oldMetadataTable = null;
if (metadataList != null && metadataList.size() > 0) {
oldMetadataTable = metadataList.get(0);
} else {
metadataList = new ArrayList<IMetadataTable>();
((INode) elem).setMetadataList(metadataList);
}
//create new metadata column
IMetadataTable newMetadataTable = oldMetadataTable == null ? new MetadataTable() : oldMetadataTable.clone();
List<IMetadataColumn> listColumns = newMetadataTable.getListColumns();
if (listColumns == null) {
listColumns = new ArrayList<IMetadataColumn>();
newMetadataTable.setListColumns(listColumns);
}
IMetadataColumn bodyColumn = listColumns.size() > 0 ? listColumns.get(0) : new MetadataColumn();
bodyColumn.setId("body");
bodyColumn.setTalendType(newReturnType.toString());
listColumns.clear();
listColumns.add(bodyColumn);
metadataList.clear();
metadataList.add(newMetadataTable);
//construct change metadata command
ChangeMetadataCommand changeMetadataCommand = new ChangeMetadataCommand((INode) elem, null, oldMetadataTable, newMetadataTable);
//construct compound command by combining above 2 commands
CompoundCommand compoundCommand = new CompoundCommand();
compoundCommand.add(changePropertyCommand);
compoundCommand.add(changeMetadataCommand);
return compoundCommand;
}
use of org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand in project tesb-studio-se by Talend.
the class CamelEditorDropTargetListener method createRefreshingPropertiesCommand.
private List<Command> createRefreshingPropertiesCommand(CompoundCommand cc, RepositoryNode selectedNode, Node node) {
if (selectedNode.getObject().getProperty().getItem() instanceof ProcessItem) {
ProcessItem processItem = (ProcessItem) selectedNode.getObject().getProperty().getItem();
// command used to set job
String value = processItem.getProperty().getId();
PropertyChangeCommand command4 = new PropertyChangeCommand(node, EParameterName.PROCESS_TYPE_PROCESS.getName(), value);
cc.add(command4);
PropertyChangeCommand command5 = new PropertyChangeCommand(node, EParameterName.PROCESS_TYPE_CONTEXT.getName(), processItem.getProcess().getDefaultContext());
cc.add(command5);
}
return null;
}
Aggregations