Search in sources :

Example 1 with OverwriteTextCommand

use of org.whole.lang.ui.commands.OverwriteTextCommand in project whole by wholeplatform.

the class TextualDirectEditEditPolicy method getOverwriteTextCommand.

private Command getOverwriteTextCommand(TextualRequest request) {
    Command command;
    ITextualEntityPart textualEntityPart = (ITextualEntityPart) getHost();
    String contentToOverwrite = request.getContent();
    if (textualEntityPart.hasSelectionRange()) {
        command = createInsertOverSelectionCommand(textualEntityPart, contentToOverwrite);
    } else {
        OverwriteTextCommand overwrite = new OverwriteTextCommand();
        overwrite.setEntity(textualEntityPart.getModelTextEntity());
        overwrite.setViewer(textualEntityPart.getViewer());
        overwrite.setData(contentToOverwrite);
        command = overwrite;
    }
    return command;
}
Also used : ITextualEntityPart(org.whole.lang.ui.editparts.ITextualEntityPart) DeleteTextCommand(org.whole.lang.ui.commands.DeleteTextCommand) BackspaceTextCommand(org.whole.lang.ui.commands.BackspaceTextCommand) ITextCommand(org.whole.lang.ui.commands.ITextCommand) InsertTextCommand(org.whole.lang.ui.commands.InsertTextCommand) TextTransactionCommand(org.whole.lang.ui.commands.TextTransactionCommand) OverwriteTextCommand(org.whole.lang.ui.commands.OverwriteTextCommand) Command(org.eclipse.gef.commands.Command) OverwriteTextCommand(org.whole.lang.ui.commands.OverwriteTextCommand)

Aggregations

Command (org.eclipse.gef.commands.Command)1 BackspaceTextCommand (org.whole.lang.ui.commands.BackspaceTextCommand)1 DeleteTextCommand (org.whole.lang.ui.commands.DeleteTextCommand)1 ITextCommand (org.whole.lang.ui.commands.ITextCommand)1 InsertTextCommand (org.whole.lang.ui.commands.InsertTextCommand)1 OverwriteTextCommand (org.whole.lang.ui.commands.OverwriteTextCommand)1 TextTransactionCommand (org.whole.lang.ui.commands.TextTransactionCommand)1 ITextualEntityPart (org.whole.lang.ui.editparts.ITextualEntityPart)1