use of org.whole.lang.ui.commands.InsertTextCommand in project whole by wholeplatform.
the class TextualDirectEditEditPolicy method createInsertOverSelectionCommand.
private Command createInsertOverSelectionCommand(ITextualEntityPart textualEntityPart, String contentToInsert) {
IEntity textEntity = textualEntityPart.getModelTextEntity();
TextTransactionCommand transactionCommand = new TextTransactionCommand();
transactionCommand.setModel(textEntity);
transactionCommand.merge((ITextCommand) createDeleteSelectionCommand(textualEntityPart));
InsertTextCommand insert = new InsertTextCommand();
insert.setEntity(textEntity);
insert.setViewer(textualEntityPart.getViewer());
insert.setData(contentToInsert);
transactionCommand.merge(insert);
transactionCommand.setLabel(insert.getLabel());
return transactionCommand;
}
use of org.whole.lang.ui.commands.InsertTextCommand in project whole by wholeplatform.
the class TextualDirectEditEditPolicy method getInsertTextCommand.
private Command getInsertTextCommand(TextualRequest request) {
Command command;
ITextualEntityPart textualEntityPart = (ITextualEntityPart) getHost();
String contentToInsert = request.getContent();
if (textualEntityPart.hasSelectionRange()) {
command = createInsertOverSelectionCommand(textualEntityPart, contentToInsert);
} else {
InsertTextCommand insert = new InsertTextCommand();
insert.setEntity(textualEntityPart.getModelTextEntity());
insert.setViewer(textualEntityPart.getViewer());
insert.setData(contentToInsert);
command = insert;
}
return command;
}
Aggregations