KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > launcher > JUnitArgumentsTab


1 /*******************************************************************************
2  * Copyright (c) 2003, 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.pde.internal.ui.launcher;
12
13 import java.util.*;
14
15 import org.eclipse.core.runtime.*;
16 import org.eclipse.debug.core.*;
17 import org.eclipse.pde.internal.ui.*;
18
19 public class JUnitArgumentsTab extends BasicLauncherTab {
20     
21     protected String JavaDoc getApplicationAttribute() {
22         return APP_TO_TEST;
23     }
24     
25     public void setDefaults(ILaunchConfigurationWorkingCopy config) {
26         config.setAttribute(
27             LOCATION + "0", //$NON-NLS-1$
28
LauncherUtils.getDefaultPath().append("runtime-test-workspace").toOSString()); //$NON-NLS-1$
29
config.setAttribute(DOCLEAR, true);
30         config.setAttribute(ASKCLEAR, false);
31         config.setAttribute(PROGARGS, ""); //$NON-NLS-1$
32
config.setAttribute(VMARGS, ""); //$NON-NLS-1$
33
config.setAttribute(BOOTSTRAP_ENTRIES, ""); //$NON-NLS-1$
34
if (!JUnitLaunchConfiguration.requiresUI(config))
35             config.setAttribute(APPLICATION, JUnitLaunchConfiguration.CORE_APPLICATION);
36     }
37     
38     protected String JavaDoc[] getApplicationNames() {
39         TreeSet result = new TreeSet();
40         result.add(PDEUIMessages.JUnitArgumentsTab_headless); //$NON-NLS-1$
41
String JavaDoc[] appNames = super.getApplicationNames();
42         for (int i = 0; i < appNames.length; i++) {
43             result.add(appNames[i]);
44         }
45         return (String JavaDoc[])result.toArray(new String JavaDoc[result.size()]);
46     }
47     
48     /* (non-Javadoc)
49      * @see org.eclipse.pde.internal.ui.launcher.BasicLauncherTab#initializeApplicationSection(org.eclipse.debug.core.ILaunchConfiguration)
50      */

51     protected void initializeApplicationSection(ILaunchConfiguration config)
52             throws CoreException {
53         String JavaDoc application = config.getAttribute(APPLICATION, (String JavaDoc)null);
54         if (JUnitLaunchConfiguration.CORE_APPLICATION.equals(application))
55             fApplicationCombo.setText(PDEUIMessages.JUnitArgumentsTab_headless); //$NON-NLS-1$
56
else
57             super.initializeApplicationSection(config);
58     }
59     
60     /* (non-Javadoc)
61      * @see org.eclipse.pde.internal.ui.launcher.BasicLauncherTab#saveApplicationSection(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
62      */

63     protected void saveApplicationSection(ILaunchConfigurationWorkingCopy config) {
64         if (fApplicationCombo.getText().equals(PDEUIMessages.JUnitArgumentsTab_headless)) { //$NON-NLS-1$
65
config.setAttribute(APPLICATION, JUnitLaunchConfiguration.CORE_APPLICATION);
66             config.setAttribute(APP_TO_TEST, (String JavaDoc)null);
67         } else {
68             config.setAttribute(APPLICATION, (String JavaDoc)null);
69             super.saveApplicationSection(config);
70         }
71     }
72     
73
74     
75 }
76
Popular Tags