Runtime

## org.eclipse.gmf.runtime.diagram.core.services
Class ViewService

    java.lang.Object
      org.eclipse.gmf.runtime.common.core.service.AbstractProvider
          org.eclipse.gmf.runtime.common.core.service.Service
              org.eclipse.gmf.runtime.diagram.core.services.ViewService

All Implemented Interfaces:
  java.util.EventListener, IProvider, IProviderChangeListener, IViewProvider

public final class ViewService
extends Service
implements IViewProvider

A service for manipulating the notational models

Nested Class Summary
`protected static class` `ViewService.ProviderDescriptor` A descriptor for `ISemanticProvider` defined by a configuration element.

Field Summary

Fields inherited from class org.eclipse.gmf.runtime.common.core.service.Service
`INVALID_ELEMENT_MESSAGE_PATTERN`

Constructor Summary
`protected` `ViewService()` creates an instance

Method Summary
`static Diagram` `createDiagram(EObject context, java.lang.String kind, PreferencesHint preferencesHint)` Creates a diagram with the given context and kind
`Diagram` `createDiagram(IAdaptable semanticAdapter, java.lang.String diagramKindType, PreferencesHint preferencesHint)` create an `Diagram` element.
`static Diagram` `createDiagram(java.lang.String kind, PreferencesHint preferencesHint)` Creates a diagram with a kind
`Edge` `createEdge(IAdaptable semanticAdapter, View containerView, java.lang.String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint)` create an `Edge` element.
`View` `createEdge(IAdaptable semanticAdapter, View containerView, java.lang.String semanticHint, int index, PreferencesHint preferencesHint)`
`static Edge` `createEdge(View source, View target, EObject eObject, java.lang.String type, PreferencesHint preferencesHint)` Creates an edge for a given eObject and with a given type and connects it between a given source and a given target
`static Edge` `createEdge(View source, View target, java.lang.String type, PreferencesHint preferencesHint)` Creates an edge with a given type and connects it between the given source and target
`Node` `createNode(IAdaptable semanticAdapter, View containerView, java.lang.String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint)` creates a Node
`Node` `createNode(IAdaptable semanticElement, View containerView, java.lang.String semanticHint, int index, PreferencesHint preferencesHint)` creates a persisted Node
`static Node` `createNode(View container, EObject eObject, java.lang.String type, PreferencesHint preferencesHint)` Creates a node for a given eObject and with a given type and inserts it into a given container
`static Node` `createNode(View container, java.lang.String type, PreferencesHint preferencesHint)` Creates a node for a with a given type and inserts it thegiven container
`protected java.util.Map` `createPriorityCache()` Creates a map for caching service providers keyed by the values returned in `ViewService.getCachingKey(IOperation)`.
`View` `createView(java.lang.Class viewKind, IAdaptable semanticAdapter, View containerView, java.lang.String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint)` A convenience method to create a view with the given parameters
`protected java.lang.Object` `getCachingKey(IOperation operation)` Gets the key used to cache service providers that provide for `operation` in the map created by `ViewService.createPriorityCache()`.
`static ViewService` `getInstance()` Retrieves the singleton instance of the notation service.
`protected Service.ProviderDescriptor` `newProviderDescriptor(IConfigurationElement element)` Creates a new provider descriptor for the specified configuration `element`.
`boolean` `provides(java.lang.Class viewKind, IAdaptable semanticAdapter, View containerView, java.lang.String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint)` A convenience method to determine whether there is a provider that can create a view with the given parameters

Methods inherited from class org.eclipse.gmf.runtime.common.core.service.Service
`addProvider, clearCache, configureProviders, configureProviders, execute, executeUnique, getAllProviders, getPriority, getProviders, isOptimistic, isOptimized, providerChanged, provides, provides, removeProvider`

Methods inherited from class org.eclipse.gmf.runtime.common.core.service.AbstractProvider
`addProviderChangeListener, fireProviderChange, removeProviderChangeListener`

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

Methods inherited from interface org.eclipse.gmf.runtime.common.core.service.IProvider
`addProviderChangeListener, provides, removeProviderChangeListener`

Constructor Detail

### ViewService

    protected ViewService()

  creates an instance

Method Detail

### getInstance

    public static ViewService getInstance()

  Retrieves the singleton instance of the notation service.

  Returns:
    The notation service singleton.

### newProviderDescriptor

    protected Service.ProviderDescriptor newProviderDescriptor(IConfigurationElement element)

  Description copied from class: `Service`
  Creates a new provider descriptor for the specified configuration `element`.

  Overrides:
    `newProviderDescriptor` in class `Service`
  Parameters:
    `element` - The configuration element from which to create the descriptor.
  Returns:
    A new provider descriptor.
  See Also:
    `Service.newProviderDescriptor(org.eclipse.core.runtime.IConfigurationElement)`

### createPriorityCache

    protected java.util.Map createPriorityCache()

  Description copied from class: `Service`
  Creates a map for caching service providers keyed by the values returned in `Service.getCachingKey(IOperation)`.

  Overrides:
    `createPriorityCache` in class `Service`
  Returns:
    the new map
  See Also:
    `Service.createPriorityCache()`

### getCachingKey

    protected java.lang.Object getCachingKey(IOperation operation)

  Description copied from class: `Service`
  Gets the key used to cache service providers that provide for `operation` in the map created by `Service.createPriorityCache()`.

  Overrides:
    `getCachingKey` in class `Service`
  Parameters:
    `operation` - `IOperation` for which the key will be retrieved
  Returns:
    the key into the service providers cache
  See Also:
    `org.eclipse.gmf.runtime.common.core.service.Service#getCacheKey(org.eclipse.gmf.runtime.common.core.service.IOperation)`

