Java Reference
In-Depth Information
provider (notes, text, and so on). These are
org.eclipse.gmf.runtime.
diagram.ui.geoshapes.internal.providers.GeoshapeEditPart
Provider
and
org.eclipse.gmf.runtime.diagram.ui.providers.
internal.DiagramEditPartProvider
, respectively.
10.4.3 EditPolicyService
As the previous section alluded to, you can install and remove EditPolicies on
EditPart
s using the
EditPolicyService
. In fact, clients can contribute new
EditPolicy
implementations to existing diagrams without overriding the
EditPart
class itself. Figure 10-27 shows the main elements of the service.
Note that GMF's
GraphicalEditPart
class overrides (final) the GEF
AbstractEditPart createEditPolicies()
method. This override calls
createDefaultEditPolicies()
and then invokes the
EditPolicyService
to install EditPolicies for the
EditPart
. Those who want to install EditPolicies
programmatically must do so by overriding
c
reateDefaultEditPolicies()
.
As with all services, the
EditPolicyService
offers all providers a chance
to install
EditPolicies
based on their stated priorities. To override an
EditPolicy
, install a new one using the same role. To remove an
EditPolicy
,
contribute it using a
null
role.
Figure 10-27
EditPolicyService
Search WWH ::
Custom Search