Class ServerConfigFile


public class ServerConfigFile extends GenericListener<IServerConfigFileListener>
The Server configuration file container. A single copy of each file is used system-wide.
Author:
Christopher Mindus
  • Method Details

    • open

      public static ServerConfigFile open(String fileName) throws IOException, PropException
      Opens the configuration file. The reference count of the file is increased, and as there is only one instance of it system-wide, it is VERY important to release it with release() when it is no longed referenced.
      Parameters:
      fileName - The file name.
      Returns:
      The configuration file instance.
      Throws:
      IOException - For file errors.
      FileNotFoundException - If the file is not found.
      PropException - For load errors.
    • loadFile

      public static EditorServerSettings loadFile(File file) throws IOException, PropException
      Loads the Server Configuration settings file. This method does not affect the internal state of the ServerConfigFile instance or the global settings. It's just a method to load the file.
      Parameters:
      file - The file.
      Returns:
      The settings.
      Throws:
      IOException - For file errors.
      PropException - For load errors.
    • getHistory

      public static List<File> getHistory()
      Gets the history of configuration files. Only files that do exist are returned.
      Returns:
      The history of configuration files.
    • getNameNoExt

      public String getNameNoExt()
      Gets the name without file extension.
      Returns:
      The file base name.
    • getPath

      public String getPath()
      Gets the path of the file.
      Returns:
      The file path.
    • isDirty

      public boolean isDirty()
      Gets the dirty state.
      Returns:
      true if file needs saving, false if not dirty.
    • triggerNotify

      public void triggerNotify()
      Triggers a request to update the listeners. This can be called from any thread. The listeners will be notified with a delay of (currently) 300ms.
    • doSave

      public boolean doSave(org.eclipse.swt.widgets.Shell shell, org.eclipse.core.runtime.IProgressMonitor monitor)
      Saves the configuration file. The dirty state is changed upon successful save. Call this method from the UI thread.
      Parameters:
      shell - The shell for message boxes in case of error.
      monitor - The progress monitor
      Returns:
      Success flag.
    • getSettings

      public EditorServerSettings getSettings()
      Gets the Server configuration settings.
      Returns:
      The settings property.
    • release

      public void release()
      Releases this instance.
    • updateHistory

      public void updateHistory()
      Updates the history with this file. It is placed as the most recently used in the list.