Class ModuleModel

java.lang.Object
com.iizigo.project.ModuleModel

public class ModuleModel extends Object
The IIZI Module Model.
Author:
Christopher Mindus
  • Field Details

    • RESOURCE_NAME_MARKER_ID

      public static final String RESOURCE_NAME_MARKER_ID
      The marker ID for resource name problems.
      See Also:
    • LOAD_FILE_MARKER_ID

      public static final String LOAD_FILE_MARKER_ID
      The marker ID for load file problems.
      See Also:
    • MISSING_RESOURCE_MARKER_ID

      public static final String MISSING_RESOURCE_MARKER_ID
      The marker ID for missing project resource problems.
      See Also:
    • MODULE_DIRECTORY_NAME

      public static final String MODULE_DIRECTORY_NAME
      The "iiziModule" module directory name, where files are stored.
      See Also:
    • MODULE_SETTINGS_FILE_NAME

      public static final String MODULE_SETTINGS_FILE_NAME
      The ".iiziModuleProject" file name containing all settings.
      See Also:
    • moduleSettings

      public final org.eclipse.core.resources.IFile moduleSettings
      The IIZI Module settings file, null when creating new model project.
  • Method Details

    • from

      public static ModuleModel from(org.eclipse.core.resources.IProject project)
      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

      public JavaRootContainer getJavaPropCnr()
      Gets the property container for a project.
      Returns:
      The Java property container.
    • getSettings

      public ModuleProjectSettings getSettings()
      Gets the Module Project Settings.
    • isReservedResource

      public String isReservedResource(org.eclipse.core.resources.IResource resource)
      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

      public PluginDescriptor[] getPlugins()
      Gets the associated plug-ins.
      Returns:
      The array of plug-in's.
    • removePlugin

      public int removePlugin(PluginDescriptor pd) throws org.eclipse.core.runtime.CoreException
      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

      public boolean isPluginActive(PluginDescriptor pd)
      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

      public ModuleFolder getVirtualSpaceModuleFolder()
      Gets the module folder for VirtualSpace.
      Returns:
      The ModuleFolder instance.
    • getPanelModuleFolder

      public ModuleFolder getPanelModuleFolder()
      Gets the module folder for panels.
      Returns:
      The ModuleFolder instance.
    • getStyleModuleFolder

      public ModuleFolder getStyleModuleFolder()
      Gets the module folder for styles.
      Returns:
      The ModuleFolder instance.
    • getSelectorModuleFolder

      public ModuleFolder getSelectorModuleFolder()
      Gets the module folder for selectors.
      Returns:
      The ModuleFolder instance.
    • getImageDefinitionModuleFolder

      public ModuleFolder getImageDefinitionModuleFolder()
      Gets the module folder for image definitions.
      Returns:
      The ModuleFolder instance.
    • getAssetsModuleFolder

      public ModuleFolder getAssetsModuleFolder()
      Gets the module folder for assets.
      Returns:
      The ModuleFolder instance.
    • getTextTableModuleFolder

      public ModuleFolder getTextTableModuleFolder()
      Gets the module folder for text tables.
      Returns:
      The ModuleFolder instance.
    • getModuleFolder

      public ModuleFolder getModuleFolder(String type)
      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

      public ModuleFolder getModuleFolder(PluginDescriptor pd)
      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

      public ModuleFolder[] 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

      public ModuleRootPropCnr getRootContainer()
      Gets the root container.
      Returns:
      The root property container for the Module.
    • getKStringInfoProvider

      public IKStringInfoProvider getKStringInfoProvider()
      Gets a KStringInfoProvider initialized for the module model.
      Returns:
      A KStringInfoProvider instance.
    • getCNChildren

      public Object[] 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

      public void markModuleReference(ModuleModel module)
      Marks a Module as being used by or referenced in this project.
      Parameters:
      module - The module to mark as referenced.
    • markModuleReference

      public void markModuleReference(String moduleName)
      Marks a Module as being used by or referenced in this project.
      Parameters:
      moduleName - The module name to mark as referenced.
    • getModuleNameReferences

      public String[] 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

      public ModuleModel[] 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

      public ResourceDesignerProp[] 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

      public List<org.eclipse.core.resources.IProject> 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

      public boolean removeCommitRefactoringListener(ICommitRefactoring listener)
      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

      public List<EditorFontFiles> getInstalledFonts()
      Gets all the installed fonts in this project and all projects referenced.
      Returns:
      A new list with the font files instances.
    • getStylesFontFiles

      public EditorFontFiles[] getStylesFontFiles()
      Gets the fonts installed in this module project.
      Returns:
      A new array of font files, only from the styles font faces.
    • getInstalledFontsMap

      public Map<String,List<FontFiles>> 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

      public boolean addResourceListener(IModuleProjectResourceListener listener)
      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 is null.
    • removeResourceListener

      public boolean removeResourceListener(IModuleProjectResourceListener listener)
      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.