Class PackagePropertiesModel
java.lang.Object
org.libreoffice.ide.eclipse.core.model.pack.PackagePropertiesModel
-
Constructor Summary
ConstructorsConstructorDescriptionPackagePropertiesModel(org.eclipse.core.resources.IFile file) Create a new package.properties model for a given file. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBasicLibrary(org.eclipse.core.resources.IFolder libFolder) Adds a Basic library folder to the package.voidaddDataListener(IModelDataListener listener) Add a listener notified of the model changes.voidaddDescriptionFile(org.eclipse.core.resources.IFile description, Locale locale) Adds a localized package description file.voidaddDialogLibrary(org.eclipse.core.resources.IFolder libFolder) Adds a basic dialog library folder to the package.voidaddResource(org.eclipse.core.resources.IResource res) add resource entry if not already in.voidaddTreeListener(IModelTreeListener listener) Add a listener notified of the TreeView changes.voidRemoves all the basic libraries from the package properties.voidRemoves all the file and directories from the package properties that has been added usingaddResource(IResource).voidRemoves all the description files from the package properties.voidRemoves all the dialog libraries from the package properties.voidNotify that the package properties model has changed.voidIModelChangedListener Notify that the package properties model has been saved.voidNotify that the tree view must do a refresh.List<org.eclipse.core.resources.IFolder>List<org.eclipse.core.resources.IResource>List<org.eclipse.core.resources.IFolder>booleanisChecked(org.eclipse.core.resources.IResource res) booleanisDirty()booleanisFilteredResource(org.eclipse.core.resources.IResource res) Get whether the resource is filtered or not.booleanisGrayed(org.eclipse.core.resources.IResource res) booleanGet whether the changes come from this data model or not.voidreloadFromString(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.voidremoveDataListener(IModelDataListener listener) Removes a class listening the model changes.voidremoveResource(org.eclipse.core.resources.IResource res) remove resource entry if already in.voidremoveTreeListener(IModelTreeListener listener) Removes a class listening the TreeView changes.voidsetModified(boolean modified) Set whether the changes should come from this data model or not.voidsetQuiet(boolean quiet) Set whether the changes should be notified to the listeners or not.booleanwrite()Writes the Package properties to the file.
-
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 isnull
-
-
Method Details
-
setQuiet
public void setQuiet(boolean quiet) Set whether the changes should be notified to the listeners or not.- Parameters:
quiet-trueif the changes should be notified,falseotherwise.
-
setModified
public void setModified(boolean modified) Set whether the changes should come from this data model or not.- Parameters:
modified-trueif the changes come from this data model,falseotherwise.
-
isModified
public boolean isModified()Get whether the changes come from this data model or not.- Returns:
trueif the changes come from this data model,falseotherwise.
-
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:
trueif resource is filtered,falseotherwise.
-
isDirty
public boolean isDirty()- Returns:
trueif the properties model has changed but isn't saved,falseotherwise.
-
addDataListener
Add a listener notified of the model changes.- Parameters:
listener- the listener to add.
-
removeDataListener
Removes a class listening the model changes.- Parameters:
listener- the listener to remove
-
addTreeListener
Add a listener notified of the TreeView changes.- Parameters:
listener- the listener to add.
-
removeTreeListener
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
Writes the Package properties to the file.- Returns:
trueif pending change exist,falseotherwise.- Throws:
Exception- if the data can't be written
-
reloadFromString
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
- 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 isnull
-
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 isnull
-
getDialogLibraries
- Returns:
- the list of the dialog libraries addedd to the package properties
-
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
- 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 usingaddResource(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 benull.- Parameters:
description- the description filelocale- the file locale.- Throws:
IllegalArgumentException- is thrown if the file isnullor doesn't exists or if the locale isnull.
-
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.
-