use of org.talend.designer.xmlmap.commands.DirectEditCommand in project tdi-studio-se by Talend.
the class StyledTextHandler method updateCellExpression.
private void updateCellExpression() {
if (selectedNode != null && styledText != null && !styledText.getText().equals(selectedNode.getExpression())) {
DirectEditCommand command = new DirectEditCommand(selectedNodePart, selectedNode, DirectEditType.EXPRESSION, styledText.getText());
((XmlMapGraphicViewer) selectedNodePart.getViewer()).getEditDomain().getCommandStack().execute(command);
}
}
use of org.talend.designer.xmlmap.commands.DirectEditCommand in project tdi-studio-se by Talend.
the class XmlDirectEditPolicy method getDirectEditCommand.
@Override
protected Command getDirectEditCommand(DirectEditRequest request) {
Command command = null;
CellEditor editor = request.getCellEditor();
Object directEditFeature = request.getDirectEditFeature();
if (directEditFeature instanceof DirectEditType) {
DirectEditType type = (DirectEditType) directEditFeature;
if (getHost().getModel() instanceof AbstractNode) {
AbstractNode model = (AbstractNode) getHost().getModel();
switch(type) {
case EXPRESSION:
case NODE_NAME:
command = new DirectEditCommand(getHost(), model, type, request.getCellEditor().getValue());
break;
case VAR_NODE_TYPE:
if (editor instanceof ComboBoxCellEditor) {
ComboBoxCellEditor combo = (ComboBoxCellEditor) editor;
int selectIndex = (Integer) combo.getValue();
command = new DirectEditCommand(getHost(), model, type, combo.getItems()[selectIndex]);
}
break;
case LOOKUP_MODEL:
case MATCH_MODEL:
case JOIN_MODEL:
case PERSISTENT_MODEL:
case OUTPUT_REJECT:
case LOOK_UP_INNER_JOIN_REJECT:
if (editor instanceof ComboBoxCellEditor) {
ComboBoxCellEditor combo = (ComboBoxCellEditor) editor;
int selectIndex = (Integer) combo.getValue();
command = new TreeSettingDirectEditCommand(model, type, combo.getItems()[selectIndex]);
}
break;
case EXPRESSION_FILTER:
if (editor instanceof TextCellEditor) {
command = new TreeSettingDirectEditCommand(model, type, request.getCellEditor().getValue());
}
default:
break;
}
} else {
switch(type) {
case LOOKUP_MODEL:
case MATCH_MODEL:
case JOIN_MODEL:
case PERSISTENT_MODEL:
case OUTPUT_REJECT:
case LOOK_UP_INNER_JOIN_REJECT:
case ALL_IN_ONE:
case ENABLE_EMPTY_ELEMENT:
if ((editor instanceof ComboBoxCellEditor)) {
ComboBoxCellEditor combo = (ComboBoxCellEditor) editor;
int selectIndex = (Integer) combo.getValue();
command = new TreeSettingDirectEditCommand(getHost().getModel(), type, combo.getItems()[selectIndex]);
}
break;
case EXPRESSION_FILTER:
command = new TreeSettingDirectEditCommand(getHost().getModel(), type, request.getCellEditor().getValue());
}
}
}
return command;
}
Aggregations