IBM Rational Software Modeler
Release 6.0

com.ibm.xtools.viz.ui
Class UMLDiagramResourceUtil

java.lang.Object
  extended bycom.ibm.xtools.viz.ui.UMLDiagramResourceUtil

public final class UMLDiagramResourceUtil
extends Object

A utility class that exposes UML diagram resource lifecycle operations and provides access to the modeling platform.

API clients should not instantiate this class.


Method Summary
static void closeDiagram(Diagram diagram)
          Closes the diagram specified by diagram
static Diagram createDiagram(String file, UMLDiagramKind umlDiagramKind)
          Creates a visualization diagram given a file path
static Diagram createDiagram(org.eclipse.emf.common.util.URI uri, UMLDiagramKind umlDiagramKind)
          Creates a visualization diagram given a URI
static EditingDomain getEditingDomain()
          Returns the UMLDiagramResourceUtil's EditingDomain.
static IEObjectHelper getEObjectHelper()
          Returns a helper to work with classes implementing EObject
static IUMLDiagramHelper getUMLDiagramHelper()
          Returns a user helper to work with classes implementing View
static IUMLUIHelper getUMLUIHelper()
          Returns a user interface helper to work with classes implementing Element
static Diagram openDiagram(String file)
          Opens the visualization diagram whose filename is described by file.
static Diagram openDiagram(org.eclipse.emf.common.util.URI uri)
          Opens the visualization diagram whose URI is described by uri.
static void saveDiagram(Diagram diagram)
          Saves the visualization diagram specified by diagram.
static void saveDiagramAs(Diagram diagram, String file)
          Saves the diagram specified by diagram to the location specified by file
static void saveDiagramAs(Diagram diagram, org.eclipse.emf.common.util.URI uri)
          Saves the diagram specified by diagram to the location specified by uri
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getEObjectHelper

public static IEObjectHelper getEObjectHelper()
Returns a helper to work with classes implementing EObject

Returns:
The UMLDiagramResourceUtil IEObjectHelper

getUMLUIHelper

public static IUMLUIHelper getUMLUIHelper()
Returns a user interface helper to work with classes implementing Element

Returns:
The UMLDiagramResourceUtil IUMLUIHelper

getUMLDiagramHelper

public static IUMLDiagramHelper getUMLDiagramHelper()
Returns a user helper to work with classes implementing View

Returns:
The UMLDiagramResourceUtil IUMLDiagramHelper

getEditingDomain

public static EditingDomain getEditingDomain()
Returns the UMLDiagramResourceUtil's EditingDomain. The latter is used to perform operations on the models managed by the tool. It also provides batched notification support.

Returns:
The UMLDiagramResourceUtil EditingDomain

createDiagram

public static Diagram createDiagram(String file,
                                    UMLDiagramKind umlDiagramKind)
Creates a visualization diagram given a file path

Parameters:
file - The diagram file to create, an extension will be added if not provided
umlDiagramKind - The kind of diagram to create, the only currently supported type is CLASS_LITERAL
Returns:
The created visualization diagram
Throws:
IllegalArgumentException - file is an empty string file specifies a filename with an invalid extension umlDiagramKind is unsupported
NullPointerException - file or umlDiagramKind is null

createDiagram

public static Diagram createDiagram(org.eclipse.emf.common.util.URI uri,
                                    UMLDiagramKind umlDiagramKind)
Creates a visualization diagram given a URI

Parameters:
uri - The URI of the diagram to create, an extension will be added if not provided
umlDiagramKind - The kind of diagram to create, the only currently supported type is CLASS_LITERAL
Returns:
The created visualization diagram
Throws:
IllegalArgumentException - uri specifies a filename with an invalid extension umlDiagramKind is unsupported
NullPointerException - uri or umlDiagramKind is null

openDiagram

public static Diagram openDiagram(String file)
                           throws IOException
Opens the visualization diagram whose filename is described by file.

Parameters:
file - The diagram file to open
Returns:
The opened visualization diagram
Throws:
IOException - The file specified by file could not be found or the file is corrupted or could not be opened
IllegalArgumentException - file is an empty string
NullPointerException - file is null

openDiagram

public static Diagram openDiagram(org.eclipse.emf.common.util.URI uri)
                           throws IOException
Opens the visualization diagram whose URI is described by uri.

Parameters:
uri - The URI of the diagram to open
Returns:
The opened visualization diagram
Throws:
IOException - The file specified by URI could not be found or the file is corrupted or could not be opened
NullPointerException - uri is null

saveDiagram

public static void saveDiagram(Diagram diagram)
                        throws IOException
Saves the visualization diagram specified by diagram.

Parameters:
diagram - The visualization diagram to save
Throws:
IOException - The location specified by the root path of diagram cannot be used to save the diagram
IllegalArgumentException - diagram has no associated resource (

saveDiagramAs

public static void saveDiagramAs(Diagram diagram,
                                 String file)
                          throws IOException
Saves the diagram specified by diagram to the location specified by file

Parameters:
diagram - The diagram to save
file - The location to save the diagram
Throws:
IOException - The location specified by file cannot be used to save the diagram
IllegalArgumentException - diagram has no associated resource ( file is empty

saveDiagramAs

public static void saveDiagramAs(Diagram diagram,
                                 org.eclipse.emf.common.util.URI uri)
                          throws IOException
Saves the diagram specified by diagram to the location specified by uri

Parameters:
diagram - The diagram to save
uri - The URI location to save the diagram
Throws:
IOException - The location specified by uri cannot be used to save the diagram
IllegalArgumentException - diagram has no associated resource

closeDiagram

public static void closeDiagram(Diagram diagram)
Closes the diagram specified by diagram

Parameters:
diagram - The diagram to close
Throws:
IllegalArgumentException - diagram has no associated resource (

IBM Rational Software Modeler
Release 6.0


Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2004. All rights reserved.