package editrocket.plugins;

import java.sql.*;
import javax.swing.*;
import java.util.*;

public interface EditRocketPluginManager
{
	/**
	* Returns the current major version of EditRocket in int format.  
	* For example, if using EditRocket version 1.04, 1 would be returned
	* If using EditRocket version 10.4, 10 would be returned 
	*/
	public int getMajorVersion();	
	
	/**
	* Returns the current minor version of EditRocket in int format.  
	* For example, if using EditRocket version 1.04, 4 would be returned
	* If using EditRocket version 1.4, 40 would be returned.
	*/
	public int getMinorVersion();
	
	/** 
	* Returns the version as as String.  If using EditRocket 1.04,
	* 1.04 would be returned.
	*/
	public String getVersionString();
	
	/**
	* Adds a menu item to the plugin menu.
	*/
	public void addPluginMenuItem(JMenuItem item);
	
	/**
	* Returns the text of the editor in the 
	* currently displayed tab in String format
	*/
	public String getText();
	
	/**
	* Returns the text of the editor in the currently
	* displayed tab in String format starting at the start position
	* until the specified length
	*/
	public String getText (int start, int length);
	
	/**
	* Returns the selected text of the editor in the currently
	* active tab, or null if there is no text selected
	*/
	public String getSelectedText();
	
	/**
	* Sets the text in the editor in the currently displayed tab
	*/
	public void setText (String text);
	
	/**
	* Replaces the current selection with the text, or 
	* if there is not selection, inserts the text into the editor
	* at the current cursor position
	*/
	public void setSelectedText (String text);
	
	/**
	* Returns the line number (0 based) that the cursor is currently on
	*/
	public int getCursorLine();
	
	/**
	* Returns the offset in the editor for the cursor position
	*/
	public int getCursorPosition();
	
	/**
	* Returns the line number which contains the passed in position
	*/
	public int getLineForPosition (int position);
	
	/**
	* Returns the total number of lines in the editor
	*/
	public int getLineCount();
	
	/**
	* Returns the text of the line for the lineNumber
	*/
	public String getLineText (int lineNumber);
	
	/**
	* Selects text from start to end
	*/
	public void select (int start, int end);
	
	/**
	* Sets the cursor position to the specified position
	*/
	public void setCursorPosition (int position);
	
	/**
	* Logs to the EditRocket log file
	* The logfile is located in the editrocket/logs 
	* directory under $USER_HOME directory.  $USER_HOME
	* is retrieved by doing a System.getProperty("user.home")
	*/
	public void log(Object obj);
	
	/**
	* Returns whether or not the user has a registered
	* copy of EditRocket
	*/
	public boolean isRegistered();
}
