Runtime

## org.eclipse.gmf.runtime.emf.clipboard.core
Class ClipboardOperation

    java.lang.Object
      org.eclipse.gmf.runtime.emf.clipboard.core.ClipboardOperation

Direct Known Subclasses:
  BasePasteOperation, CopyOperation

    public abstract class ClipboardOperation

extends java.lang.Object

Abstract specification of a copy or paste operation. Maintains a progress monitor, support utility, and provides some reusable features.

Note that this class is not intended to be extended by clients. Clients may not instantiate it.

Field Summary
`static int` `TOTAL_WORK` The total amount of work accorded to a progress monitor.
`static int` `WORK_UNIT` The size of a single work unit in the progress monitor.

Constructor Summary
`ClipboardOperation(IProgressMonitor monitor, IClipboardSupport clipboardSupport)` Initializes me with my progress monitor and clipboard support.

Method Summary
`protected void` `catchException(java.lang.String methodName, java.lang.Exception ex)` Traces and logs a caught exception.
`IClipboardSupport` `getClipboardOperationHelper()` Obtains the clipboard support object that I rely on to make decisions about copy/paste semantics.
`IProgressMonitor` `getProgressMonitor()` Obtains my progress monitor.
`protected boolean` `isCancelled()` Queries whether I have been cancelled, by cancellation of my progress monitor.
`protected void` `throwCancelException(java.lang.String methodName)` Throws, traces, and logs a cancellation exception.
`protected void` `throwException(java.lang.String methodName, java.lang.RuntimeException ex)` Traces and logs a thrown exception.

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

Field Detail

### WORK_UNIT

    public static final int WORK_UNIT

  The size of a single work unit in the progress monitor.

  See Also:
    Constant Field Values

### TOTAL_WORK

    public static final int TOTAL_WORK

  The total amount of work accorded to a progress monitor.

  See Also:
    Constant Field Values

Constructor Detail

### ClipboardOperation

    public ClipboardOperation(IProgressMonitor monitor,
                              IClipboardSupport clipboardSupport)

  Initializes me with my progress monitor and clipboard support.

  Parameters:
    `monitor` - a progress monitor, or `null` if no progress tracking is needed
    `clipboardSupport` - the clipboard support object

Method Detail

### getProgressMonitor

    public IProgressMonitor getProgressMonitor()

  Obtains my progress monitor.

  Returns:
    my progress monitor (never `null`)

### isCancelled

    protected boolean isCancelled()

  Queries whether I have been cancelled, by cancellation of my progress monitor.

  Returns:
    whether I have been cancelled

### getClipboardOperationHelper

    public final IClipboardSupport getClipboardOperationHelper()

  Obtains the clipboard support object that I rely on to make decisions about copy/paste semantics.

  Returns:
    my clipboard support

### catchException

    protected void catchException(java.lang.String methodName,
                                  java.lang.Exception ex)

  Traces and logs a caught exception.

  Parameters:
    `methodName` - the method in which the exception was caught
    `ex` - the exception that was caught

### throwException

    protected void throwException(java.lang.String methodName,
                                  java.lang.RuntimeException ex)

  Traces and logs a thrown exception.

  Parameters:
    `methodName` - the method in which the exception was thrown
    `ex` - the exception that was thrown
  Throws:
    `java.lang.RuntimeException` - the `ex` parameter

### throwCancelException

    protected void throwCancelException(java.lang.String methodName)

  Throws, traces, and logs a cancellation exception.

  Parameters:
    `methodName` - the method in which the exception was caught
  Throws:
    `OperationCanceledException` - always

Runtime

Guidelines for using Eclipse APIs.

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