01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 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.pde.ui.launcher;
11:
12: import org.eclipse.core.runtime.CoreException;
13: import org.eclipse.debug.core.ILaunchConfiguration;
14: import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
15: import org.eclipse.debug.ui.CommonTab;
16: import org.eclipse.debug.ui.EnvironmentTab;
17: import org.eclipse.debug.ui.ILaunchConfigurationDialog;
18: import org.eclipse.debug.ui.ILaunchConfigurationTab;
19: import org.eclipse.jdt.debug.ui.launchConfigurations.JavaArgumentsTab;
20: import org.eclipse.pde.internal.ui.IPDEUIConstants;
21:
22: /**
23: * Creates and initializes the tabs for the Eclipse Application launch configuration.
24: * <p>
25: * This class may be instantiated or subclassed by clients.
26: * </p>
27: * @since 3.3
28: */
29: public class EclipseLauncherTabGroup extends
30: AbstractPDELaunchConfigurationTabGroup {
31:
32: /*
33: * (non-Javadoc)
34: * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String)
35: */
36: public void createTabs(ILaunchConfigurationDialog dialog,
37: String mode) {
38: ILaunchConfigurationTab[] tabs = null;
39: tabs = new ILaunchConfigurationTab[] { new MainTab(),
40: new JavaArgumentsTab(), new PluginsTab(),
41: new ConfigurationTab(), new TracingTab(),
42: new EnvironmentTab(), new CommonTab() };
43: setTabs(tabs);
44: }
45:
46: public void performApply(
47: ILaunchConfigurationWorkingCopy configuration) {
48: super .performApply(configuration);
49: try {
50: // if the configuration has the GENERATED_CONFIG flag, we need to see if we should remove the flag
51: if (!(configuration.getAttribute(
52: IPDEUIConstants.GENERATED_CONFIG, false)))
53: return;
54: ILaunchConfiguration original = configuration.getOriginal();
55: // peformApply is called when opening the launch dialog the first time. In this case the user has not modified the configuration so we should
56: // keep the GENERATED_CONFIG flag. To check to see if this is the case, we need to see if an attribute used to initialize the launch config
57: // is present in the original copy. We do this by querying the config twice, with different default values. If the values == eachother, we
58: // we know the value is present. Since generated configs don't contain DOCLEARLOG, we know if DOCLEARLOG is present in the original copy the
59: // perform apply so save the initialization values has already been run and this is a user modification.
60: boolean firstQuery = original.getAttribute(
61: IPDEUIConstants.DOCLEARLOG, false);
62: boolean secondQuery = original.getAttribute(
63: IPDEUIConstants.DOCLEARLOG, true);
64: if (original != null && firstQuery == secondQuery)
65: configuration.setAttribute(
66: IPDEUIConstants.GENERATED_CONFIG, false);
67: } catch (CoreException e) {
68: }
69: }
70:
71: }
|