KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > stringsubstitution > SystemPropertyArgumentSelector


1 /*******************************************************************************
2  * Copyright (c) 2005 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.debug.internal.ui.stringsubstitution;
12
13 import org.eclipse.core.variables.IStringVariable;
14 import org.eclipse.jface.viewers.LabelProvider;
15 import org.eclipse.jface.window.Window;
16 import org.eclipse.swt.widgets.Shell;
17 import org.eclipse.ui.dialogs.ElementListSelectionDialog;
18
19 /**
20  * Argument selector for system properties.
21  *
22  * @since 3.2
23  */

24 public class SystemPropertyArgumentSelector implements IArgumentSelector {
25
26     /* (non-Javadoc)
27      * @see org.eclipse.debug.internal.ui.stringsubstitution.IArgumentSelector#selectArgument(org.eclipse.core.variables.IStringVariable, org.eclipse.swt.widgets.Shell)
28      */

29     public String JavaDoc selectArgument(IStringVariable variable, Shell shell) {
30         ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, new LabelProvider());
31         dialog.setElements(System.getProperties().keySet().toArray());
32         dialog.setTitle(StringSubstitutionMessages.SystemPropertyArgumentSelector_0);
33         dialog.setMessage(StringSubstitutionMessages.SystemPropertyArgumentSelector_1);
34         if (dialog.open() == Window.OK) {
35             return (String JavaDoc) dialog.getResult()[0];
36         }
37         return null;
38     }
39
40 }
41
Popular Tags