projectManager
Class PIDEFile

java.lang.Object
  extended by projectManager.PIDEFile
Direct Known Subclasses:
ProjectFile, SystemSettingsFile

public abstract class PIDEFile
extends java.lang.Object

This class is the parent class of all file types used bu PIDE.

Since:
17.3.2007
Author:
maho

Field Summary
static int ASM
           
static int ASM_HEADER
           
static int ASM_PLUS_PLUS
           
static int DEBUG
           
protected  boolean dirty
          The value that indicates if the file is modified since the last save operation
protected  java.lang.String fileBuffer
          The buffer that holds a partial content of the file
protected  java.lang.String fileName
          Name of the file without extension
protected  java.lang.String filePath
          The full path of the directory where the file resides
protected  int fileType
          Indicates the file's extension
static int HEX
           
static int PROJECT
           
static int SYSTEM_SETTINGS
           
static int TEST
           
 
Constructor Summary
PIDEFile()
          Default constructor.
PIDEFile(int fileType, java.lang.String fileName, java.lang.String filePath)
          Main constructor for an abstract PIDE file
 
Method Summary
 int closeFile()
          This method closes the file.
 java.lang.String getFileBuffer()
           
 java.lang.String getFileName()
           
 java.lang.String getFilePath()
           
 int getFileType()
           
 boolean isDirty()
          Returns if the file is modified
abstract  void load()
          This method loads the actual file into the fileBuffer.
abstract  void save()
          This method saves the content of the fileBuffer into actual file defined by class attributes.
 void setDirty(boolean dirty)
          Method to change file's dirty status
 void setFileName(java.lang.String fileName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SYSTEM_SETTINGS

public static final int SYSTEM_SETTINGS
See Also:
Constant Field Values

PROJECT

public static final int PROJECT
See Also:
Constant Field Values

ASM_PLUS_PLUS

public static final int ASM_PLUS_PLUS
See Also:
Constant Field Values

ASM

public static final int ASM
See Also:
Constant Field Values

ASM_HEADER

public static final int ASM_HEADER
See Also:
Constant Field Values

HEX

public static final int HEX
See Also:
Constant Field Values

TEST

public static final int TEST
See Also:
Constant Field Values

DEBUG

public static final int DEBUG
See Also:
Constant Field Values

fileType

protected int fileType
Indicates the file's extension


fileName

protected java.lang.String fileName
Name of the file without extension


filePath

protected java.lang.String filePath
The full path of the directory where the file resides


fileBuffer

protected java.lang.String fileBuffer
The buffer that holds a partial content of the file


dirty

protected boolean dirty
The value that indicates if the file is modified since the last save operation

Constructor Detail

PIDEFile

public PIDEFile()
Default constructor. Required for a default super constructor. This constructor does not initialize anything.


PIDEFile

public PIDEFile(int fileType,
                java.lang.String fileName,
                java.lang.String filePath)
Main constructor for an abstract PIDE file

Parameters:
fileType -
fileName -
filePath -
Method Detail

save

public abstract void save()
This method saves the content of the fileBuffer into actual file defined by class attributes. Also clears the dirty flag.


load

public abstract void load()
This method loads the actual file into the fileBuffer. If the specified file is active and dirty, then method asks the user if s/he wants to discard changes.


closeFile

public int closeFile()
This method closes the file. If the file is dirty, then method asks the user if s/he wants to save changes. Returns a value representing if the user wants to close the file or not. The method handles the saving operation itself, return value can be used by EditorPane to actually close the file tab. Valid return values are: 0 - Do not close file 1 - Close file -1 - Error

Returns:
a value representing if the user wants to close the file or not.

isDirty

public boolean isDirty()
Returns if the file is modified

Returns:
booelean value that indicates if there is a change in the file

setDirty

public void setDirty(boolean dirty)
Method to change file's dirty status

Parameters:
dirty -

getFileName

public java.lang.String getFileName()
Returns:
the fileName

setFileName

public void setFileName(java.lang.String fileName)
Parameters:
fileName - the fileName to set

getFilePath

public java.lang.String getFilePath()
Returns:
the filePath

getFileType

public int getFileType()
Returns:
the fileType

getFileBuffer

public java.lang.String getFileBuffer()
Returns:
the fileBuffer