Runtime

## org.eclipse.gmf.runtime.diagram.ui.util
Class EditPartUtil

    java.lang.Object
      org.eclipse.gmf.runtime.diagram.ui.util.EditPartUtil

public class EditPartUtil
extends java.lang.Object

provides different utility functions for the EditPart

Constructor Summary
`EditPartUtil()`

Method Summary
`static java.lang.String` `getSemanticEClassName(IGraphicalEditPart editPart)` gets the `Editpart`'s semantic element Class Id, this could be used to check the semantic element type
`static boolean` `isWriteTransactionInProgress(IGraphicalEditPart editPart, boolean includeUnprotected, boolean otherThread)` Checks if the current active transaction is a Write transaction or not unprotected transaction are not considered write transaction
`static void` `removeCanonicalEditPolicies(EditPart editPart, boolean considerChildren)` remove all the canonical edit policies on the passed edit part, if the considerChildren flag is ON, it will remove the canonical editpolicies on every edit part in the passed edit part hirarchy
`static void` `synchronizeRunnableToMainThread(IGraphicalEditPart editPart, java.lang.Runnable runThreadSafe)` Used as general utility usually in the context of handling notifications to ensure that a runnable will be run in the appropriate thread context so that SWT or other reservered resources can be accessed.

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

Constructor Detail

### EditPartUtil

    public EditPartUtil()

Method Detail

### getSemanticEClassName

    public static java.lang.String getSemanticEClassName(IGraphicalEditPart editPart)

  gets the `Editpart`'s semantic element Class Id, this could be used to check the semantic element type

  Returns:
    the semantic element class Id

### removeCanonicalEditPolicies

    public static void removeCanonicalEditPolicies(EditPart editPart,
                                                   boolean considerChildren)

  remove all the canonical edit policies on the passed edit part, if the considerChildren flag is ON, it will remove the canonical editpolicies on every edit part in the passed edit part hirarchy

  Parameters:
    `editPart` - the edit part to remove the edit policy from
    `considerChildren` - determine the the canonical edit policies will be removed from children as well or not

### synchronizeRunnableToMainThread

    public static void synchronizeRunnableToMainThread(IGraphicalEditPart editPart,
                                                       java.lang.Runnable runThreadSafe)

  Used as general utility usually in the context of handling notifications to ensure that a runnable will be run in the appropriate thread context so that SWT or other reservered resources can be accessed. Should be only be used when the client is sure that in the stack of execution SWT resources will be accessed directly. Otherwise, this could incur a performance penalty when handling notifications. Also, it may spawn the runnable asynchronously to the main thread which may break assumptions on ordering when the events are handled.

  Parameters:
    `editPart` - the `EditPart` that is receiving notification or is being accessed potentially on a worker thread that needs to ensure safe access to SWT or other resources reserved for the main thread.
    `runThreadSafe` - the `Runnable` that is to be executed in a thread safe manner.

### isWriteTransactionInProgress

    public static boolean isWriteTransactionInProgress(IGraphicalEditPart editPart,
                                                       boolean includeUnprotected,
                                                       boolean otherThread)

  Checks if the current active transaction is a Write transaction or not unprotected transaction are not considered write transaction

  Parameters:
    `editPart` - the `IGraphicalEditPart` that is used as a context to find the currently running transaction if any.
    `includeUnprotected` - `boolean` value that if `true` will consider unprotected transactions when determining if a write transaction is in progress.
    `otherThread` - `boolean` value that if `true`, will verify whether there is an active transaction only when on a different thread then the caller. This is useful to determine if a deadlock scenario will occur.
  Returns:
    `true` if the current active transaction is a write transaction

Runtime

Guidelines for using Eclipse APIs.

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