KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2005, 2006 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 org.eclipse.core.runtime.Preferences;
14 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
15 import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
16 import org.eclipse.debug.ui.CommonTab;
17 import org.eclipse.debug.ui.EnvironmentTab;
18 import org.eclipse.debug.ui.ILaunchConfigurationDialog;
19 import org.eclipse.debug.ui.ILaunchConfigurationTab;
20 import org.eclipse.jdt.debug.ui.launchConfigurations.JavaArgumentsTab;
21 import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
22 import org.eclipse.pde.internal.core.ICoreConstants;
23 import org.eclipse.pde.internal.core.PDECore;
24 import org.eclipse.pde.ui.launcher.EquinoxPluginsTab;
25 import org.eclipse.pde.ui.launcher.EquinoxSettingsTab;
26 import org.eclipse.pde.ui.launcher.TracingTab;
27
28 public class EquinoxLauncherTabGroup extends AbstractLaunchConfigurationTabGroup {
29
30     public void createTabs(ILaunchConfigurationDialog dialog, String JavaDoc mode) {
31         ILaunchConfigurationTab[] tabs =
32             new ILaunchConfigurationTab[]{
33                     new EquinoxPluginsTab(),
34                     new JavaArgumentsTab(),
35                     new EquinoxSettingsTab(),
36                     new TracingTab(),
37                     new EnvironmentTab(),
38                     new CommonTab()};
39         setTabs(tabs);
40     }
41     
42     public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
43         super.setDefaults(configuration);
44         configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, "-console"); //$NON-NLS-1$
45
Preferences preferences = PDECore.getDefault().getPluginPreferences();
46         String JavaDoc progArgs = preferences.getString(ICoreConstants.PROGRAM_ARGS);
47         if (progArgs.indexOf("-console") == -1) //$NON-NLS-1$
48
progArgs = "-console " + progArgs; //$NON-NLS-1$
49
configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, progArgs); //$NON-NLS-1$
50
String JavaDoc vmArgs = preferences.getString(ICoreConstants.VM_ARGS);
51         if (vmArgs.length() > 0)
52             configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, vmArgs);
53     }
54
55 }
56
Popular Tags