sk.uniba.euromath.editor.textEditor.commands
Class DeleteTextCommand

java.lang.Object
  extended by org.eclipse.gef.commands.Command
      extended by sk.uniba.euromath.editor.textEditor.commands.DeleteTextCommand

public class DeleteTextCommand
extends org.eclipse.gef.commands.Command

Command to delete text from xml. Only to delete. Use canExecute to test if delete can be performed. Text to delete is specified exactly in constructor, but some additional white spaces are deleted at end of deletion: treatWhiteSpaces().

Author:
Tomáš Studva, Martin Kollar 1.10.2005

Constructor Summary
DeleteTextCommand(ITextPieceKeeper pieceKeeper, int position, int length, XMLAccess xmlAccess)
          Constructor.
DeleteTextCommand(String id, int position, int length, XMLAccess xmlAccess)
          Constructor.
 
Method Summary
 boolean canExecute()
           
static DocumentModifyCompoundCommand createCommandToDeleteText(List<String> ids, XMLAccess xmlAccess)
          Creates command to delete text.
 void execute()
           
 
Methods inherited from class org.eclipse.gef.commands.Command
canUndo, chain, dispose, getDebugLabel, getLabel, redo, setDebugLabel, setLabel, undo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeleteTextCommand

public DeleteTextCommand(ITextPieceKeeper pieceKeeper,
                         int position,
                         int length,
                         XMLAccess xmlAccess)
Constructor.

Parameters:
pieceKeeper - pieceKeeper holding text where deletion will be done
position - position of start of deletion in pieceKeeper's text,
length - of text to delete
xmlAccess - XMLAccess instance

DeleteTextCommand

public DeleteTextCommand(String id,
                         int position,
                         int length,
                         XMLAccess xmlAccess)
Constructor.

Parameters:
id - of textual node holding text where deletion will be done
position - position of start of deletion in textual node's text,
length - of textual node's text to delete
xmlAccess - XMLAccess instance
Method Detail

createCommandToDeleteText

public static DocumentModifyCompoundCommand createCommandToDeleteText(List<String> ids,
                                                                      XMLAccess xmlAccess)
Creates command to delete text. Text to delete is specified by ids of text pieces, i.e. ids have form: id of textual node < start of deletion in node's text, length of deletion in node's text >. Ids must be tided up first by TextPieceInfoImpl.tidyUpIds(List) if needed.

Parameters:
ids - identifies what to delete, text piece style ids: id of textual node < start of deletion in node's text, length of deletion in node's text >
xmlAccess - instance
Returns:
DocumentModifyCompoundCommand compound of DeleteTextCommands.

execute

public void execute()
Overrides:
execute in class org.eclipse.gef.commands.Command

canExecute

public boolean canExecute()
Overrides:
canExecute in class org.eclipse.gef.commands.Command


Copyright © 2003-2006 null. All Rights Reserved.