KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ant > internal > ui > launchConfigurations > AddVariableStringAction


1 /*******************************************************************************
2  * Copyright (c) 2000, 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.ant.internal.ui.launchConfigurations;
12
13 import org.eclipse.jdt.internal.debug.ui.actions.RuntimeClasspathAction;
14 import org.eclipse.jdt.internal.debug.ui.launcher.IClasspathViewer;
15 import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
16 import org.eclipse.jdt.launching.JavaRuntime;
17
18 public class AddVariableStringAction extends RuntimeClasspathAction {
19     
20     public AddVariableStringAction(IClasspathViewer viewer) {
21         super(AntLaunchConfigurationMessages.AddVariableStringAction_1, viewer);
22     }
23     
24     /* (non-Javadoc)
25      * @see org.eclipse.jdt.internal.debug.ui.actions.RuntimeClasspathAction#getActionType()
26      */

27     protected int getActionType() {
28         return ADD;
29     }
30     
31     /* (non-Javadoc)
32      * @see org.eclipse.jface.action.IAction#run()
33      */

34     public void run() {
35         VariableInputDialog inputDialog = new VariableInputDialog(getShell());
36         inputDialog.open();
37         String JavaDoc variableString= inputDialog.getVariableString();
38         if (variableString != null && variableString.trim().length() > 0) {
39             IRuntimeClasspathEntry newEntry = JavaRuntime.newStringVariableClasspathEntry(variableString);
40             getViewer().addEntries(new IRuntimeClasspathEntry[] {newEntry});
41         }
42     }
43 }
44
Popular Tags