01: /*******************************************************************************
02: * Copyright (c) 2000, 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jdt.ui.examples;
11:
12: import org.eclipse.swt.widgets.Display;
13: import org.eclipse.swt.widgets.Shell;
14:
15: import org.eclipse.jface.viewers.ILabelProvider;
16:
17: import org.eclipse.ui.dialogs.TwoPaneElementSelector;
18:
19: public class TwoPaneElementSelectorExample {
20:
21: public static void main(String[] args) {
22: java.util.Random random = new java.util.Random();
23: Object[] elements = new Object[8000];
24: for (int i = 0; i < elements.length; i++)
25: elements[i] = new Integer(random.nextInt()).toString();
26: ILabelProvider elementRenderer = new org.eclipse.jface.viewers.LabelProvider() {
27: public String getText(Object element) {
28: return element.toString();
29: }
30: };
31: ILabelProvider qualfierRenderer = new org.eclipse.jface.viewers.LabelProvider() {
32: public String getText(Object element) {
33: return element.toString();
34: }
35: };
36: Display display = new Display();
37: TwoPaneElementSelector d = new TwoPaneElementSelector(
38: new Shell(display), elementRenderer, qualfierRenderer);
39: d.setTitle("Title");
40: d.setMessage("this is a message");
41: d.setElements(elements);
42:
43: d.open();
44:
45: Object res = d.getResult();
46: System.out.println("res= " + res);
47: }
48: }
|