Class PackagePropertiesModel
- java.lang.Object
-
- org.libreoffice.ide.eclipse.core.model.pack.PackagePropertiesModel
-
public class PackagePropertiesModel extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description PackagePropertiesModel(org.eclipse.core.resources.IFile pFile)Create a new package.properties model for a given file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBasicLibrary(org.eclipse.core.resources.IFolder pLibFolder)Adds a Basic library folder to the package.voidaddChangeListener(IModelChangedListener pListener)Add a listener notified of the model changes.voidaddContent(org.eclipse.core.resources.IResource pRes)Adds a file or directory to the package properties.voidaddDescriptionFile(org.eclipse.core.resources.IFile pDescription, java.util.Locale pLocale)Adds a localized package description file.voidaddDialogLibrary(org.eclipse.core.resources.IFolder pLibFolder)Adds a basic dialog library folder to the package.voidclearBasicLibraries()Removes all the basic libraries from the package properties.voidclearContents()Removes all the file and directories from the package properties that has been added usingaddContent(IResource).voidclearDescriptions()Removes all the description files from the package properties.voidclearDialogLibraries()Removes all the dialog libraries from the package properties.voidfirePackageChanged()Notify that the package properties model has changed.voidfirePackageSaved()Notify that the package properties model has been saved.java.util.List<org.eclipse.core.resources.IFolder>getBasicLibraries()java.util.List<org.eclipse.core.resources.IResource>getContents()java.util.Map<java.util.Locale,org.eclipse.core.resources.IFile>getDescriptionFiles()java.util.List<org.eclipse.core.resources.IFolder>getDialogLibraries()booleanisDirty()voidreloadFromString(java.lang.String pContent)Clears all the content of the package properties and replace it by a string as if it would have been the properties file content.voidremoveChangedListener(IModelChangedListener pListener)Removes a class listening the model changes.voidsetQuiet(boolean pQuiet)Set whether the changes should be notified to the listeners or not.voidwrite()Writes the Package properties to the file.java.lang.StringwriteToString()
-
-
-
Constructor Detail
-
PackagePropertiesModel
public PackagePropertiesModel(org.eclipse.core.resources.IFile pFile) throws java.lang.IllegalArgumentExceptionCreate a new package.properties model for a given file. If the file can be read, the existing properties will be imported.- Parameters:
pFile- the package.properties file represented by the object.- Throws:
java.lang.IllegalArgumentException- if the file isnull
-
-
Method Detail
-
setQuiet
public void setQuiet(boolean pQuiet)
Set whether the changes should be notified to the listeners or not.- Parameters:
pQuiet-trueif the changes should be notified,falseotherwise.
-
addChangeListener
public void addChangeListener(IModelChangedListener pListener)
Add a listener notified of the model changes.- Parameters:
pListener- the listener to add.
-
removeChangedListener
public void removeChangedListener(IModelChangedListener pListener)
Removes a class listening the model changes.- Parameters:
pListener- the listener to remove
-
firePackageSaved
public void firePackageSaved()
Notify that the package properties model has been saved.
-
firePackageChanged
public void firePackageChanged()
Notify that the package properties model has changed.
-
isDirty
public boolean isDirty()
- Returns:
trueif the properties model has changed but isn't saved,falseotherwise.
-
write
public void write() throws java.lang.ExceptionWrites the Package properties to the file.- Throws:
java.lang.Exception- if the data can't be written
-
reloadFromString
public void reloadFromString(java.lang.String pContent)
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:
pContent- the string describing the data
-
writeToString
public java.lang.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 pLibFolder) throws java.lang.IllegalArgumentExceptionAdds a Basic library folder to the package.- Parameters:
pLibFolder- the library folder to add- Throws:
java.lang.IllegalArgumentException- is thrown if the argument isnull
-
addDialogLibrary
public void addDialogLibrary(org.eclipse.core.resources.IFolder pLibFolder) throws java.lang.IllegalArgumentExceptionAdds a basic dialog library folder to the package.- Parameters:
pLibFolder- the library folder to add- Throws:
java.lang.IllegalArgumentException- is thrown if the argument isnull
-
getDialogLibraries
public java.util.List<org.eclipse.core.resources.IFolder> getDialogLibraries()
- Returns:
- the list of the dialog libraries addedd to the package properties
-
getBasicLibraries
public java.util.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.
-
addContent
public void addContent(org.eclipse.core.resources.IResource pRes) throws java.lang.IllegalArgumentExceptionAdds a file or directory to the package properties.Do not add dialog or basic libraries or package descriptions using this method: use the appropriate method.
- Parameters:
pRes- the resource to add- Throws:
java.lang.IllegalArgumentException- is thrown if the argument isnull
-
getContents
public java.util.List<org.eclipse.core.resources.IResource> getContents()
- Returns:
- the list of the the files and directories 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 usingaddContent(IResource).
-
addDescriptionFile
public void addDescriptionFile(org.eclipse.core.resources.IFile pDescription, java.util.Locale pLocale) throws java.lang.IllegalArgumentExceptionAdds a localized package description file. The description file has to exist and the locale can't benull.- Parameters:
pDescription- the description filepLocale- the file locale.- Throws:
java.lang.IllegalArgumentException- is thrown if the file isnullor doesn't exists or if the locale isnull.
-
getDescriptionFiles
public java.util.Map<java.util.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.
-
-