Enum PictureManager

    • Field Detail

      • PICTURE_EXTENSIONS

        public static final String[] PICTURE_EXTENSIONS
    • Method Detail

      • values

        public static PictureManager[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (PictureManager c : PictureManager.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static PictureManager valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • addListener

        public void addListener​(PictureManager.IPictureListener listener)
        Adds a listener to this manager that will be notified when this manager's state changes.
        Parameters:
        listener - The listener to be added; must not be null.
      • removeListener

        public void removeListener​(PictureManager.IPictureListener listener)
        Removes a listener from this manager.
        Parameters:
        listener - The listener to be removed; must not be null.
      • firePictureChange

        protected void firePictureChange​(PictureDef picture)
        Fires a picture change event.
        Parameters:
        picture - - a picture that changed
      • setContents

        public void setContents​(PictureDef picture,
                                InputStream input,
                                String extension)
                         throws IOException
        Reads contents of the given inputStream and stores it inside picture. After a successful completion PictureDef#inputStream() will return the given contents.
        Parameters:
        picture - a PictureDef to set contents of
        file - a InputStream to get contents from
        input - contents
        extension - file extension used to identify image type
        Throws:
        IOException - in case of failure
      • storeContents

        public <T> void storeContents​(PictureDef picture,
                                      org.eclipse.core.resources.IFile file)
                               throws org.eclipse.core.runtime.CoreException,
                                      IOException
        Writes the contents of this picture, which was set by #setContents(PictureDef, File) or #setContents(PictureDef, InputStream, URI), to file system.
        Type Parameters:
        T -
        Parameters:
        picture - a PictureDef to store contents of
        file - file name under which the given picture will be stored
        Throws:
        org.eclipse.core.runtime.CoreException
        IOException
      • deleteContents

        public void deleteContents​(PictureDef picture)
                            throws org.eclipse.core.runtime.CoreException
        Deletes the contents of the given picture. Also tries to remove the contents from the file system
        Throws:
        org.eclipse.core.runtime.CoreException
      • getExtension

        public static String getExtension​(PictureDef picture)
        Returns stored picture extension
        Parameters:
        picture -
        Returns:
      • isMultiImage

        public static boolean isMultiImage​(Picture picture)

        Is this picture object contain many images

        Parameters:
        picture - source picture object, cannot be null
        Returns:
        true if this picture contain many images
      • getFilename

        public static String getFilename​(PictureDef picture)
        Returns stored picture file name
        Parameters:
        picture -
        Returns: