Class PackagePropertiesModel

java.lang.Object
org.libreoffice.ide.eclipse.core.model.pack.PackagePropertiesModel

public class PackagePropertiesModel extends Object
  • Constructor Details

    • PackagePropertiesModel

      public PackagePropertiesModel(org.eclipse.core.resources.IFile file) throws IllegalArgumentException
      Create a new package.properties model for a given file. If the file can be read, the existing properties will be imported.
      Parameters:
      file - the package.properties file represented by the object.
      Throws:
      IllegalArgumentException - if the file is null
  • Method Details

    • setQuiet

      public void setQuiet(boolean quiet)
      Set whether the changes should be notified to the listeners or not.
      Parameters:
      quiet - true if the changes should be notified, false otherwise.
    • setModified

      public void setModified(boolean modified)
      Set whether the changes should come from this data model or not.
      Parameters:
      modified - true if the changes come from this data model, false otherwise.
    • isModified

      public boolean isModified()
      Get whether the changes come from this data model or not.
      Returns:
      true if the changes come from this data model, false otherwise.
    • isFilteredResource

      public boolean isFilteredResource(org.eclipse.core.resources.IResource res)
      Get whether the resource is filtered or not. Files to exclude: .* Folders to exclude: build, bin
      Parameters:
      res - the resource to check.
      Returns:
      true if resource is filtered, false otherwise.
    • isDirty

      public boolean isDirty()
      Returns:
      true if the properties model has changed but isn't saved, false otherwise.
    • addDataListener

      public void addDataListener(IModelDataListener listener)
      Add a listener notified of the model changes.
      Parameters:
      listener - the listener to add.
    • removeDataListener

      public void removeDataListener(IModelDataListener listener)
      Removes a class listening the model changes.
      Parameters:
      listener - the listener to remove
    • addTreeListener

      public void addTreeListener(IModelTreeListener listener)
      Add a listener notified of the TreeView changes.
      Parameters:
      listener - the listener to add.
    • removeTreeListener

      public void removeTreeListener(IModelTreeListener listener)
      Removes a class listening the TreeView changes.
      Parameters:
      listener - the listener to remove
    • firePackageSaved

      public void firePackageSaved()
      IModelChangedListener Notify that the package properties model has been saved.
    • firePackageChanged

      public void firePackageChanged()
      Notify that the package properties model has changed.
    • fireTreeRefresh

      public void fireTreeRefresh()
      Notify that the tree view must do a refresh.
    • write

      public boolean write() throws Exception
      Writes the Package properties to the file.
      Returns:
      true if pending change exist, false otherwise.
      Throws:
      Exception - if the data can't be written
    • reloadFromString

      public void reloadFromString(String content)
      Clears all the content of the package properties and replace it by a string as if it would have been the properties file content.
      Parameters:
      content - the string describing the data
    • writeToString

      public String writeToString()
      Returns:
      the content of the package properties under the form of a string as it would have been written to the file.
    • addBasicLibrary

      public void addBasicLibrary(org.eclipse.core.resources.IFolder libFolder) throws IllegalArgumentException
      Adds a Basic library folder to the package.
      Parameters:
      libFolder - the library folder to add
      Throws:
      IllegalArgumentException - is thrown if the argument is null
    • addDialogLibrary

      public void addDialogLibrary(org.eclipse.core.resources.IFolder libFolder) throws IllegalArgumentException
      Adds a basic dialog library folder to the package.
      Parameters:
      libFolder - the library folder to add
      Throws:
      IllegalArgumentException - is thrown if the argument is null
    • getDialogLibraries

      public List<org.eclipse.core.resources.IFolder> getDialogLibraries()
      Returns:
      the list of the dialog libraries addedd to the package properties
    • getBasicLibraries

      public List<org.eclipse.core.resources.IFolder> getBasicLibraries()
      Returns:
      the list of the basic libraries addedd to the package properties
    • clearBasicLibraries

      public void clearBasicLibraries()
      Removes all the basic libraries from the package properties.
    • clearDialogLibraries

      public void clearDialogLibraries()
      Removes all the dialog libraries from the package properties.
    • addResource

      public void addResource(org.eclipse.core.resources.IResource res)
      add resource entry if not already in.
      Parameters:
      res - the resource (ie: file or folder) to add
    • removeResource

      public void removeResource(org.eclipse.core.resources.IResource res)
      remove resource entry if already in.
      Parameters:
      res - the resource (ie: file or folder) to add
    • isChecked

      public boolean isChecked(org.eclipse.core.resources.IResource res)
      Parameters:
      res - the resource (ie: file or folder) to check
      Returns:
      if resource is checked.
    • isGrayed

      public boolean isGrayed(org.eclipse.core.resources.IResource res)
      Parameters:
      res - the resource (ie: file or folder) to check
      Returns:
      if resource is grayed.
    • getContents

      public List<org.eclipse.core.resources.IResource> getContents()
      Returns:
      the list of the the files and selected empty folders added to the package properties that are not dialog or basic libraries or package descriptions
    • clearContents

      public void clearContents()
      Removes all the file and directories from the package properties that has been added using addResource(IResource).
    • addDescriptionFile

      public void addDescriptionFile(org.eclipse.core.resources.IFile description, Locale locale) throws IllegalArgumentException
      Adds a localized package description file. The description file has to exist and the locale can't be null.
      Parameters:
      description - the description file
      locale - the file locale.
      Throws:
      IllegalArgumentException - is thrown if the file is null or doesn't exists or if the locale is null.
    • getDescriptionFiles

      public Map<Locale,org.eclipse.core.resources.IFile> getDescriptionFiles()
      Returns:
      a map of the description files accessed by their locale. There is no support of a default locale.
    • clearDescriptions

      public void clearDescriptions()
      Removes all the description files from the package properties.