Runtime

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

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

Direct Known Subclasses:
  IDEEditorUtil

    public class EditorUtil

extends java.lang.Object

Diagram Utility Class for Editor.

Constructor Summary
`EditorUtil()`

Method Summary
`static IFile` `createNewDiagramFile(DiagramFileCreator diagramFileCreator, IPath containerFullPath, java.lang.String fileName, java.io.InputStream initialContents, java.lang.String kind, Shell shell, IProgressMonitor progressMonitor, PreferencesHint preferencesHint)` Creates a new diagram file resource in the selected container and with the selected name.
`static IPath` `getDefaultDiagramPath(java.util.List elements, java.lang.String diagramKind)` Gets the default diagram path for a new diagram that will contain the elements in `elements`.
`static java.io.InputStream` `getInitialContents()` Method getInitialContents.

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

Constructor Detail

### EditorUtil

    public EditorUtil()

Method Detail

### createNewDiagramFile

    public static IFile createNewDiagramFile(DiagramFileCreator diagramFileCreator,
                                             IPath containerFullPath,
                                             java.lang.String fileName,
                                             java.io.InputStream initialContents,
                                             java.lang.String kind,
                                             Shell shell,
                                             IProgressMonitor progressMonitor,
                                             PreferencesHint preferencesHint)

  Creates a new diagram file resource in the selected container and with the selected name. Creates any missing resource containers along the path; does nothing if the container resources already exist. Creates a new editing domain for this diagram.

  In normal usage, this method is invoked after the user has pressed Finish on the wizard; the enablement of the Finish button implies that all controls on on this page currently contain valid values.

  Note that this page caches the new file once it has been successfully created; subsequent invocations of this method will answer the same file resource without attempting to create it again.

  This method should be called within a workspace modify operation since it creates resources.

  Parameters:
    `preferencesHint` - The preference hint that is to be used to find the appropriate preference store from which to retrieve diagram preference values. The preference hint is mapped to a preference store in the preference registry <@link DiagramPreferencesRegistry>.
  Returns:
    the created file resource, or `null` if the file was not created

### getDefaultDiagramPath

    public static IPath getDefaultDiagramPath(java.util.List elements,
                                              java.lang.String diagramKind)

  Gets the default diagram path for a new diagram that will contain the elements in `elements`. Returns `null` if there is no IVizUIHandler to handle the visualization, or there is a handler, but it has no default diagram path for the elements.

  Parameters:
    `elements` - the list of elements being visualized on a new class diagram
    `diagramKind` - the kind of diagram we want to create
  Returns:
    the default diagram path for a new diagram that will contain the elements in `elements`. Returns `null` if there is no IVizUIHandler to handle the visualization, or there is a handler, but it has no default diagram path for the elements.

### getInitialContents

    public static java.io.InputStream getInitialContents()

  Method getInitialContents. Gets the initial contents of the UML Visualizer diagram file. Currently it returns an empty byte stream.

  Returns:
    Byte stream that will initially populate the UML Visualizer diagram file.

Runtime

Guidelines for using Eclipse APIs.

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