### provides

    public final boolean provides(java.lang.Class viewKind,
                                  IAdaptable semanticAdapter,
                                  View containerView,
                                  java.lang.String semanticHint,
                                  int index,
                                  boolean persisted,
                                  PreferencesHint preferencesHint)

  A convenience method to determine whether there is a provider that can create a view with the given parameters

  Parameters:
    `viewKind` -
    `semanticAdapter` - adapts to either `Integer`or `IReference```
    `containerView` -
    `semanticHint` -
    `index` -
    `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:
    boolean

### createView

    public final View createView(java.lang.Class viewKind,
                                 IAdaptable semanticAdapter,
                                 View containerView,
                                 java.lang.String semanticHint,
                                 int index,
                                 boolean persisted,
                                 PreferencesHint preferencesHint)

  A convenience method to create a view with the given parameters

  Parameters:
    `viewKind` -
    `semanticAdapter` - adapts to `IReference```
    `containerView` -
    `semanticHint` -
    `index` -
    `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:
    IView

### createDiagram

    public final Diagram createDiagram(IAdaptable semanticAdapter,
                                       java.lang.String diagramKindType,
                                       PreferencesHint preferencesHint)

  Description copied from interface: `IViewProvider`
  create an `Diagram` element.

  Specified by:
    `createDiagram` in interface `IViewProvider`
  Parameters:
    `diagramKindType` - indicates the diagram type
    `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 `Diagram`

### createDiagram

    public static Diagram createDiagram(EObject context,
                                        java.lang.String kind,
                                        PreferencesHint preferencesHint)

  Creates a diagram with the given context and kind

  Parameters:
    `context` - The diagram element context
    `kind` - diagram kind, check `ViewType` for predefined values
    `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:
    A newly created `Diagram`

### createDiagram

    public static Diagram createDiagram(java.lang.String kind,
                                        PreferencesHint preferencesHint)

  Creates a diagram with a kind

  Parameters:
    `kind` - diagram kind, check `ViewType` for predefined values
    `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:
    A newly created `Diagram`

### createNode

    public static Node createNode(View container,
                                  EObject eObject,
                                  java.lang.String type,
                                  PreferencesHint preferencesHint)

  Creates a node for a given eObject and with a given type and inserts it into a given container

  Parameters:
    `container` - The node view container
    `eObject` - The node view object context
    `type` - The node view type, check `ViewType` for predefined values
    `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:
    A newly created `Node`

### createNode

    public static Node createNode(View container,
                                  java.lang.String type,
                                  PreferencesHint preferencesHint)

  Creates a node for a with a given type and inserts it thegiven container

  Parameters:
    `container` - The node view container
    `type` - The node view type, check `ViewType` for predefined values
    `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:
    A newly created `Node`

### createEdge

    public static Edge createEdge(View source,
                                  View target,
                                  EObject eObject,
                                  java.lang.String type,
                                  PreferencesHint preferencesHint)

  Creates an edge for a given eObject and with a given type and connects it between a given source and a given target

  Parameters:
    `source` - The edge's source view
    `target` - The edge's target view
    `eObject` - The edge view object context
    `type` - The edge view type, check `ViewType` for predefined values
    `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:
    A newly created `Edge`

### createEdge

    public static Edge createEdge(View source,
                                  View target,
                                  java.lang.String type,
                                  PreferencesHint preferencesHint)

  Creates an edge with a given type and connects it between the given source and target

  Parameters:
    `source` - The edge's source view
    `target` - The edge's target view
    `type` - The edge view type, check `ViewType` for predefined values
    `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:
    A newly created `Edge`

### createEdge

    public final Edge createEdge(IAdaptable semanticAdapter,
                                 View containerView,
                                 java.lang.String semanticHint,
                                 int index,
                                 boolean persisted,
                                 PreferencesHint preferencesHint)

  Description copied from interface: `IViewProvider`
  create an `Edge` element.

  Specified by:
    `createEdge` in interface `IViewProvider`
  Parameters:
    `containerView` - the container view that will contain the created view.
    `index` - position in the container view's list of children views.
    `persisted` - indicates if the created edge will be persisted or not
    `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 `Edge`

### createEdge

    public final View createEdge(IAdaptable semanticAdapter,
                                 View containerView,
                                 java.lang.String semanticHint,
                                 int index,
                                 PreferencesHint preferencesHint)

  Parameters:
    `semanticAdapter` -
    `containerView` -
    `semanticHint` -
    `index` -
    `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:

### createNode

    public final Node createNode(IAdaptable semanticElement,
                                 View containerView,
                                 java.lang.String semanticHint,
                                 int index,
                                 PreferencesHint preferencesHint)

  creates a persisted Node

  Parameters:
    `semanticElement` -
    `containerView` -
    `semanticHint` -
    `index` -
    `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 node

### createNode

    public Node createNode(IAdaptable semanticAdapter,
                           View containerView,
                           java.lang.String semanticHint,
                           int index,
                           boolean persisted,
                           PreferencesHint preferencesHint)

  creates a Node

  Specified by:
    `createNode` in interface `IViewProvider`
  Parameters:
    `containerView` -
    `semanticHint` -
    `persisted` -
    `index` -
    `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 node

Runtime

Guidelines for using Eclipse APIs.

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