KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > swt > browser > FilePicker_1_8


1 /*******************************************************************************
2  * Copyright (c) 2003, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.swt.browser;
12
13 import org.eclipse.swt.internal.mozilla.*;
14
15 class FilePicker_1_8 extends FilePicker {
16
17 void createCOMInterfaces () {
18     /* Create each of the interfaces that this object implements */
19     supports = new XPCOMObject (new int[] {2, 0, 0}) {
20         public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
21         public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
22         public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
23     };
24
25     filePicker = new XPCOMObject (new int[] {2, 0, 0, 3, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}) {
26         public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
27         public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
28         public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
29         public int /*long*/ method3 (int /*long*/[] args) {return Init (args[0], args[1], args[2]);}
30         public int /*long*/ method4 (int /*long*/[] args) {return AppendFilters (args[0]);}
31         public int /*long*/ method5 (int /*long*/[] args) {return AppendFilter (args[0], args[1]);}
32         public int /*long*/ method6 (int /*long*/[] args) {return GetDefaultString (args[0]);}
33         public int /*long*/ method7 (int /*long*/[] args) {return SetDefaultString (args[0]);}
34         public int /*long*/ method8 (int /*long*/[] args) {return GetDefaultExtension (args[0]);}
35         public int /*long*/ method9 (int /*long*/[] args) {return SetDefaultExtension (args[0]);}
36         public int /*long*/ method10 (int /*long*/[] args) {return GetFilterIndex (args[0]);}
37         public int /*long*/ method11 (int /*long*/[] args) {return SetFilterIndex (args[0]);}
38         public int /*long*/ method12 (int /*long*/[] args) {return GetDisplayDirectory (args[0]);}
39         public int /*long*/ method13 (int /*long*/[] args) {return SetDisplayDirectory (args[0]);}
40         public int /*long*/ method14 (int /*long*/[] args) {return GetFile (args[0]);}
41         public int /*long*/ method15 (int /*long*/[] args) {return GetFileURL (args[0]);}
42         public int /*long*/ method16 (int /*long*/[] args) {return GetFiles (args[0]);}
43         public int /*long*/ method17 (int /*long*/[] args) {return Show (args[0]);}
44     };
45 }
46
47 /*
48  * As of Mozilla 1.8 some of nsIFilePicker's string arguments changed type. This method
49  * answers a java string based on the type of string that is appropriate for the Mozilla
50  * version being used.
51  */

52 String JavaDoc parseAString (int /*long*/ string) {
53     if (string == 0) return null;
54     int length = XPCOM.nsEmbedString_Length (string);
55     int /*long*/ buffer = XPCOM.nsEmbedString_get (string);
56     char[] chars = new char[length];
57     XPCOM.memmove (chars, buffer, length * 2);
58     return new String JavaDoc (chars);
59 }
60 }
61
Popular Tags