Package org.eclipse.emf.compare.ide.ui.internal.util

# Class PlatformElementUtil

java.lang.Object
org.eclipse.emf.compare.ide.ui.internal.util.PlatformElementUtil

public class PlatformElementUtil extends Object
This provides access to commonly used functions for platform elements, such as adaptation or file lookup.

## Constructor Summary

Constructors
Constructor
Description
`PlatformElementUtil()`

## Method Summary

Modifier and Type
Method
Description
`static <T> T`
`adaptAs(Object object, Class<T> clazz)`
Tries and adapt the given object to an instance of the given class.
`static org.eclipse.core.resources.IFile`
`findFile(org.eclipse.compare.ITypedElement element)`
Try and determine the resource of the given element.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### PlatformElementUtil

public PlatformElementUtil()

## Method Details

### findFile

public static org.eclipse.core.resources.IFile findFile(org.eclipse.compare.ITypedElement element)
Try and determine the resource of the given element.

Parameters:
  `element` - The element for which we need an `IResource`.
Returns:
  The resource corresponding to the given `element` if we could find it, `null` otherwise.

### adaptAs

public static <T> T adaptAs(Object object, Class<T> clazz)
Tries and adapt the given object to an instance of the given class.

Type Parameters:
  `T` - Type to which we need to adapt object.
Parameters:
  `object` - The object we need to coerce to a given `Class`.
  `clazz` - Class to which we are to adapt object.
Returns:
  object cast to type T if possible, `null` if not.