Package trackers

Class IDETracker

java.lang.Object
trackers.IDETracker
All Implemented Interfaces:
com.intellij.openapi.Disposable

public final class IDETracker extends Object implements com.intellij.openapi.Disposable
This class is the IDE tracker.
  • Field Details

    • isTracking

      boolean isTracking
    • iDETracking

      Document iDETracking
      This variable is the XML document for storing the tracking data.
    • root

      Element root
    • environment

      Element environment
    • actions

      Element actions
    • archives

      Element archives
    • typings

      Element typings
    • files

      Element files
    • mouses

      Element mouses
    • carets

      Element carets
    • selections

      Element selections
    • visibleAreas

      Element visibleAreas
    • projectPath

      String projectPath
    • dataOutputPath

      String dataOutputPath
    • lastSelectionInfo

      String lastSelectionInfo
    • isRealTimeDataTransmitting

      private static boolean isRealTimeDataTransmitting
      This variable indicates whether the data is transmitted in real time.
    • ideTrackerDataHandler

      private Consumer<Element> ideTrackerDataHandler
      This variable is the handler for the IDE tracker data.
    • documentListener

      com.intellij.openapi.editor.event.DocumentListener documentListener
      This variable is the document listener for the IDE tracker. When the document is changed, if the EditorKind is CONSOLE, the console output is archived. Otherwise, the changedFilepath and changedFileText are updated.
    • editorMouseListener

      com.intellij.openapi.editor.event.EditorMouseListener editorMouseListener
      This variable is the mouse listener for the IDE tracker. When the mouse is pressed, clicked, or released, the mouse event is tracked.
    • editorMouseMotionListener

      com.intellij.openapi.editor.event.EditorMouseMotionListener editorMouseMotionListener
      This variable is the mouse motion listener for the IDE tracker. When the mouse is moved or dragged, the mouse event is tracked.
    • caretListener

      com.intellij.openapi.editor.event.CaretListener caretListener
      This variable is the caret listener for the IDE tracker. When the caret position is changed, the caret event is tracked.
    • selectionListener

      com.intellij.openapi.editor.event.SelectionListener selectionListener
      This variable is the selection listener for the IDE tracker. When the selection is changed, the selection event is tracked.
    • visibleAreaListener

      com.intellij.openapi.editor.event.VisibleAreaListener visibleAreaListener
      This variable is the visible area listener for the IDE tracker. When the visible area is changed, the visible area event is tracked.
    • editorEventMulticaster

      com.intellij.openapi.editor.event.EditorEventMulticaster editorEventMulticaster
      This variable is the editor event multicaster for the IDE tracker. It is used to add and remove all the listeners.
    • timer

      Timer timer
      This variable is the timer for tracking the document changes.
    • changedFilepath

      String changedFilepath
    • changedFileText

      String changedFileText
    • timerTask

      TimerTask timerTask
      This variable is the timer task for tracking the document changes. If the changedFilepath is not empty, the file is archived.
  • Constructor Details

  • Method Details

    • getInstance

      public static IDETracker getInstance() throws ParserConfigurationException
      This method returns the IDE tracker instance.
      Returns:
      The IDE tracker instance.
      Throws:
      ParserConfigurationException
    • startTracking

      public void startTracking(com.intellij.openapi.project.Project project)
      This method starts tracking. All the listeners are added.
      Parameters:
      project - The project.
    • setIdeTrackerDataHandler

      public void setIdeTrackerDataHandler(Consumer<Element> ideTrackerDataHandler)
      This method sets the handler for the IDE tracker data for real-time data transmission.
      Parameters:
      ideTrackerDataHandler - The handler for the IDE tracker data.
    • stopTracking

      public void stopTracking() throws TransformerException
      This method stops tracking. All the listeners are removed. The tracking data is written to the XML file.
      Throws:
      TransformerException
    • pauseTracking

      public void pauseTracking()
      This method pauses tracking. The isTracking is set to false.
    • resumeTracking

      public void resumeTracking()
      This method resumes tracking. The isTracking is set to true.
    • setIsRealTimeDataTransmitting

      public void setIsRealTimeDataTransmitting(boolean isRealTimeDataTransmitting)
      This method sets the isRealTimeDataTransmitting variable.
      Parameters:
      isRealTimeDataTransmitting - Indicates whether the data is transmitted in real time.
    • dispose

      public void dispose()
      Specified by:
      dispose in interface com.intellij.openapi.Disposable
    • setProjectPath

      public void setProjectPath(String projectPath)
    • archiveFile

      public void archiveFile(String path, String timestamp, String remark, String text)
      This method archives the file. If the file is a code file, the file is copied to the archive folder.
      Parameters:
      path - The path of the file.
      timestamp - The timestamp of the file.
      remark - The remark of the file.
      text - The text of the file.
    • getMouseElement

      public Element getMouseElement(com.intellij.openapi.editor.event.EditorMouseEvent e, String id)
      This method returns the mouse XML element.
      Parameters:
      e - The editor mouse event.
      id - The id of the mouse event.
      Returns:
      The mouse element.
    • setDataOutputPath

      public void setDataOutputPath(String dataOutputPath)
      This method sets the data output path.
      Parameters:
      dataOutputPath - The data output path.
    • handleElement

      private void handleElement(Element element)
      This method handles the XML element for real-time data transmission.
      Parameters:
      element - The XML element.
    • isTracking

      public boolean isTracking()
      This method returns whether the IDE tracker is tracking.
      Returns:
      Whether the IDE tracker is tracking.