public class DiagramEditorInput extends java.lang.Object implements IEditorInput, IPersistableElement, IDiagramEditorInput
IDiagramContainerUI
s. Wraps the URI
of
a Diagram
and an ID of a diagram type provider for displaying it with
a Graphiti diagram editor.IEditorInput}
,
IPersistableElement}
,
DiagramEditorInputFactory}
,
IDiagramContainerUI}
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
KEY_PROVIDER_ID
The memento key for the ID of the diagram type provider.
|
static java.lang.String |
KEY_URI
The memento key for the stored
URI string |
Constructor and Description |
---|
DiagramEditorInput(org.eclipse.emf.common.util.URI diagramUri,
java.lang.String providerId)
Creates a new
DiagramEditorInput out of a URI string and
a Graphiti diagram type provider ID. |
Modifier and Type | Method and Description |
---|---|
static DiagramEditorInput |
createEditorInput(Diagram diagram,
java.lang.String providerId)
Creates a new
DiagramEditorInput for the given Diagram
and the given diagram type provider ID. |
boolean |
equals(java.lang.Object obj)
Checks if this instance of the input represent the same object as the
given instance.
|
boolean |
exists()
Checks if the diagram this input represents exist.
|
java.lang.Object |
getAdapter(java.lang.Class adapter)
Adapter method as defined in
IAdaptable , supports adaptation to
IFile . |
java.lang.String |
getFactoryId()
Returns the factory ID for creating
DiagramEditorInput s from
mementos. |
ImageDescriptor |
getImageDescriptor() |
java.lang.String |
getName() |
IPersistableElement |
getPersistable() |
java.lang.String |
getProviderId()
Returns the diagram type provider id.
|
java.lang.String |
getToolTipText() |
org.eclipse.emf.common.util.URI |
getUri() |
java.lang.String |
getUriString() |
int |
hashCode() |
void |
saveState(IMemento memento)
Saves
URI string, object name and provider ID to the given
IMemento . |
void |
setProviderId(java.lang.String providerId)
Sets the diagram type provider id.
|
java.lang.String |
toString()
Used for logging only!
|
void |
updateUri(org.eclipse.emf.common.util.URI diagramFileUri) |
public static final java.lang.String KEY_URI
URI
stringpublic static java.lang.String KEY_PROVIDER_ID
public DiagramEditorInput(org.eclipse.emf.common.util.URI diagramUri, java.lang.String providerId)
DiagramEditorInput
out of a URI
string and
a Graphiti diagram type provider ID. For resolving the URI
to an
EObject
the ResourceSet
that will be created when a
diagram editor starts is taken. This input object will not resolve the
diagram.diagramUri
- A URI
that denotes the input's EObject
. This
can either be a URI of a Graphiti diagram or the URI of an EMF
resource storing a Graphiti diagram. In the latter case the
given URI will b e trimmed to point to the first element in
the resource; make sure that this element is a Graphiti
diagram, otherwise an exception will be thrown when the
diagram editor opens. No check on this is done inside the
input object itself!providerId
- A String
which holds the diagram type id. When it is
null, it is set later in
DiagramBehavior#setInput(IEditorInput)
java.lang.IllegalArgumentException
- if uriString
parameter is null URI
public static DiagramEditorInput createEditorInput(Diagram diagram, java.lang.String providerId)
DiagramEditorInput
for the given Diagram
and the given diagram type provider ID.diagram
- A Diagram
providerId
- A String
which holds the diagram type provider id.DiagramEditorInput
editor inputpublic java.lang.String getProviderId()
getProviderId
in interface IDiagramEditorInput
public void setProviderId(java.lang.String providerId)
setProviderId
in interface IDiagramEditorInput
providerId
- The providerId to set.public java.lang.String getFactoryId()
DiagramEditorInput
s from
mementos.getFactoryId
in interface IPersistableElement
public ImageDescriptor getImageDescriptor()
getImageDescriptor
in interface IEditorInput
null
.public java.lang.String getName()
getName
in interface IEditorInput
URI
string#getLiveName()
public java.lang.String getToolTipText()
getToolTipText
in interface IEditorInput
URI
string#getLiveToolTipText()
public java.lang.Object getAdapter(java.lang.Class adapter)
IAdaptable
, supports adaptation to
IFile
.getAdapter
in interface IAdaptable
adapter
- The adapter class to look upnull
if
this object does not have an adapter for the given classpublic void saveState(IMemento memento)
URI
string, object name and provider ID to the given
IMemento
.saveState
in interface IPersistable
memento
- The memento to store the information inpublic final java.lang.String getUriString()
getUriString
in interface IDiagramEditorInput
URI
string this input and its editors operate onpublic boolean exists()
Note: The editor gets only restored, when true
is returned.
exists
in interface IEditorInput
true
if the input's state denotes a living EMF
object public IPersistableElement getPersistable()
getPersistable
in interface IEditorInput
public org.eclipse.emf.common.util.URI getUri()
getUri
in interface IDiagramEditorInput
URI
or null
in case of failurespublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- The object to compare this instance with.true
if the represented objects are the samepublic int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public void updateUri(org.eclipse.emf.common.util.URI diagramFileUri)
updateUri
in interface IDiagramEditorInput