Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.maddyhome.idea.vim.group
Class MarkGroup  view MarkGroup download MarkGroup.java

java.lang.Object
  extended bycom.maddyhome.idea.vim.group.AbstractActionGroup
      extended bycom.maddyhome.idea.vim.group.MarkGroup
All Implemented Interfaces:
ActionGroup

public class MarkGroup
extends AbstractActionGroup

This class contains all the mark related functionality


Nested Class Summary
private static class MarkGroup.FileMarks
           
static class MarkGroup.MarkUpdater
          This class is used to listen to editor document changes
 
Field Summary
private static java.lang.String FILE_MARKS
           
private  java.util.HashMap fileMarks
           
private static java.lang.String GLOBAL_MARKS
           
private  java.util.HashMap globalMarks
           
private static Logger logger
           
private static java.lang.String READONLY_MARKS
           
private static java.lang.String RO_FILE_MARKS
           
private static java.lang.String RO_GLOBAL_MARKS
           
private static java.lang.String SAVE_FILE_MARKS
           
private  int SAVE_MARK_COUNT
           
private static java.lang.String VALID_GET_MARKS
           
private static java.lang.String VALID_SET_MARKS
           
private static java.lang.String WR_FILE_MARKS
           
private static java.lang.String WR_GLOBAL_MARKS
           
private static java.lang.String WRITE_MARKS
           
 
Constructor Summary
MarkGroup()
          Creates the class
 
Method Summary
 com.maddyhome.idea.vim.common.Mark getFileMark(Editor editor, char ch)
          Get's a mark from the file
private  MarkGroup.FileMarks getFileMarks(Editor editor)
          Gets the map of marks for the specified file
 com.maddyhome.idea.vim.common.Mark getMark(Editor editor, char ch)
          Gets the requested mark for the editor
 java.util.List getMarks(Editor editor)
           
 void readData(org.jdom.Element element)
          Allows the group to restore its state and any configuration.
 void saveData(org.jdom.Element element)
          Allows the group to save its state and any configuration.
 void saveJumpLocation(Editor editor, DataContext context)
          Saves the caret location prior to doing a jump
 boolean setMark(Editor editor, DataContext context, char ch)
          Sets the specified mark to the caret position of the editor
 boolean setMark(Editor editor, DataContext context, char ch, int offset)
          Sets the specified mark to the specified location.
static void updateMarkFromDelete(Editor editor, java.util.HashMap marks, int delStartOff, int delLength)
          This updates all the marks for a file whenever text is deleted from the file.
static void updateMarkFromInsert(Editor editor, java.util.HashMap marks, int insStartOff, int insLength)
          This updates all the marks for a file whenever text is inserted into the file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fileMarks

private java.util.HashMap fileMarks

globalMarks

private java.util.HashMap globalMarks

SAVE_MARK_COUNT

private int SAVE_MARK_COUNT

WR_GLOBAL_MARKS

private static final java.lang.String WR_GLOBAL_MARKS
See Also:
Constant Field Values

WR_FILE_MARKS

private static final java.lang.String WR_FILE_MARKS
See Also:
Constant Field Values

RO_GLOBAL_MARKS

private static final java.lang.String RO_GLOBAL_MARKS
See Also:
Constant Field Values

RO_FILE_MARKS

private static final java.lang.String RO_FILE_MARKS
See Also:
Constant Field Values

SAVE_FILE_MARKS

private static final java.lang.String SAVE_FILE_MARKS
See Also:
Constant Field Values

GLOBAL_MARKS

private static final java.lang.String GLOBAL_MARKS
See Also:
Constant Field Values

FILE_MARKS

private static final java.lang.String FILE_MARKS
See Also:
Constant Field Values

WRITE_MARKS

private static final java.lang.String WRITE_MARKS
See Also:
Constant Field Values

READONLY_MARKS

private static final java.lang.String READONLY_MARKS
See Also:
Constant Field Values

VALID_SET_MARKS

private static final java.lang.String VALID_SET_MARKS
See Also:
Constant Field Values

VALID_GET_MARKS

private static final java.lang.String VALID_GET_MARKS
See Also:
Constant Field Values

logger

private static Logger logger
Constructor Detail

MarkGroup

public MarkGroup()
Creates the class

Method Detail

saveJumpLocation

public void saveJumpLocation(Editor editor,
                             DataContext context)
Saves the caret location prior to doing a jump


getMark

public com.maddyhome.idea.vim.common.Mark getMark(Editor editor,
                                                  char ch)
Gets the requested mark for the editor


getFileMark

public com.maddyhome.idea.vim.common.Mark getFileMark(Editor editor,
                                                      char ch)
Get's a mark from the file


setMark

public boolean setMark(Editor editor,
                       DataContext context,
                       char ch)
Sets the specified mark to the caret position of the editor


setMark

public boolean setMark(Editor editor,
                       DataContext context,
                       char ch,
                       int offset)
Sets the specified mark to the specified location.


getMarks

public java.util.List getMarks(Editor editor)

getFileMarks

private MarkGroup.FileMarks getFileMarks(Editor editor)
Gets the map of marks for the specified file


saveData

public void saveData(org.jdom.Element element)
Allows the group to save its state and any configuration.

Specified by:
saveData in interface ActionGroup
Overrides:
saveData in class AbstractActionGroup

readData

public void readData(org.jdom.Element element)
Allows the group to restore its state and any configuration.

Overrides:
readData in class AbstractActionGroup

updateMarkFromDelete

public static void updateMarkFromDelete(Editor editor,
                                        java.util.HashMap marks,
                                        int delStartOff,
                                        int delLength)
This updates all the marks for a file whenever text is deleted from the file. If the line that contains a mark is completely deleted then the mark is deleted too. If the deleted text is before the marked line, the mark is moved up by the number of deleted lines.


updateMarkFromInsert

public static void updateMarkFromInsert(Editor editor,
                                        java.util.HashMap marks,
                                        int insStartOff,
                                        int insLength)
This updates all the marks for a file whenever text is inserted into the file. If the line that contains a mark that is after the start of the insertion point, shift the mark by the number of new lines added.