|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 // PACKAGE |
|
19 package com.nokia.mid.ui; |
|
20 |
|
21 // EXTERNAL IMPORTS |
|
22 import com.nokia.mj.impl.rt.legacy.NativeError; |
|
23 import com.nokia.mj.impl.rt.legacy.ToolkitInvoker; |
|
24 |
|
25 |
|
26 /** |
|
27 * Class to provide extra functionality that is related to text-editing |
|
28 * |
|
29 * @since 1.4 |
|
30 */ |
|
31 public abstract class Clipboard |
|
32 { |
|
33 |
|
34 // Private constructor. |
|
35 private Clipboard() |
|
36 { |
|
37 } |
|
38 |
|
39 /** |
|
40 * Copies characters into the system-clipboard |
|
41 * |
|
42 * @param text the text to be copied |
|
43 */ |
|
44 public static void copyToClipboard(String text) |
|
45 { |
|
46 // Toolkit invoker is needed for accessing javax.microedition.lcdui |
|
47 // package |
|
48 ToolkitInvoker toolkitInvoker = ToolkitInvoker.getToolkitInvoker(); |
|
49 |
|
50 Object toolkit = toolkitInvoker.getToolkit(); |
|
51 synchronized (toolkit) |
|
52 { |
|
53 NativeError.check(_copyToClipboard( |
|
54 toolkitInvoker.toolkitGetHandle(toolkit), text)); |
|
55 } |
|
56 } |
|
57 |
|
58 /* |
|
59 * Stores the text into the clipboard. |
|
60 * |
|
61 * @param toolkitHandle A handle to the LCDUI toolkit. |
|
62 * |
|
63 * @param text A text to be copied into the system-clipboard. |
|
64 * |
|
65 * @return NativeError.KErrNone if the operation was successful. Otherwise, |
|
66 * a system-wide error code is returned. |
|
67 */ |
|
68 private static native int _copyToClipboard(int toolkit, String text); |
|
69 |
|
70 } |
|
71 |
|
72 // END OF FILE |