Runtime

## org.eclipse.gmf.runtime.diagram.ui.resources.editor.util
Class DiagramFileCreator

    java.lang.Object
      org.eclipse.gmf.runtime.diagram.ui.resources.editor.util.DiagramFileCreator

Direct Known Subclasses:
  IDEEditorFileCreator

public abstract class DiagramFileCreator
extends java.lang.Object

Constructor Summary
`DiagramFileCreator()`

Method Summary
`java.lang.String` `appendExtensionToFileName(java.lang.String szFileName)` Given a string representing the possible file name, this function will ensure the proper extension is attached to it.
`protected void` `createFile(IFile fileHandle, java.io.InputStream contents, IProgressMonitor monitor)` Creates a file resource given the file handle and contents.
`IFile` `createNewFile(IPath containerPath, java.lang.String fileName, java.io.InputStream initialContents, Shell shell, IRunnableContext runContext)` Creates a new file cache given the name and containment path
`abstract java.lang.String` `getExtension()`
`protected Plugin` `getPlugin()`
`java.lang.String` `getUniqueFileName(IPath containerPath, java.lang.String szFileName)` Returns a unique file name for a given path and file name

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DiagramFileCreator

    public DiagramFileCreator()

Method Detail

### getExtension

    public abstract java.lang.String getExtension()

### getPlugin

    protected Plugin getPlugin()

### appendExtensionToFileName

    public java.lang.String appendExtensionToFileName(java.lang.String szFileName)

  Given a string representing the possible file name, this function will ensure the proper extension is attached to it.

  Parameters:
    `szFileName` - String representing the file name.
  Returns:
    Corrected file name containing the file extension.

### getUniqueFileName

    public java.lang.String getUniqueFileName(IPath containerPath,
                                              java.lang.String szFileName)

  Returns a unique file name for a given path and file name

  Parameters:
    `containerPath` - the container's full path
    `szFileName` - original file name
  Returns:
    the unique file name with number attached in the event of multiple matches

### createFile

    protected void createFile(IFile fileHandle,
                              java.io.InputStream contents,
                              IProgressMonitor monitor)
                       throws CoreException

  Creates a file resource given the file handle and contents.

  Parameters:
    `fileHandle` - the file handle to create a file resource with
    `contents` - the initial contents of the new file resource, or `null` if none (equivalent to an empty stream)
    `monitor` - the progress monitor to show visual progress with
  Throws:
    `CoreException` - if the operation fails
    `OperationCanceledException` - if the operation is canceled

### createNewFile

    public IFile createNewFile(IPath containerPath,
                               java.lang.String fileName,
                               java.io.InputStream initialContents,
                               Shell shell,
                               IRunnableContext runContext)

  Creates a new file cache given the name and containment path

  Parameters:
    `containerPath` - - IPath Directory path where the file will be stored
    `fileName` - - IPath Name of the file to be created.
    `initialContents` - InputStream of the initial contents of the file if desired.
    `shell` - SWT Shell object as a context so that error messages / progress can be displayed.
    `runContext` - IRunnableContext object which will run the file creation operation.
  Returns:
    IFile Resulting file that is created from the method logic.

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.