Package com.iizigo.project
Class ModuleModel
java.lang.Object
com.iizigo.project.ModuleModel
The IIZI Module Model.
- Author:
- Christopher Mindus
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The marker ID for load file problems.static final String
The marker ID for missing project resource problems.static final String
The "iiziModule" module directory name, where files are stored.static final String
The ".iiziModuleProject" file name containing all settings.final org.eclipse.core.resources.IFile
The IIZI Module settings file, null when creating new model project.static final String
The marker ID for resource name problems.Method Summary
Modifier and TypeMethodDescriptionboolean
addCommitRefactoringListener
(ICommitRefactoring listener, RefactoringOperation... operations) Adds a listener for Commit Refactoring in this project.void
addPlugin
(PluginDescriptor pd, boolean doCreateDir) Adds a plug-in to this Module project instance, without creating anything.boolean
Adds a new resource listener when a resource is added or removed.void
Cleans the property error markers from this project and rebuilds them.void
Clears the installed font map cache.static ModuleModel
from
(org.eclipse.core.resources.IProject project) Gets the module model from a project if possible.org.eclipse.core.resources.IFile
Gets the application distribution file.Gets the module folder for assets.org.eclipse.core.resources.IFolder
Gets the base module folder "iiziModule".List<org.eclipse.core.resources.IProject>
Gets the Java projects that are included on the classpath of this project.Object[]
Gets the children (just one) for the root container for the Common Navigator.Gets the module folder for image definitions.Gets all the installed fonts in this project and all projects referenced.Gets the map of installed fonts.org.eclipse.jdt.core.IJavaProject
Gets the Java Project instance for this project.Gets the property container for a project.Gets a KStringInfoProvider initialized for the module model.Gets the module folder for a plug-in.getModuleFolder
(String type) Gets the array of folders defined for the module project.Gets the array of folders defined for the module project.String[]
Gets the Modules that are referenced by this Module project.Gets the Projects that are referenced by this Module project.Gets the module folder for panels.Gets the associated plug-ins.org.eclipse.core.resources.IProject
Gets the project.org.eclipse.core.resources.IProject[]
getProjectReferences
(boolean onlyModuleProjects) Gets the Projects that are referenced by this Module project.org.eclipse.core.resources.IFolder[]
Gets the array of folders required to be created.Gets the designer properties of the module models that are referenced by this Module project.Gets the root container.Gets the module folder for selectors.Gets the Module Project Settings.Gets the module folder for styles.Gets the fonts installed in this module project.Gets the module folder for text tables.Gets the module folder for VirtualSpace.boolean
Verifies if project has completed loading and it is not disposed of.boolean
Checks if the Module project is disposed of.boolean
isModuleSettingsFile
(org.eclipse.core.resources.IResource file) Checks if the file is the module settings file.boolean
isOnClassPath
(org.eclipse.core.resources.IResource resource) Checks if a resource is inside the classpath of this Module project.boolean
Checks if a plug-in is active in the Module project.isReservedResource
(org.eclipse.core.resources.IResource resource) Checks if the resource is a reserved resource.void
markModuleReference
(ModuleModel module) Marks a Module as being used by or referenced in this project.void
markModuleReference
(String moduleName) Marks a Module as being used by or referenced in this project.boolean
Removes a listener for Commit Refactoring in this project.int
Removes the specified plug-in from this project.boolean
Removes a new resource listener when a resource is added or removed.void
Saves the Java classpath of a project in order to be able to use it in the Server.void
Saves the settings when possible.org.eclipse.core.runtime.CoreException
saveSettings
(org.eclipse.swt.widgets.Shell shell) Saves the module settings.void
Schedules a full build of a project.boolean
Validates the presence of the required project resources and the problem markers for the project.
Field Details
RESOURCE_NAME_MARKER_ID
The marker ID for resource name problems.- See Also:
LOAD_FILE_MARKER_ID
The marker ID for load file problems.- See Also:
MISSING_RESOURCE_MARKER_ID
The marker ID for missing project resource problems.- See Also:
MODULE_DIRECTORY_NAME
The "iiziModule" module directory name, where files are stored.- See Also:
MODULE_SETTINGS_FILE_NAME
The ".iiziModuleProject" file name containing all settings.- See Also:
moduleSettings
public final org.eclipse.core.resources.IFile moduleSettingsThe IIZI Module settings file, null when creating new model project.
Method Details
from
Gets the module model from a project if possible.- Parameters:
project
- The project.- Returns:
- The module model if the project is an IIZI Module project, null otherwise.
getAppDistributionFile
public org.eclipse.core.resources.IFile getAppDistributionFile()Gets the application distribution file.- Returns:
- The file, but it may not exist!
getJavaPropCnr
Gets the property container for a project.- Returns:
- The Java property container.
getSettings
Gets the Module Project Settings.isReservedResource
Checks if the resource is a reserved resource.- Parameters:
resource
- File or Folder to check.- Returns:
- The error string or null for no error. An error is returned if it's a project or the workspace root.
isDisposed
public boolean isDisposed()Checks if the Module project is disposed of.getJavaProject
public org.eclipse.jdt.core.IJavaProject getJavaProject()Gets the Java Project instance for this project.addPlugin
public void addPlugin(PluginDescriptor pd, boolean doCreateDir) throws org.eclipse.core.runtime.CoreException Adds a plug-in to this Module project instance, without creating anything. If a folder doesn't exist, CoreException is thrown.- Parameters:
pd
- The plug-in description.doCreateDir
- Flag to create the directory of the plug-in, if it is directory/file plug-in.- Throws:
org.eclipse.core.runtime.CoreException
- For errors.
getPlugins
Gets the associated plug-ins.- Returns:
- The array of plug-in's.
removePlugin
Removes the specified plug-in from this project. This can only be done if no files are present in the folder.- Parameters:
pd
- The plug-in description.- Returns:
- 0=OK, 1=not active, 2=Can't remove: directory is not empty, 3=directory error.
- Throws:
org.eclipse.core.runtime.CoreException
- For errors.
isPluginActive
Checks if a plug-in is active in the Module project.- Returns:
- true if the plug-in is active, false otherwise.
getBaseModuleFolder
public org.eclipse.core.resources.IFolder getBaseModuleFolder()Gets the base module folder "iiziModule".- Returns:
- The base module folder.
getVirtualSpaceModuleFolder
Gets the module folder for VirtualSpace.- Returns:
- The ModuleFolder instance.
getPanelModuleFolder
Gets the module folder for panels.- Returns:
- The ModuleFolder instance.
getStyleModuleFolder
Gets the module folder for styles.- Returns:
- The ModuleFolder instance.
getSelectorModuleFolder
Gets the module folder for selectors.- Returns:
- The ModuleFolder instance.
getImageDefinitionModuleFolder
Gets the module folder for image definitions.- Returns:
- The ModuleFolder instance.
getAssetsModuleFolder
Gets the module folder for assets.- Returns:
- The ModuleFolder instance.
getTextTableModuleFolder
Gets the module folder for text tables.- Returns:
- The ModuleFolder instance.
getModuleFolder
Gets the array of folders defined for the module project.- Parameters:
type
- The type, e.g. "panel".- Returns:
- The ModuleFolder for the type, null if not found.
getModuleFolder
Gets the module folder for a plug-in.- Parameters:
pd
- The plug-in descriptor.- Returns:
- The ModuleFolder for the type, null if defined for the project, or the plug-in is not directory based.
getModuleFolders
Gets the array of folders defined for the module project.- Returns:
- A new array of the ModuleFolder's.
getProject
public org.eclipse.core.resources.IProject getProject()Gets the project.- Returns:
- The Eclipse project.
getRootContainer
Gets the root container.- Returns:
- The root property container for the Module.
getKStringInfoProvider
Gets a KStringInfoProvider initialized for the module model.- Returns:
- A KStringInfoProvider instance.
getCNChildren
Gets the children (just one) for the root container for the Common Navigator.- Returns:
- The children to display for the Common Navigator.
hasCompletedLoading
public boolean hasCompletedLoading()Verifies if project has completed loading and it is not disposed of.- Returns:
- true if loading has completed and the project is not closed or disposed of.
validateProjectResourcePresence
public boolean validateProjectResourcePresence()Validates the presence of the required project resources and the problem markers for the project.- Returns:
- true for OK, false for error.
getQuickFixCreateFolders
public org.eclipse.core.resources.IFolder[] getQuickFixCreateFolders()Gets the array of folders required to be created.- Returns:
- The array of folders that needs to be created, null for none (i.e. OK).
saveSettings
public void saveSettings()Saves the settings when possible. If the workspace is locked, the operation is postponed in a Job.saveSettings
public org.eclipse.core.runtime.CoreException saveSettings(org.eclipse.swt.widgets.Shell shell) Saves the module settings.- Parameters:
shell
- Shell used for error message, null for logging only.- Returns:
- null for success, otherwise the exception.
isModuleSettingsFile
public boolean isModuleSettingsFile(org.eclipse.core.resources.IResource file) Checks if the file is the module settings file.- Parameters:
file
- The file to test with.- Returns:
- true if it's the module settings file, false otherwise.
isOnClassPath
public boolean isOnClassPath(org.eclipse.core.resources.IResource resource) Checks if a resource is inside the classpath of this Module project.- Parameters:
resource
- The resource to check.- Returns:
- true if it's on the classpath, false otherwise.
markModuleReference
Marks a Module as being used by or referenced in this project.- Parameters:
module
- The module to mark as referenced.
markModuleReference
Marks a Module as being used by or referenced in this project.- Parameters:
moduleName
- The module name to mark as referenced.
getModuleNameReferences
Gets the Modules that are referenced by this Module project.- Returns:
- An new (cloned) array of all the referenced Module names.
getProjectReferences
public org.eclipse.core.resources.IProject[] getProjectReferences(boolean onlyModuleProjects) Gets the Projects that are referenced by this Module project.- Parameters:
onlyModuleProjects
- Flag for only module projects, or if Java projects should be added too.- Returns:
- An new (cloned) array of all the referenced Module Projects. The projects can be both Java projects as well as Module projects.
getModuleProjectReferences
Gets the Projects that are referenced by this Module project. This module is included first.- Returns:
- An new (cloned) array of all the referenced Module Projects.
getReferencedDesignerPropModules
Gets the designer properties of the module models that are referenced by this Module project. This project's designer property always comes first.- Returns:
- An new (cloned) array of all the Module Project's designer properties.
getBuildPathProjects
Gets the Java projects that are included on the classpath of this project.- Returns:
- A new list of projects on the build path.
addCommitRefactoringListener
public boolean addCommitRefactoringListener(ICommitRefactoring listener, RefactoringOperation... operations) Adds a listener for Commit Refactoring in this project.- Parameters:
listener
- The listener.operations
- The operations of interest.- Returns:
- true if successful, false if listener was already present.
removeCommitRefactoringListener
Removes a listener for Commit Refactoring in this project.- Parameters:
listener
- The listener.- Returns:
- true if successful, false if listener was not present.
scheduleCleanAndRebuild
public void scheduleCleanAndRebuild()Schedules a full build of a project.cleanRebuildPropertyMarkers
public void cleanRebuildPropertyMarkers()Cleans the property error markers from this project and rebuilds them.saveClasspath
public void saveClasspath()Saves the Java classpath of a project in order to be able to use it in the Server.getInstalledFonts
Gets all the installed fonts in this project and all projects referenced.- Returns:
- A new list with the font files instances.
getStylesFontFiles
Gets the fonts installed in this module project.- Returns:
- A new array of font files, only from the styles font faces.
getInstalledFontsMap
Gets the map of installed fonts. This map is cached and a read-only copy is returned. The key in the map is the font family name. If a font family has several styles/weights defined, the normal weight and style is used the EditorFontFiles instance.- Returns:
- An map of the installed fonts. Do not modify this map or the List value(s), it is a shared instance.
clearInstalledFontsMapCache
public void clearInstalledFontsMapCache()Clears the installed font map cache.addResourceListener
Adds a new resource listener when a resource is added or removed. Calling this method multiple times with the same listener will have no effect (but to return false).- Parameters:
listener
- The listener to add.- Returns:
- true if the listener was added, false otherwise.
- Throws:
NullPointerException
- If the listener isnull
.
removeResourceListener
Removes a new resource listener when a resource is added or removed.- Parameters:
listener
- The listener to remove.- Returns:
- true if listener is successfully removed, false otherwise.