4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
\r
7 * Kangho Kim <kh5325.kim@samsung.com>
\r
9 * Licensed under the Apache License, Version 2.0 (the "License");
\r
10 * you may not use this file except in compliance with the License.
\r
11 * You may obtain a copy of the License at
\r
13 * http://www.apache.org/licenses/LICENSE-2.0
\r
15 * Unless required by applicable law or agreed to in writing, software
\r
16 * distributed under the License is distributed on an "AS IS" BASIS,
\r
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
18 * See the License for the specific language governing permissions and
\r
19 * limitations under the License.
\r
26 package org.tizen.common.handler;
\r
28 import org.eclipse.core.commands.AbstractHandler;
\r
29 import org.eclipse.core.commands.ExecutionEvent;
\r
30 import org.eclipse.core.commands.ExecutionException;
\r
31 import org.eclipse.swt.dnd.Clipboard;
\r
32 import org.eclipse.ui.handlers.HandlerUtil;
\r
35 * Superclass for clipboard related handlers providing safe creation and
\r
36 * disposal of the {@link Clipboard}.
\r
38 public abstract class ClipboardHandler extends AbstractHandler {
\r
39 public Object execute(ExecutionEvent event) throws ExecutionException {
\r
40 Clipboard clipboard = new Clipboard(HandlerUtil.getActiveShell(event)
\r
43 return execute(event, clipboard);
\r
45 clipboard.dispose();
\r
49 protected abstract Object execute(ExecutionEvent event, Clipboard clipboard)
\r
50 throws ExecutionException;
\r